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 6, 2024
1 parent 004dc91 commit d715e4a
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 12 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"

33 changes: 28 additions & 5 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,41 @@ 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/=.*//")
for key in $keys; do
envVarArg="$envVarArg,$key"
done

set -e
set -ex #todo remove x
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)
Expand Down Expand Up @@ -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
Expand All @@ -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 \
Expand Down

0 comments on commit d715e4a

Please sign in to comment.