diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e31357d..e8cc9fb 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -85,6 +85,9 @@ jobs: test-windows: name: "Windows Jtreg" runs-on: "windows-latest" + defaults: + run: + shell: C:\tools\cygwin\bin\bash.exe --login --norc -o igncr '{0}' strategy: fail-fast: false matrix: @@ -104,16 +107,25 @@ jobs: jdkver: "21" steps: - uses: actions/checkout@v3 - - uses: msys2/setup-msys2@v2 + - name: Set up Cygwin + uses: egor-tensin/setup-cygwin@v4 with: - update: true - install: wget tar - - name: Prepare env - shell: msys2 {0} - run: ./run.sh "${JAVA_HOME}" + packages: wget tar bash dos2unix + - name: Set up JDK + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: ${{ matrix.jdkver}} + - name: Run + run: | + set -ex + cd "$GITHUB_WORKSPACE" ; pwd; ls -l + echo "it seems default shell do not honour -o igncr nor --norc" + dos2unix -v run.sh + find test -type f -name "*.sh" -exec dos2unix -v {} \; + bash.exe --login --norc -o igncr -x -c "cd /cygdrive/d/a/jtreg-buffer/jtreg-buffer && ./run.sh \"${JAVA_HOME}\"" - name: Upload results if: ${{ always() }} uses: actions/upload-artifact@v3 with: path: "test.*.tar.gz" - diff --git a/run.sh b/run.sh index 696ae83..96d0061 100755 --- a/run.sh +++ b/run.sh @@ -16,6 +16,19 @@ while [ -h "$SCRIPT_SOURCE" ]; do # resolve $SOURCE until the file is no longer done readonly SCRIPT_DIR="$( cd -P "$( dirname "$SCRIPT_SOURCE" )" && pwd )" +OS=`uname -s` +CYGWIN="false" +case "$OS" in + Windows_* | CYGWIN_NT* ) + PS=";" + FS="\\" + CYGWIN="true" + ;; + * ) + echo "Non cygwin system!" + ;; +esac + envVarArg="-e:CUSTOM_DUMMY_VARIABLE=true,JAVA_TOOL_OPTIONS,OTOOL_BUILD_ARCH,DISPLAY" keys=$(env | grep OTOOL_ | sed "s/=.*//") @@ -26,14 +39,18 @@ done set -e set -o pipefail -JAVA=${1} +JAVA="${1}" if [ "x$JAVA" == "x" ] ; then echo "Jdk is mandatory param (bugid is optional)" exit 1 fi; +if [ "x$CYGWIN" == "xtrue" ] ; then + JAVA="$(cygpath -pw ${JAVA})" +fi + if [ "x$JAVA_HOME" == "x" ] ; then - JAVA_HOME=$(dirname $(dirname $(readlink -f $(which javac)))) + JAVA_HOME="${JAVA}" fi; TIME=$(date +%s) @@ -61,7 +78,7 @@ if [ "x$JDK_MAJOR" == "x" ] ; then if [[ -e "$JAVA/bin/jshell" || -e "$JAVA/bin/jshell.exe" ]] ; then jshellScript="$(mktemp)" printf "System.out.print(Runtime.version().major())\n/exit" > ${jshellScript} - JDK_MAJOR=$( $JAVA/bin/jshell ${jshellScript} 2> /dev/null | grep -v -e "Started recording" -e "copy recording data to file" -e "^$" -e "\[" ) + JDK_MAJOR=$( "$JAVA/bin/jshell" ${jshellScript} 2> /dev/null | grep -v -e "Started recording" -e "copy recording data to file" -e "^$" -e "\[" ) rm ${jshellScript} fi fi @@ -87,9 +104,15 @@ fi echo Running with $JAVA... + +JTREG_JAR="$JTREG_HOME/lib/jtreg.jar" +if [ "x$CYGWIN" == "xtrue" ] ; then + JTREG_JAR="$(cygpath -pw ${JTREG_JAR})" +fi + r=0 mkdir -p test.${TIME}/jdk/JTwork test.${TIME}/jdk/JTreport -${JAVA_HOME}/bin/java -jar $JTREG_HOME/lib/jtreg.jar -v1 -a -ignore:quiet \ +"${JAVA}/bin/java" -jar "$JTREG_JAR" -v1 -a -ignore:quiet \ -w:test.${TIME}/jdk/JTwork -r:test.${TIME}/jdk/JTreport \ -jdk:$JAVA \ -xml \