From da1eb329c779ef604bc462f83747f4e9beaeef30 Mon Sep 17 00:00:00 2001 From: Jiri Vanek Date: Wed, 6 Mar 2024 14:10:33 +0100 Subject: [PATCH] Now using cygwin insted msys2 for windows --- .github/workflows/test.yaml | 26 +++++++++++++++------ run.sh | 46 ++++++++++++++++++++++++++++++------- 2 files changed, 57 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e31357d..b069779 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 -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..3184bb7 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,18 +39,26 @@ 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 -aw "${JAVA}")" +fi + if [ "x$JAVA_HOME" == "x" ] ; then - JAVA_HOME=$(dirname $(dirname $(readlink -f $(which javac)))) + JAVA_HOME="$(dirname $(dirname $(readlink -f $(which javac))))" fi; +if [ "x$CYGWIN" == "xtrue" ] ; then + JAVA_HOME="$(cygpath -aw "${JAVA_HOME}")" +fi + TIME=$(date +%s) -BUGID=${2} +BUGID="${2}" FOLDER="test" if [ "x$BUGID" != "x" -a -e "$BUGID" ] ; then @@ -60,9 +81,12 @@ if [ "x$JDK_MAJOR" == "x" ] ; then JDK_MAJOR=8 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 "\[" ) - rm ${jshellScript} + printf "System.out.print(Runtime.version().major())\n/exit" > "${jshellScript}" + if [ "x$CYGWIN" == "xtrue" ] ; then + jshellScript="$(cygpath -aw "${jshellScript}")" + fi + 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 echo "treating jdk as: $JDK_MAJOR" @@ -87,11 +111,17 @@ fi echo Running with $JAVA... + +JTREG_JAR="$JTREG_HOME/lib/jtreg.jar" +if [ "x$CYGWIN" == "xtrue" ] ; then + JTREG_JAR="$(cygpath -aw "${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_HOME}/bin/java" -jar "$JTREG_JAR" -v1 -a -ignore:quiet \ -w:test.${TIME}/jdk/JTwork -r:test.${TIME}/jdk/JTreport \ - -jdk:$JAVA \ + -jdk:"$JAVA" \ -xml \ $BUGID \ $JAVA_OPTS \