Skip to content

Commit

Permalink
8317039: Enable specifying the JDK used to run jtreg
Browse files Browse the repository at this point in the history
Reviewed-by: erikj
  • Loading branch information
Ludvig Janiuk authored and David Holmes committed Oct 5, 2023
1 parent 1ed9c76 commit a250ae4
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 deletions.
2 changes: 1 addition & 1 deletion make/RunTests.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ define SetupRunJtregTestBody
$$(RM) -r $$($1_TEST_RESULTS_DIR)

$1_COMMAND_LINE := \
$$(JAVA) $$($1_JTREG_LAUNCHER_OPTIONS) \
$$(JTREG_JAVA) $$($1_JTREG_LAUNCHER_OPTIONS) \
-Dprogram=jtreg -jar $$(JT_HOME)/lib/jtreg.jar \
$$($1_JTREG_BASIC_OPTIONS) \
-testjdk:$$(JDK_UNDER_TEST) \
Expand Down
2 changes: 2 additions & 0 deletions make/RunTestsPrebuilt.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ $(eval $(call SetupVariable,JT_HOME))
$(eval $(call SetupVariable,JDK_IMAGE_DIR,$(OUTPUTDIR)/images/jdk))
$(eval $(call SetupVariable,TEST_IMAGE_DIR,$(OUTPUTDIR)/images/test))
$(eval $(call SetupVariable,SYMBOLS_IMAGE_DIR,$(OUTPUTDIR)/images/symbols,NO_CHECK))
$(eval $(call SetupVariable,JTREG_JAVA,$(BOOT_JDK)/bin/java))

# Provide default values for tools that we need
$(eval $(call SetupVariable,MAKE,make,NO_CHECK))
Expand Down Expand Up @@ -248,6 +249,7 @@ $(call CreateNewSpec, $(NEW_SPEC), \
TOPDIR := $(TOPDIR), \
OUTPUTDIR := $(OUTPUTDIR), \
BOOT_JDK := $(BOOT_JDK), \
JTREG_JAVA := $(FIXPATH) $(JTREG_JAVA), \
JT_HOME := $(JT_HOME), \
JDK_IMAGE_DIR := $(JDK_IMAGE_DIR), \
JCOV_IMAGE_DIR := $(JCOV_IMAGE_DIR), \
Expand Down
38 changes: 37 additions & 1 deletion make/autoconf/lib-tests.m4
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,48 @@ AC_DEFUN_ONCE([LIB_TESTS_SETUP_JTREG],
UTIL_FIXUP_PATH(JT_HOME)
AC_SUBST(JT_HOME)
# Specify a JDK for running jtreg. Defaults to the BOOT_JDK.
AC_ARG_WITH(jtreg-jdk, [AS_HELP_STRING([--with-jdk],
[path to JDK for running jtreg @<:@BOOT_JDK@:>@])])
AC_MSG_CHECKING([for jtreg jdk])
if test "x${with_jtreg_jdk}" != x; then
if test "x${with_jtreg_jdk}" = xno; then
AC_MSG_RESULT([no, jtreg jdk not specified])
elif test "x${with_jtreg_jdk}" = xyes; then
AC_MSG_RESULT([not specified])
AC_MSG_ERROR([--with-jtreg-jdk needs a value])
else
JTREG_JDK="${with_jtreg_jdk}"
AC_MSG_RESULT([$JTREG_JDK])
UTIL_FIXUP_PATH(JTREG_JDK)
if test ! -f "$JTREG_JDK/bin/java"; then
AC_MSG_ERROR([Could not find jtreg java at $JTREG_JDK/bin/java])
fi
fi
else
JTREG_JDK="${BOOT_JDK}"
AC_MSG_RESULT([no, using BOOT_JDK])
fi
JTREG_JAVA="$JTREG_JDK/bin/java"
UTIL_FIXUP_PATH(JTREG_JAVA)
JTREG_JAVA="$FIXPATH $JTREG_JAVA"
AC_SUBST([JTREG_JAVA])
# Verify jtreg version
if test "x$JT_HOME" != x; then
AC_MSG_CHECKING([jtreg jar existence])
if test ! -f "$JT_HOME/lib/jtreg.jar"; then
AC_MSG_ERROR([Could not find jtreg jar at $JT_HOME/lib/jtreg.jar])
fi
AC_MSG_CHECKING([jtreg version number])
# jtreg -version looks like this: "jtreg 6.1+1-19"
# Extract actual version part ("6.1" in this case)
jtreg_version_full=`$JAVA -jar $JT_HOME/lib/jtreg.jar -version | $HEAD -n 1 | $CUT -d ' ' -f 2`
jtreg_version_full=$($JTREG_JAVA -jar $JT_HOME/lib/jtreg.jar -version | $HEAD -n 1 | $CUT -d ' ' -f 2)
jtreg_version=${jtreg_version_full/%+*}
AC_MSG_RESULT([$jtreg_version])
Expand Down
2 changes: 2 additions & 0 deletions make/autoconf/spec.gmk.in
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,8 @@ JAVA_FLAGS_SMALL:=@JAVA_FLAGS_SMALL@
BUILDJDK_JAVA_FLAGS_SMALL:=@BUILDJDK_JAVA_FLAGS_SMALL@
JAVA_TOOL_FLAGS_SMALL:=@JAVA_TOOL_FLAGS_SMALL@

JTREG_JAVA:=@JTREG_JAVA@

# The *_CMD variables are defined separately to be easily overridden in bootcycle-spec.gmk
# for bootcycle-images build. Make sure to keep them in sync. Do not use the *_CMD
# versions of the variables directly.
Expand Down

1 comment on commit a250ae4

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.