In jtreg -help, -jdk:<java.home> and testjdk:<java.home> are in the same documentation lines, and thus would appear to do the same thing, but they are not the same when it comes to calculating $JTREG_JAVA:
-jdk:<java.home> | -testjdk:<java.home>
Run all tests using specified JDK. For example,
-jdk:/usr/local/java/jdk1.5/solaris-sparc
https://openjdk.org/jtreg/runtests.html says:
If you want to explicitly specify the JDK used to run jtreg, set the JT_JAVA
environment variable before running jtreg. Otherwise, leave it unset, and
jtreg will default to using the same version of JDK to run jtreg as is used to
execute the tests.
But jtreg doesn't actually look at -testjdk, just -jdk:
# Look for -jdk option as possible default to run jtreg
...deleted...
for i in "$@" ; do
case $i in
-jdk:* ) jdk="`echo $i | sed -e 's/^-jdk://'`" ;;
esac
...deleted...
done
# Determine java for jtreg, from JTREG_JAVA, JAVA_HOME, -jdk, java
JTREG_JAVA=${JTREG_JAVA:-$JT_JAVA} # allow for old version of name
if [ -n "$JTREG_JAVA" ]; then
if [ -d "$JTREG_JAVA" ]; then
JTREG_JAVA="$JTREG_JAVA/bin/java"
fi
elif [ -n "$JAVA_HOME" ]; then
JTREG_JAVA="$JAVA_HOME/bin/java"
elif [ -n "$jdk" ]; then
JTREG_JAVA="$jdk/bin/java"
else
JTREG_JAVA=java
fi
if [ ! -e "$JTREG_JAVA" ]; then
echo "No java executable at $JTREG_JAVA"
exit 1;
fi
Either fix the docs to make this clear, or fix jtreg to accept either.
-jdk:<java.home> | -testjdk:<java.home>
Run all tests using specified JDK. For example,
-jdk:/usr/local/java/jdk1.5/solaris-sparc
https://openjdk.org/jtreg/runtests.html says:
If you want to explicitly specify the JDK used to run jtreg, set the JT_JAVA
environment variable before running jtreg. Otherwise, leave it unset, and
jtreg will default to using the same version of JDK to run jtreg as is used to
execute the tests.
But jtreg doesn't actually look at -testjdk, just -jdk:
# Look for -jdk option as possible default to run jtreg
...deleted...
for i in "$@" ; do
case $i in
-jdk:* ) jdk="`echo $i | sed -e 's/^-jdk://'`" ;;
esac
...deleted...
done
# Determine java for jtreg, from JTREG_JAVA, JAVA_HOME, -jdk, java
JTREG_JAVA=${JTREG_JAVA:-$JT_JAVA} # allow for old version of name
if [ -n "$JTREG_JAVA" ]; then
if [ -d "$JTREG_JAVA" ]; then
JTREG_JAVA="$JTREG_JAVA/bin/java"
fi
elif [ -n "$JAVA_HOME" ]; then
JTREG_JAVA="$JAVA_HOME/bin/java"
elif [ -n "$jdk" ]; then
JTREG_JAVA="$jdk/bin/java"
else
JTREG_JAVA=java
fi
if [ ! -e "$JTREG_JAVA" ]; then
echo "No java executable at $JTREG_JAVA"
exit 1;
fi
Either fix the docs to make this clear, or fix jtreg to accept either.