Skip to content

Commit

Permalink
using new JRE capabilities of adoptium aqa-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jandrlik committed Nov 14, 2024
1 parent 633fa62 commit 48beceb
Showing 1 changed file with 7 additions and 42 deletions.
49 changes: 7 additions & 42 deletions testHeadlessComponents.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,45 +42,6 @@ else
exit 1
fi

function unwrap_file_to_location() {
if [ "$OS" == "mac" -o "$OS" == "linux" ]; then
tar --strip-components=1 -xf $1 -C $2
elif [ "$OS" == "windows" ]; then
unzip $1 -d $2
# Get the name of the extracted folder (assuming only one folder is present)
ls $2
extracted_folder_name=$(ls $2)

# Ensure only one folder is found
if [ "$(ls $2 | wc -l)" -eq 1 ]; then
# Move the contents to the desired destination without creating a new directory
mv "$2/$extracted_folder_name"/* "$2"
else
echo "Error: More than one directory found in $2."
fi
fi
}

function installAlternativeJDK() {
ARCH=$( uname -m )
if [ "x$BOOTJDK_DIR" == "x" ]; then
BOOTJDK_DIR=~/bootjdk
fi
if [ "x$BOOTJDK_ARCHIVE_DIR" == "x" ]; then
BOOTJDK_ARCHIVE_DIR=$WORKSPACE/bootjdkarchive
mkdir -p $BOOTJDK_ARCHIVE_DIR
cd $BOOTJDK_ARCHIVE_DIR
curl -OLJks "https://api.adoptopenjdk.net/v3/binary/latest/$OJDK_VERSION_NUMBER/ga/$OS/$ARCH/jdk/hotspot/normal/adoptopenjdk"
rm -rf ${BOOTJDK_DIR}
mkdir -p ${BOOTJDK_DIR}
unwrap_file_to_location ${BOOTJDK_ARCHIVE_DIR}/* ${BOOTJDK_DIR}
else
rm -rf ${BOOTJDK_DIR}
mkdir -p ${BOOTJDK_DIR}
ls ${BOOTJDK_ARCHIVE_DIR}
unwrap_file_to_location ${BOOTJDK_ARCHIVE_DIR}/*${ARCH}.tarxz ${BOOTJDK_DIR}
fi
}

function run_java_with_headless {
COMPONENTS_TO_TEST=$2
Expand Down Expand Up @@ -174,12 +135,16 @@ LOGFILE=$TMPRESULTS/testHeadlessComponent.log

installAlternativeJDK

JAVAC_BINARY="${BOOTJDK_DIR}/bin/javac"
if [ "$OS" == "mac" ]; then
#JAVA_COMMAND always contains link to the java from the SDK

JAVAC_BINARY="${JAVA_COMMAND}c"
if [ "$OS" == "mac1" ]; then
JAVAC_BINARY="${BOOTJDK_DIR}/Contents/Home/bin/javac"
fi

#use bootjdk javac
#JAVA_TO_TEST can contain either link to SDK or JRE java, however always the java that we want to test with
JAVA=$JAVA_TO_TEST

#other classes depend on this one, so we might as well just compile the main class
cp -r $SCRIPT_DIR/testHeadlessComponents $WORKSPACE
ls $WORKSPACE
Expand Down

0 comments on commit 48beceb

Please sign in to comment.