8292717: Clean up checking of testing requirements in configure

Reviewed-by: clanger
Backport-of: 16593cf51c3d994ba4a6d28ab97e519dfd53f37b
This commit is contained in:
Aleksey Shipilev 2023-08-30 08:52:38 +00:00
parent a64639f4f9
commit 0bc4e7ec7c
4 changed files with 176 additions and 174 deletions

View File

@ -191,18 +191,15 @@ TOOLCHAIN_POST_DETECTION
TOOLCHAIN_SETUP_BUILD_COMPILERS
TOOLCHAIN_MISC_CHECKS
# Setup the JTReg Regression Test Harness.
TOOLCHAIN_SETUP_JTREG
# Setup the Java Microbenchmark Harness (JMH)
LIB_TESTS_SETUP_JMH
# Setup Jib dependency tool
TOOLCHAIN_SETUP_JIB
# After toolchain setup, we need to process some flags to be able to continue.
FLAGS_POST_TOOLCHAIN
# Setup the tools needed to test the JDK (JTReg Regression Test Harness,
# Java Microbenchmark Harness (JMH) and the Jib dependency tool).
LIB_TESTS_SETUP_JTREG
LIB_TESTS_SETUP_JMH
LIB_TESTS_SETUP_JIB
# Now we can test some aspects on the target using configure macros.
PLATFORM_SETUP_OPENJDK_TARGET_BITS
PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS
@ -244,7 +241,8 @@ HOTSPOT_SETUP_MISC
#
###############################################################################
JDKOPT_ENABLE_DISABLE_FAILURE_HANDLER
LIB_TESTS_ENABLE_DISABLE_FAILURE_HANDLER
JDKOPT_ENABLE_DISABLE_GENERATE_CLASSLIST
JDKOPT_EXCLUDE_TRANSLATIONS
JDKOPT_ENABLE_DISABLE_MANPAGES

View File

@ -500,29 +500,6 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JLINK_OPTIONS],
AC_SUBST(JLINK_KEEP_PACKAGED_MODULES)
])
################################################################################
#
# Check if building of the jtreg failure handler should be enabled.
#
AC_DEFUN_ONCE([JDKOPT_ENABLE_DISABLE_FAILURE_HANDLER],
[
UTIL_ARG_ENABLE(NAME: jtreg-failure-handler, DEFAULT: auto,
RESULT: BUILD_FAILURE_HANDLER,
DESC: [enable building of the jtreg failure handler],
DEFAULT_DESC: [enabled if jtreg is present],
CHECKING_MSG: [if the jtreg failure handler should be built],
CHECK_AVAILABLE: [
AC_MSG_CHECKING([if the jtreg failure handler is available])
if test "x$JT_HOME" != "x"; then
AC_MSG_RESULT([yes])
else
AVAILABLE=false
AC_MSG_RESULT([no (jtreg not present)])
fi
])
AC_SUBST(BUILD_FAILURE_HANDLER)
])
################################################################################
#
# Enable or disable generation of the classlist at build time

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -23,6 +23,13 @@
# questions.
#
################################################################################
# Setup libraries and functionalities needed to test the JDK.
################################################################################
# Minimum supported version
JTREG_MINIMUM_VERSION=6.1
###############################################################################
#
# Setup and check for gtest framework source files
@ -118,3 +125,163 @@ AC_DEFUN_ONCE([LIB_TESTS_SETUP_JMH],
AC_SUBST(JMH_COMMONS_MATH_JAR)
AC_SUBST(JMH_VERSION)
])
# Setup the JTReg Regression Test Harness.
AC_DEFUN_ONCE([LIB_TESTS_SETUP_JTREG],
[
AC_ARG_WITH(jtreg, [AS_HELP_STRING([--with-jtreg],
[Regression Test Harness @<:@probed@:>@])])
if test "x$with_jtreg" = xno; then
# jtreg disabled
AC_MSG_CHECKING([for jtreg test harness])
AC_MSG_RESULT([no, disabled])
elif test "x$with_jtreg" != xyes && test "x$with_jtreg" != x; then
if test -d "$with_jtreg"; then
# An explicit path is specified, use it.
JT_HOME="$with_jtreg"
else
case "$with_jtreg" in
*.zip )
JTREG_SUPPORT_DIR=$CONFIGURESUPPORT_OUTPUTDIR/jtreg
$RM -rf $JTREG_SUPPORT_DIR
$MKDIR -p $JTREG_SUPPORT_DIR
$UNZIP -qq -d $JTREG_SUPPORT_DIR $with_jtreg
# Try to find jtreg to determine JT_HOME path
JTREG_PATH=`$FIND $JTREG_SUPPORT_DIR | $GREP "/bin/jtreg"`
if test "x$JTREG_PATH" != x; then
JT_HOME=$($DIRNAME $($DIRNAME $JTREG_PATH))
fi
;;
* )
;;
esac
fi
UTIL_FIXUP_PATH([JT_HOME])
if test ! -d "$JT_HOME"; then
AC_MSG_ERROR([jtreg home directory from --with-jtreg=$with_jtreg does not exist])
fi
if test ! -e "$JT_HOME/lib/jtreg.jar"; then
AC_MSG_ERROR([jtreg home directory from --with-jtreg=$with_jtreg is not a valid jtreg home])
fi
AC_MSG_CHECKING([for jtreg test harness])
AC_MSG_RESULT([$JT_HOME])
else
# Try to locate jtreg using the JT_HOME environment variable
if test "x$JT_HOME" != x; then
# JT_HOME set in environment, use it
if test ! -d "$JT_HOME"; then
AC_MSG_WARN([Ignoring JT_HOME pointing to invalid directory: $JT_HOME])
JT_HOME=
else
if test ! -e "$JT_HOME/lib/jtreg.jar"; then
AC_MSG_WARN([Ignoring JT_HOME which is not a valid jtreg home: $JT_HOME])
JT_HOME=
else
AC_MSG_NOTICE([Located jtreg using JT_HOME from environment])
fi
fi
fi
if test "x$JT_HOME" = x; then
# JT_HOME is not set in environment, or was deemed invalid.
# Try to find jtreg on path
UTIL_LOOKUP_PROGS(JTREGEXE, jtreg)
if test "x$JTREGEXE" != x; then
# That's good, now try to derive JT_HOME
JT_HOME=`(cd $($DIRNAME $JTREGEXE)/.. && pwd)`
if test ! -e "$JT_HOME/lib/jtreg.jar"; then
AC_MSG_WARN([Ignoring jtreg from path since a valid jtreg home cannot be found])
JT_HOME=
else
AC_MSG_NOTICE([Located jtreg using jtreg executable in path])
fi
fi
fi
AC_MSG_CHECKING([for jtreg test harness])
if test "x$JT_HOME" != x; then
AC_MSG_RESULT([$JT_HOME])
else
AC_MSG_RESULT([no, not found])
if test "x$with_jtreg" = xyes; then
AC_MSG_ERROR([--with-jtreg was specified, but no jtreg found.])
fi
fi
fi
UTIL_FIXUP_PATH(JT_HOME)
AC_SUBST(JT_HOME)
# Verify jtreg version
if test "x$JT_HOME" != x; then
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=${jtreg_version_full/%+*}
AC_MSG_RESULT([$jtreg_version])
# This is a simplified version of TOOLCHAIN_CHECK_COMPILER_VERSION
comparable_actual_version=`$AWK -F. '{ printf("%05d%05d%05d%05d\n", [$]1, [$]2, [$]3, [$]4) }' <<< "$jtreg_version"`
comparable_minimum_version=`$AWK -F. '{ printf("%05d%05d%05d%05d\n", [$]1, [$]2, [$]3, [$]4) }' <<< "$JTREG_MINIMUM_VERSION"`
if test $comparable_actual_version -lt $comparable_minimum_version ; then
AC_MSG_ERROR([jtreg version is too old, at least version $JTREG_MINIMUM_VERSION is required])
fi
fi
])
# Setup the JIB dependency resolver
AC_DEFUN_ONCE([LIB_TESTS_SETUP_JIB],
[
AC_ARG_WITH(jib, [AS_HELP_STRING([--with-jib],
[Jib dependency management tool @<:@not used@:>@])])
if test "x$with_jib" = xno || test "x$with_jib" = x; then
# jib disabled
AC_MSG_CHECKING([for jib])
AC_MSG_RESULT(no)
elif test "x$with_jib" = xyes; then
AC_MSG_ERROR([Must supply a value to --with-jib])
else
JIB_HOME="${with_jib}"
AC_MSG_CHECKING([for jib])
AC_MSG_RESULT(${JIB_HOME})
if test ! -d "${JIB_HOME}"; then
AC_MSG_ERROR([--with-jib must be a directory])
fi
JIB_JAR=$(ls ${JIB_HOME}/lib/jib-*.jar)
if test ! -f "${JIB_JAR}"; then
AC_MSG_ERROR([Could not find jib jar file in ${JIB_HOME}])
fi
fi
AC_SUBST(JIB_HOME)
])
################################################################################
#
# Check if building of the jtreg failure handler should be enabled.
#
AC_DEFUN_ONCE([LIB_TESTS_ENABLE_DISABLE_FAILURE_HANDLER],
[
UTIL_ARG_ENABLE(NAME: jtreg-failure-handler, DEFAULT: auto,
RESULT: BUILD_FAILURE_HANDLER,
DESC: [enable building of the jtreg failure handler],
DEFAULT_DESC: [enabled if jtreg is present],
CHECKING_MSG: [if the jtreg failure handler should be built],
CHECK_AVAILABLE: [
AC_MSG_CHECKING([if the jtreg failure handler is available])
if test "x$JT_HOME" != "x"; then
AC_MSG_RESULT([yes])
else
AVAILABLE=false
AC_MSG_RESULT([no (jtreg not present)])
fi
])
AC_SUBST(BUILD_FAILURE_HANDLER)
])

View File

@ -58,9 +58,6 @@ TOOLCHAIN_MINIMUM_VERSION_xlc=""
# Minimum supported linker versions, empty means unspecified
TOOLCHAIN_MINIMUM_LD_VERSION_gcc="2.18"
# Minimum supported version
JTREG_MINIMUM_VERSION=6.1
# Prepare the system so that TOOLCHAIN_CHECK_COMPILER_VERSION can be called.
# Must have CC_VERSION_NUMBER and CXX_VERSION_NUMBER.
# $1 - optional variable prefix for compiler and version variables (BUILD_)
@ -994,140 +991,3 @@ AC_DEFUN_ONCE([TOOLCHAIN_MISC_CHECKS],
fi
AC_SUBST(HOTSPOT_TOOLCHAIN_TYPE)
])
# Setup the JTReg Regression Test Harness.
AC_DEFUN_ONCE([TOOLCHAIN_SETUP_JTREG],
[
AC_ARG_WITH(jtreg, [AS_HELP_STRING([--with-jtreg],
[Regression Test Harness @<:@probed@:>@])])
if test "x$with_jtreg" = xno; then
# jtreg disabled
AC_MSG_CHECKING([for jtreg test harness])
AC_MSG_RESULT([no, disabled])
elif test "x$with_jtreg" != xyes && test "x$with_jtreg" != x; then
if test -d "$with_jtreg"; then
# An explicit path is specified, use it.
JT_HOME="$with_jtreg"
else
case "$with_jtreg" in
*.zip )
JTREG_SUPPORT_DIR=$CONFIGURESUPPORT_OUTPUTDIR/jtreg
$RM -rf $JTREG_SUPPORT_DIR
$MKDIR -p $JTREG_SUPPORT_DIR
$UNZIP -qq -d $JTREG_SUPPORT_DIR $with_jtreg
# Try to find jtreg to determine JT_HOME path
JTREG_PATH=`$FIND $JTREG_SUPPORT_DIR | $GREP "/bin/jtreg"`
if test "x$JTREG_PATH" != x; then
JT_HOME=$($DIRNAME $($DIRNAME $JTREG_PATH))
fi
;;
* )
;;
esac
fi
UTIL_FIXUP_PATH([JT_HOME])
if test ! -d "$JT_HOME"; then
AC_MSG_ERROR([jtreg home directory from --with-jtreg=$with_jtreg does not exist])
fi
if test ! -e "$JT_HOME/lib/jtreg.jar"; then
AC_MSG_ERROR([jtreg home directory from --with-jtreg=$with_jtreg is not a valid jtreg home])
fi
AC_MSG_CHECKING([for jtreg test harness])
AC_MSG_RESULT([$JT_HOME])
else
# Try to locate jtreg using the JT_HOME environment variable
if test "x$JT_HOME" != x; then
# JT_HOME set in environment, use it
if test ! -d "$JT_HOME"; then
AC_MSG_WARN([Ignoring JT_HOME pointing to invalid directory: $JT_HOME])
JT_HOME=
else
if test ! -e "$JT_HOME/lib/jtreg.jar"; then
AC_MSG_WARN([Ignoring JT_HOME which is not a valid jtreg home: $JT_HOME])
JT_HOME=
else
AC_MSG_NOTICE([Located jtreg using JT_HOME from environment])
fi
fi
fi
if test "x$JT_HOME" = x; then
# JT_HOME is not set in environment, or was deemed invalid.
# Try to find jtreg on path
UTIL_LOOKUP_PROGS(JTREGEXE, jtreg)
if test "x$JTREGEXE" != x; then
# That's good, now try to derive JT_HOME
JT_HOME=`(cd $($DIRNAME $JTREGEXE)/.. && pwd)`
if test ! -e "$JT_HOME/lib/jtreg.jar"; then
AC_MSG_WARN([Ignoring jtreg from path since a valid jtreg home cannot be found])
JT_HOME=
else
AC_MSG_NOTICE([Located jtreg using jtreg executable in path])
fi
fi
fi
AC_MSG_CHECKING([for jtreg test harness])
if test "x$JT_HOME" != x; then
AC_MSG_RESULT([$JT_HOME])
else
AC_MSG_RESULT([no, not found])
if test "x$with_jtreg" = xyes; then
AC_MSG_ERROR([--with-jtreg was specified, but no jtreg found.])
fi
fi
fi
UTIL_FIXUP_PATH(JT_HOME)
AC_SUBST(JT_HOME)
# Verify jtreg version
if test "x$JT_HOME" != x; then
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=${jtreg_version_full/%+*}
AC_MSG_RESULT([$jtreg_version])
# This is a simplified version of TOOLCHAIN_CHECK_COMPILER_VERSION
comparable_actual_version=`$AWK -F. '{ printf("%05d%05d%05d%05d\n", [$]1, [$]2, [$]3, [$]4) }' <<< "$jtreg_version"`
comparable_minimum_version=`$AWK -F. '{ printf("%05d%05d%05d%05d\n", [$]1, [$]2, [$]3, [$]4) }' <<< "$JTREG_MINIMUM_VERSION"`
if test $comparable_actual_version -lt $comparable_minimum_version ; then
AC_MSG_ERROR([jtreg version is too old, at least version $JTREG_MINIMUM_VERSION is required])
fi
fi
])
# Setup the JIB dependency resolver
AC_DEFUN_ONCE([TOOLCHAIN_SETUP_JIB],
[
AC_ARG_WITH(jib, [AS_HELP_STRING([--with-jib],
[Jib dependency management tool @<:@not used@:>@])])
if test "x$with_jib" = xno || test "x$with_jib" = x; then
# jib disabled
AC_MSG_CHECKING([for jib])
AC_MSG_RESULT(no)
elif test "x$with_jib" = xyes; then
AC_MSG_ERROR([Must supply a value to --with-jib])
else
JIB_HOME="${with_jib}"
AC_MSG_CHECKING([for jib])
AC_MSG_RESULT(${JIB_HOME})
if test ! -d "${JIB_HOME}"; then
AC_MSG_ERROR([--with-jib must be a directory])
fi
JIB_JAR=$(ls ${JIB_HOME}/lib/jib-*.jar)
if test ! -f "${JIB_JAR}"; then
AC_MSG_ERROR([Could not find jib jar file in ${JIB_HOME}])
fi
fi
AC_SUBST(JIB_HOME)
])