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 3a15c95 commit c4d9afc
Showing 1 changed file with 5 additions and 43 deletions.
48 changes: 5 additions & 43 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,20 +135,21 @@ LOGFILE=$TMPRESULTS/testHeadlessComponent.log

installAlternativeJDK

#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

#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
#use bootjdk javac

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

echo "JAVA=$JAVA"
echo "javac=$JAVAC_BINARY"

cp=`mktemp -d`
$JAVAC_BINARY `find . -type f -name "*.java"` -d $cp

Expand Down

0 comments on commit c4d9afc

Please sign in to comment.