Skip to content

Commit

Permalink
Now using cygwin insted msys2 for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
judovana committed Mar 7, 2024
1 parent 004dc91 commit da1eb32
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 15 deletions.
26 changes: 19 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"

46 changes: 38 additions & 8 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/=.*//")
Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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 \
Expand Down

0 comments on commit da1eb32

Please sign in to comment.