diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b446d96..4c793a4 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -39,7 +39,7 @@ jobs: java-version: ${{ matrix.jdkver || env.jdkver_latest }} - name: Run run: | - export OJDK_VERSION_NUMBER=${{ matrix.jdkver || env.jdkver_latest }} BOOTJDK_DIR=~/bootjdk JRESDK="jdk" + export OJDK_VERSION_NUMBER=${{ matrix.jdkver || env.jdkver_latest }} BOOTJDK_DIR=~/bootjdk JREJDK="jdk" ./testHeadlessComponents.sh - name: Pack results if: ${{ always() }} @@ -79,7 +79,7 @@ jobs: java-version: ${{ matrix.jdkver || env.jdkver_latest }} - name: Run run: | - export OJDK_VERSION_NUMBER=${{ matrix.jdkver || env.jdkver_latest }} BOOTJDK_DIR=~/bootjdk JRESDK="jre" + export OJDK_VERSION_NUMBER=${{ matrix.jdkver || env.jdkver_latest }} BOOTJDK_DIR=~/bootjdk JREJDK="jre" ./testHeadlessComponents.sh - name: Pack results if: ${{ always() }} @@ -126,7 +126,7 @@ jobs: - name: Run shell: msys2 {0} run: | - export OJDK_VERSION_NUMBER=${{ matrix.jdkver || env.jdkver_latest }} BOOTJDK_DIR=~/bootjdk JRESDK="jre" + export OJDK_VERSION_NUMBER=${{ matrix.jdkver || env.jdkver_latest }} BOOTJDK_DIR=~/bootjdk JREJDK="jre" ./testHeadlessComponents.sh - name: Pack results if: ${{ always() }} @@ -174,7 +174,7 @@ jobs: - name: Run shell: msys2 {0} run: | - export OJDK_VERSION_NUMBER=${{ matrix.jdkver || env.jdkver_latest }} BOOTJDK_DIR=~/bootjdk JRESDK="jre" + export OJDK_VERSION_NUMBER=${{ matrix.jdkver || env.jdkver_latest }} BOOTJDK_DIR=~/bootjdk JREJDK="jre" ./testHeadlessComponents.sh - name: Pack results if: ${{ always() }} @@ -230,7 +230,7 @@ jobs: java-version: ${{ matrix.jdkver || env.jdkver_latest }} - name: Run run: | - export OJDK_VERSION_NUMBER=${{ matrix.jdkver || env.jdkver_latest }} BOOTJDK_DIR=~/bootjdk JRESDK="jre" WORKSPACE=/Users/runner/workspace + export OJDK_VERSION_NUMBER=${{ matrix.jdkver || env.jdkver_latest }} BOOTJDK_DIR=~/bootjdk JREJDK="jre" WORKSPACE=/Users/runner/workspace /usr/local/bin/bash testHeadlessComponents.sh - name: Pack results if: ${{ always() }} @@ -288,7 +288,7 @@ jobs: java-version: ${{ matrix.jdkver || env.jdkver_latest }} - name: Run run: | - export OJDK_VERSION_NUMBER=${{ matrix.jdkver || env.jdkver_latest }} BOOTJDK_DIR=~/bootjdk JRESDK="jdk" WORKSPACE=/Users/runner/workspace + export OJDK_VERSION_NUMBER=${{ matrix.jdkver || env.jdkver_latest }} BOOTJDK_DIR=~/bootjdk JREJDK="jdk" WORKSPACE=/Users/runner/workspace /usr/local/bin/bash testHeadlessComponents.sh - name: Pack results if: ${{ always() }} diff --git a/README.md b/README.md index 5230c90..6740ce0 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,23 @@ # TestHeadlessComponents Test of correct behavior of swing components in a headless jre environment. + +## Running TestHeadlessComponents locally + +### Setting up the environment: +Nothing special is required, just install the java package or unpack the portable you want the test. + +### ENV variables: +The test utilizes *JAVA_HOME variable, so if it is not set it will not work correctly! In case of testing portable packages please set it up first. +BOOTJDK_DIR - directory to store bootjdk which is used to compile the code in case we are testing jre only installation. Uses ~/bootjdk by default and uses Adoptium latest build of relevant jdk for this purpose. +BOOTJDK_ARCHIVE_DIR - In case the user wants to use arbitrary jdk build, he can provide path to its archive's dir and it will be used in jre execution.. Creates and downloads to $WORKSPACE/bootjdkarchive if unset. +WORKSPACE - directory where the testsuite is going to execute all the tests. ~/workspace by default +TMPRESULTS - this is a location where the logfiles will be after the testsuite finishes. Same as WORKSPACE by default. +*JREJDK - This tells the testsuite whether we are testing jre or jdk. +ARCH - architecture of our system. The suite detects this automatically if left blank. +*OJDK_VERSION_NUMBER - number of jdk we are testing - this is used for downloading corresponding JDK from adoptium site. + +Variables marked with "*" are mandatory and the testsuite wont run without them. + +### Executing the testsuite + +Now it is as simple as running bash script testHeadlessComponents.sh. diff --git a/genericRunner.sh b/genericRunner.sh deleted file mode 100755 index 5d40e80..0000000 --- a/genericRunner.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -# needs OJDK_VERSION_NUMBER, JRESDK and BOOTJDK_DIR variables set - -set -x -set -e -set -o pipefail - -## assumes that both directories with old and new rpms are provided and filled with relevant rpms -## this script attempts parallel installation of old and new set of rpms - -## resolve folder of this script, following all symlinks, -## http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in -SCRIPT_SOURCE="${BASH_SOURCE[0]}" -while [ -h "$SCRIPT_SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink - SCRIPT_DIR="$( cd -P "$( dirname "$SCRIPT_SOURCE" )" && pwd )" - SCRIPT_SOURCE="$(readlink "$SCRIPT_SOURCE")" - # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located - [[ $SCRIPT_SOURCE != /* ]] && SCRIPT_SOURCE="$SCRIPT_DIR/$SCRIPT_SOURCE" -done -readonly SCRIPT_DIR="$( cd -P "$( dirname "$SCRIPT_SOURCE" )" && pwd )" - -export RFaT=`bash $SCRIPT_DIR/../get-run-folder-as-tests` - -export OJDK_VERSION="ojdk${OJDK_VERSION_NUMBER}" - -sh $SCRIPT_DIR/testHeadlessComponents.sh diff --git a/testHeadlessComponents.sh b/testHeadlessComponents.sh index a0c667a..447779f 100755 --- a/testHeadlessComponents.sh +++ b/testHeadlessComponents.sh @@ -62,10 +62,6 @@ function installAlternativeJDK() { if [ "x$BOOTJDK_DIR" == "x" ]; then BOOTJDK_DIR=~/bootjdk fi - if [ ! "x$ALTERNATE_BOOT_JDK" == "x" ] ; then - ALTERNATIVE_JDK_DIR=$ALTERNATE_BOOT_JDK - return 0 - fi if [ "x$BOOTJDK_ARCHIVE_DIR" == "x" ]; then BOOTJDK_ARCHIVE_DIR=$WORKSPACE/bootjdkarchive mkdir -p $BOOTJDK_ARCHIVE_DIR @@ -84,7 +80,7 @@ function installAlternativeJDK() { function run_java_with_headless { COMPONENTS_TO_TEST=$2 - $JAVA -cp $cp -Djava.awt.headless=$1 MainRunner -test=$COMPONENTS_TO_TEST -jreSdkHeadless=$JRESDK -displayValue=$DISPLAY + $JAVA -cp $cp -Djava.awt.headless=$1 MainRunner -test=$COMPONENTS_TO_TEST -jreSdkHeadless=$JREJDK -displayValue=$DISPLAY } function run_swing_component_test_unset { @@ -153,14 +149,16 @@ source ${RFaT}/jtreg-shell-xml.sh if [[ -z "${WORKSPACE}" ]]; then WORKSPACE=~/workspace - mkdir -p $WORKSPACE fi +mkdir -p $WORKSPACE + if [ "x$TMPRESULTS" == "x" ]; then TMPRESULTS=$WORKSPACE - mkdir -p $TMPRESULTS fi +mkdir -p $TMPRESULTS + touch $TMPRESULTS/testHeadlessComponent.txt @@ -189,26 +187,24 @@ $JAVAC_BINARY `find . -type f -name "*.java"` -d $cp declare -A resArray set +e -if [[ -z "${OTOOL_ARCH}" ]] ; then +if [[ -z "${ARCH}" ]] ; then RUN_ARCH=$(uname -m) -else - RUN_ARCH=$OTOOL_ARCH fi for testOption in compatible incompatible; do for headless in true false; do - if [[ "$JRESDK" == "jre" || "$JRESDK" == "jdk" && (("${testOption}${headless}" == "compatibletrue") || ("${testOption}${headless}" == "incompatiblefalse")) ]] ; then + if [[ "$JREJDK" == "jre" || "$JREJDK" == "jdk" && (("${testOption}${headless}" == "compatibletrue") || ("${testOption}${headless}" == "incompatiblefalse")) ]] ; then run_swing_component_test_unset ${testOption} ${headless} >> $LOGFILE 2>&1 resArray["jre_headless_${testOption}_${headless}_display_unset"]=$? fi - if [[ "x$XDISPLAY" == *x* ]] ; then + if [[ "x$XDISPLAY" == "x" ]] ; then echo "skipping tests with display set, as the default display was not defined" else run_swing_component_test_set ${testOption} ${headless} >> $LOGFILE 2>&1 resArray["jre_headless_${testOption}_${headless}_display_set"]=$? fi - if [[ "$JRESDK" == "jre" || "$JRESDK" == "jdk" && (("${testOption}${headless}" == "compatibletrue") || ("${testOption}${headless}" == "incompatiblefalse")) ]] ; then + if [[ "$JREJDK" == "jre" || "$JREJDK" == "jdk" && (("${testOption}${headless}" == "compatibletrue") || ("${testOption}${headless}" == "incompatiblefalse")) ]] ; then run_swing_component_test_fake ${testOption} ${headless} >> $LOGFILE 2>&1 resArray["jre_headless_${testOption}_${headless}_display_fake"]=$? fi