Skip to content

Commit 16593cf

Browse files
committed
8292717: Clean up checking of testing requirements in configure
Reviewed-by: erikj
1 parent c59f9b3 commit 16593cf

File tree

4 files changed

+156
-154
lines changed

4 files changed

+156
-154
lines changed

make/autoconf/configure.ac

+8-10
Original file line numberDiff line numberDiff line change
@@ -191,18 +191,15 @@ TOOLCHAIN_POST_DETECTION
191191
TOOLCHAIN_SETUP_BUILD_COMPILERS
192192
TOOLCHAIN_MISC_CHECKS
193193

194-
# Setup the JTReg Regression Test Harness.
195-
TOOLCHAIN_SETUP_JTREG
196-
197-
# Setup the Java Microbenchmark Harness (JMH)
198-
LIB_TESTS_SETUP_JMH
199-
200-
# Setup Jib dependency tool
201-
TOOLCHAIN_SETUP_JIB
202-
203194
# After toolchain setup, we need to process some flags to be able to continue.
204195
FLAGS_POST_TOOLCHAIN
205196

197+
# Setup the tools needed to test the JDK (JTReg Regression Test Harness,
198+
# Java Microbenchmark Harness (JMH) and the Jib dependency tool).
199+
LIB_TESTS_SETUP_JTREG
200+
LIB_TESTS_SETUP_JMH
201+
LIB_TESTS_SETUP_JIB
202+
206203
# Now we can test some aspects on the target using configure macros.
207204
PLATFORM_SETUP_OPENJDK_TARGET_BITS
208205
PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS
@@ -243,7 +240,8 @@ HOTSPOT_SETUP_MISC
243240
#
244241
###############################################################################
245242

246-
JDKOPT_ENABLE_DISABLE_FAILURE_HANDLER
243+
LIB_TESTS_ENABLE_DISABLE_FAILURE_HANDLER
244+
247245
JDKOPT_ENABLE_DISABLE_GENERATE_CLASSLIST
248246
JDKOPT_EXCLUDE_TRANSLATIONS
249247
JDKOPT_ENABLE_DISABLE_MANPAGES

make/autoconf/jdk-options.m4

-23
Original file line numberDiff line numberDiff line change
@@ -486,29 +486,6 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JLINK_OPTIONS],
486486
AC_SUBST(JLINK_KEEP_PACKAGED_MODULES)
487487
])
488488

489-
################################################################################
490-
#
491-
# Check if building of the jtreg failure handler should be enabled.
492-
#
493-
AC_DEFUN_ONCE([JDKOPT_ENABLE_DISABLE_FAILURE_HANDLER],
494-
[
495-
UTIL_ARG_ENABLE(NAME: jtreg-failure-handler, DEFAULT: auto,
496-
RESULT: BUILD_FAILURE_HANDLER,
497-
DESC: [enable building of the jtreg failure handler],
498-
DEFAULT_DESC: [enabled if jtreg is present],
499-
CHECKING_MSG: [if the jtreg failure handler should be built],
500-
CHECK_AVAILABLE: [
501-
AC_MSG_CHECKING([if the jtreg failure handler is available])
502-
if test "x$JT_HOME" != "x"; then
503-
AC_MSG_RESULT([yes])
504-
else
505-
AVAILABLE=false
506-
AC_MSG_RESULT([no (jtreg not present)])
507-
fi
508-
])
509-
AC_SUBST(BUILD_FAILURE_HANDLER)
510-
])
511-
512489
################################################################################
513490
#
514491
# Enable or disable generation of the classlist at build time

make/autoconf/lib-tests.m4

+148-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,10 @@
2323
# questions.
2424
#
2525

26+
################################################################################
27+
# Setup libraries and functionalities needed to test the JDK.
28+
################################################################################
29+
2630
###############################################################################
2731
#
2832
# Setup and check for gtest framework source files
@@ -118,3 +122,146 @@ AC_DEFUN_ONCE([LIB_TESTS_SETUP_JMH],
118122
AC_SUBST(JMH_COMMONS_MATH_JAR)
119123
AC_SUBST(JMH_VERSION)
120124
])
125+
126+
# Setup the JTReg Regression Test Harness.
127+
AC_DEFUN_ONCE([LIB_TESTS_SETUP_JTREG],
128+
[
129+
AC_ARG_WITH(jtreg, [AS_HELP_STRING([--with-jtreg],
130+
[Regression Test Harness @<:@probed@:>@])])
131+
132+
if test "x$with_jtreg" = xno; then
133+
# jtreg disabled
134+
AC_MSG_CHECKING([for jtreg test harness])
135+
AC_MSG_RESULT([no, disabled])
136+
elif test "x$with_jtreg" != xyes && test "x$with_jtreg" != x; then
137+
if test -d "$with_jtreg"; then
138+
# An explicit path is specified, use it.
139+
JT_HOME="$with_jtreg"
140+
else
141+
case "$with_jtreg" in
142+
*.zip )
143+
JTREG_SUPPORT_DIR=$CONFIGURESUPPORT_OUTPUTDIR/jtreg
144+
$RM -rf $JTREG_SUPPORT_DIR
145+
$MKDIR -p $JTREG_SUPPORT_DIR
146+
$UNZIP -qq -d $JTREG_SUPPORT_DIR $with_jtreg
147+
148+
# Try to find jtreg to determine JT_HOME path
149+
JTREG_PATH=`$FIND $JTREG_SUPPORT_DIR | $GREP "/bin/jtreg"`
150+
if test "x$JTREG_PATH" != x; then
151+
JT_HOME=$($DIRNAME $($DIRNAME $JTREG_PATH))
152+
fi
153+
;;
154+
* )
155+
;;
156+
esac
157+
fi
158+
UTIL_FIXUP_PATH([JT_HOME])
159+
if test ! -d "$JT_HOME"; then
160+
AC_MSG_ERROR([jtreg home directory from --with-jtreg=$with_jtreg does not exist])
161+
fi
162+
163+
if test ! -e "$JT_HOME/lib/jtreg.jar"; then
164+
AC_MSG_ERROR([jtreg home directory from --with-jtreg=$with_jtreg is not a valid jtreg home])
165+
fi
166+
167+
AC_MSG_CHECKING([for jtreg test harness])
168+
AC_MSG_RESULT([$JT_HOME])
169+
else
170+
# Try to locate jtreg using the JT_HOME environment variable
171+
if test "x$JT_HOME" != x; then
172+
# JT_HOME set in environment, use it
173+
if test ! -d "$JT_HOME"; then
174+
AC_MSG_WARN([Ignoring JT_HOME pointing to invalid directory: $JT_HOME])
175+
JT_HOME=
176+
else
177+
if test ! -e "$JT_HOME/lib/jtreg.jar"; then
178+
AC_MSG_WARN([Ignoring JT_HOME which is not a valid jtreg home: $JT_HOME])
179+
JT_HOME=
180+
else
181+
AC_MSG_NOTICE([Located jtreg using JT_HOME from environment])
182+
fi
183+
fi
184+
fi
185+
186+
if test "x$JT_HOME" = x; then
187+
# JT_HOME is not set in environment, or was deemed invalid.
188+
# Try to find jtreg on path
189+
UTIL_LOOKUP_PROGS(JTREGEXE, jtreg)
190+
if test "x$JTREGEXE" != x; then
191+
# That's good, now try to derive JT_HOME
192+
JT_HOME=`(cd $($DIRNAME $JTREGEXE)/.. && pwd)`
193+
if test ! -e "$JT_HOME/lib/jtreg.jar"; then
194+
AC_MSG_WARN([Ignoring jtreg from path since a valid jtreg home cannot be found])
195+
JT_HOME=
196+
else
197+
AC_MSG_NOTICE([Located jtreg using jtreg executable in path])
198+
fi
199+
fi
200+
fi
201+
202+
AC_MSG_CHECKING([for jtreg test harness])
203+
if test "x$JT_HOME" != x; then
204+
AC_MSG_RESULT([$JT_HOME])
205+
else
206+
AC_MSG_RESULT([no, not found])
207+
208+
if test "x$with_jtreg" = xyes; then
209+
AC_MSG_ERROR([--with-jtreg was specified, but no jtreg found.])
210+
fi
211+
fi
212+
fi
213+
214+
UTIL_FIXUP_PATH(JT_HOME)
215+
AC_SUBST(JT_HOME)
216+
])
217+
218+
# Setup the JIB dependency resolver
219+
AC_DEFUN_ONCE([LIB_TESTS_SETUP_JIB],
220+
[
221+
AC_ARG_WITH(jib, [AS_HELP_STRING([--with-jib],
222+
[Jib dependency management tool @<:@not used@:>@])])
223+
224+
if test "x$with_jib" = xno || test "x$with_jib" = x; then
225+
# jib disabled
226+
AC_MSG_CHECKING([for jib])
227+
AC_MSG_RESULT(no)
228+
elif test "x$with_jib" = xyes; then
229+
AC_MSG_ERROR([Must supply a value to --with-jib])
230+
else
231+
JIB_HOME="${with_jib}"
232+
AC_MSG_CHECKING([for jib])
233+
AC_MSG_RESULT(${JIB_HOME})
234+
if test ! -d "${JIB_HOME}"; then
235+
AC_MSG_ERROR([--with-jib must be a directory])
236+
fi
237+
JIB_JAR=$(ls ${JIB_HOME}/lib/jib-*.jar)
238+
if test ! -f "${JIB_JAR}"; then
239+
AC_MSG_ERROR([Could not find jib jar file in ${JIB_HOME}])
240+
fi
241+
fi
242+
243+
AC_SUBST(JIB_HOME)
244+
])
245+
246+
################################################################################
247+
#
248+
# Check if building of the jtreg failure handler should be enabled.
249+
#
250+
AC_DEFUN_ONCE([LIB_TESTS_ENABLE_DISABLE_FAILURE_HANDLER],
251+
[
252+
UTIL_ARG_ENABLE(NAME: jtreg-failure-handler, DEFAULT: auto,
253+
RESULT: BUILD_FAILURE_HANDLER,
254+
DESC: [enable building of the jtreg failure handler],
255+
DEFAULT_DESC: [enabled if jtreg is present],
256+
CHECKING_MSG: [if the jtreg failure handler should be built],
257+
CHECK_AVAILABLE: [
258+
AC_MSG_CHECKING([if the jtreg failure handler is available])
259+
if test "x$JT_HOME" != "x"; then
260+
AC_MSG_RESULT([yes])
261+
else
262+
AVAILABLE=false
263+
AC_MSG_RESULT([no (jtreg not present)])
264+
fi
265+
])
266+
AC_SUBST(BUILD_FAILURE_HANDLER)
267+
])

make/autoconf/toolchain.m4

-120
Original file line numberDiff line numberDiff line change
@@ -972,123 +972,3 @@ AC_DEFUN_ONCE([TOOLCHAIN_MISC_CHECKS],
972972
fi
973973
AC_SUBST(HOTSPOT_TOOLCHAIN_TYPE)
974974
])
975-
976-
# Setup the JTReg Regression Test Harness.
977-
AC_DEFUN_ONCE([TOOLCHAIN_SETUP_JTREG],
978-
[
979-
AC_ARG_WITH(jtreg, [AS_HELP_STRING([--with-jtreg],
980-
[Regression Test Harness @<:@probed@:>@])])
981-
982-
if test "x$with_jtreg" = xno; then
983-
# jtreg disabled
984-
AC_MSG_CHECKING([for jtreg test harness])
985-
AC_MSG_RESULT([no, disabled])
986-
elif test "x$with_jtreg" != xyes && test "x$with_jtreg" != x; then
987-
if test -d "$with_jtreg"; then
988-
# An explicit path is specified, use it.
989-
JT_HOME="$with_jtreg"
990-
else
991-
case "$with_jtreg" in
992-
*.zip )
993-
JTREG_SUPPORT_DIR=$CONFIGURESUPPORT_OUTPUTDIR/jtreg
994-
$RM -rf $JTREG_SUPPORT_DIR
995-
$MKDIR -p $JTREG_SUPPORT_DIR
996-
$UNZIP -qq -d $JTREG_SUPPORT_DIR $with_jtreg
997-
998-
# Try to find jtreg to determine JT_HOME path
999-
JTREG_PATH=`$FIND $JTREG_SUPPORT_DIR | $GREP "/bin/jtreg"`
1000-
if test "x$JTREG_PATH" != x; then
1001-
JT_HOME=$($DIRNAME $($DIRNAME $JTREG_PATH))
1002-
fi
1003-
;;
1004-
* )
1005-
;;
1006-
esac
1007-
fi
1008-
UTIL_FIXUP_PATH([JT_HOME])
1009-
if test ! -d "$JT_HOME"; then
1010-
AC_MSG_ERROR([jtreg home directory from --with-jtreg=$with_jtreg does not exist])
1011-
fi
1012-
1013-
if test ! -e "$JT_HOME/lib/jtreg.jar"; then
1014-
AC_MSG_ERROR([jtreg home directory from --with-jtreg=$with_jtreg is not a valid jtreg home])
1015-
fi
1016-
1017-
AC_MSG_CHECKING([for jtreg test harness])
1018-
AC_MSG_RESULT([$JT_HOME])
1019-
else
1020-
# Try to locate jtreg using the JT_HOME environment variable
1021-
if test "x$JT_HOME" != x; then
1022-
# JT_HOME set in environment, use it
1023-
if test ! -d "$JT_HOME"; then
1024-
AC_MSG_WARN([Ignoring JT_HOME pointing to invalid directory: $JT_HOME])
1025-
JT_HOME=
1026-
else
1027-
if test ! -e "$JT_HOME/lib/jtreg.jar"; then
1028-
AC_MSG_WARN([Ignoring JT_HOME which is not a valid jtreg home: $JT_HOME])
1029-
JT_HOME=
1030-
else
1031-
AC_MSG_NOTICE([Located jtreg using JT_HOME from environment])
1032-
fi
1033-
fi
1034-
fi
1035-
1036-
if test "x$JT_HOME" = x; then
1037-
# JT_HOME is not set in environment, or was deemed invalid.
1038-
# Try to find jtreg on path
1039-
UTIL_LOOKUP_PROGS(JTREGEXE, jtreg)
1040-
if test "x$JTREGEXE" != x; then
1041-
# That's good, now try to derive JT_HOME
1042-
JT_HOME=`(cd $($DIRNAME $JTREGEXE)/.. && pwd)`
1043-
if test ! -e "$JT_HOME/lib/jtreg.jar"; then
1044-
AC_MSG_WARN([Ignoring jtreg from path since a valid jtreg home cannot be found])
1045-
JT_HOME=
1046-
else
1047-
AC_MSG_NOTICE([Located jtreg using jtreg executable in path])
1048-
fi
1049-
fi
1050-
fi
1051-
1052-
AC_MSG_CHECKING([for jtreg test harness])
1053-
if test "x$JT_HOME" != x; then
1054-
AC_MSG_RESULT([$JT_HOME])
1055-
else
1056-
AC_MSG_RESULT([no, not found])
1057-
1058-
if test "x$with_jtreg" = xyes; then
1059-
AC_MSG_ERROR([--with-jtreg was specified, but no jtreg found.])
1060-
fi
1061-
fi
1062-
fi
1063-
1064-
UTIL_FIXUP_PATH(JT_HOME)
1065-
AC_SUBST(JT_HOME)
1066-
])
1067-
1068-
# Setup the JIB dependency resolver
1069-
AC_DEFUN_ONCE([TOOLCHAIN_SETUP_JIB],
1070-
[
1071-
AC_ARG_WITH(jib, [AS_HELP_STRING([--with-jib],
1072-
[Jib dependency management tool @<:@not used@:>@])])
1073-
1074-
if test "x$with_jib" = xno || test "x$with_jib" = x; then
1075-
# jib disabled
1076-
AC_MSG_CHECKING([for jib])
1077-
AC_MSG_RESULT(no)
1078-
elif test "x$with_jib" = xyes; then
1079-
AC_MSG_ERROR([Must supply a value to --with-jib])
1080-
else
1081-
JIB_HOME="${with_jib}"
1082-
AC_MSG_CHECKING([for jib])
1083-
AC_MSG_RESULT(${JIB_HOME})
1084-
if test ! -d "${JIB_HOME}"; then
1085-
AC_MSG_ERROR([--with-jib must be a directory])
1086-
fi
1087-
JIB_JAR=$(ls ${JIB_HOME}/lib/jib-*.jar)
1088-
if test ! -f "${JIB_JAR}"; then
1089-
AC_MSG_ERROR([Could not find jib jar file in ${JIB_HOME}])
1090-
fi
1091-
fi
1092-
1093-
AC_SUBST(JIB_HOME)
1094-
])

0 commit comments

Comments
 (0)