1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383
|
#
# Copyright (c) 2018, 2024, 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
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
################################################################################
# Setup libraries and functionalities needed to test the JDK.
################################################################################
# Minimum supported versions
JTREG_MINIMUM_VERSION=7.4
GTEST_MINIMUM_VERSION=1.14.0
################################################################################
#
# Setup and check for gtest framework source files
#
AC_DEFUN_ONCE([LIB_TESTS_SETUP_GTEST],
[
AC_ARG_WITH(gtest, [AS_HELP_STRING([--with-gtest],
[specify prefix directory for the gtest framework])])
if test "x${with_gtest}" != x; then
AC_MSG_CHECKING([for gtest])
if test "x${with_gtest}" = xno; then
AC_MSG_RESULT([no, disabled])
elif test "x${with_gtest}" = xyes; then
AC_MSG_RESULT([no, error])
AC_MSG_ERROR([--with-gtest must have a value])
else
if ! test -s "${with_gtest}/googletest/include/gtest/gtest.h"; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([Can't find 'googletest/include/gtest/gtest.h' under ${with_gtest} given with the --with-gtest option.])
elif ! test -s "${with_gtest}/googlemock/include/gmock/gmock.h"; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([Can't find 'googlemock/include/gmock/gmock.h' under ${with_gtest} given with the --with-gtest option.])
else
GTEST_FRAMEWORK_SRC=$with_gtest
AC_MSG_RESULT([$GTEST_FRAMEWORK_SRC])
UTIL_FIXUP_PATH([GTEST_FRAMEWORK_SRC])
# Verify that the version is the required one.
# This is a simplified version of TOOLCHAIN_CHECK_COMPILER_VERSION
gtest_version="`$GREP GOOGLETEST_VERSION $GTEST_FRAMEWORK_SRC/CMakeLists.txt | $SED -e 's/set(GOOGLETEST_VERSION \(.*\))/\1/'`"
comparable_actual_version=`$AWK -F. '{ printf("%05d%05d%05d%05d\n", [$]1, [$]2, [$]3, [$]4) }' <<< "$gtest_version"`
comparable_minimum_version=`$AWK -F. '{ printf("%05d%05d%05d%05d\n", [$]1, [$]2, [$]3, [$]4) }' <<< "$GTEST_MINIMUM_VERSION"`
if test $comparable_actual_version -lt $comparable_minimum_version ; then
AC_MSG_ERROR([gtest version is too old, at least version $GTEST_MINIMUM_VERSION is required])
fi
fi
fi
fi
AC_SUBST(GTEST_FRAMEWORK_SRC)
])
################################################################################
#
# Setup and check the Java Microbenchmark Harness
#
AC_DEFUN_ONCE([LIB_TESTS_SETUP_JMH],
[
AC_ARG_WITH(jmh, [AS_HELP_STRING([--with-jmh],
[Java Microbenchmark Harness for building the OpenJDK Microbenchmark Suite])])
AC_MSG_CHECKING([for jmh (Java Microbenchmark Harness)])
if test "x$with_jmh" = xno || test "x$with_jmh" = x; then
AC_MSG_RESULT([no, disabled])
elif test "x$with_jmh" = xyes; then
AC_MSG_RESULT([no, error])
AC_MSG_ERROR([--with-jmh requires a directory containing all jars needed by JMH])
else
# Path specified
JMH_HOME="$with_jmh"
if test ! -d [$JMH_HOME]; then
AC_MSG_RESULT([no, error])
AC_MSG_ERROR([$JMH_HOME does not exist or is not a directory])
fi
AC_MSG_RESULT([yes, $JMH_HOME])
UTIL_FIXUP_PATH([JMH_HOME])
jar_names="jmh-core jmh-generator-annprocess jopt-simple commons-math3"
for jar in $jar_names; do
found_jar_files=$($ECHO $(ls $JMH_HOME/$jar-*.jar 2> /dev/null))
if test "x$found_jar_files" = x; then
AC_MSG_ERROR([--with-jmh does not contain $jar-*.jar])
elif ! test -e "$found_jar_files"; then
AC_MSG_ERROR([--with-jmh contain multiple $jar-*.jar: $found_jar_files])
fi
found_jar_var_name=found_${jar//-/_}
eval $found_jar_var_name='"'$found_jar_files'"'
done
JMH_CORE_JAR=$found_jmh_core
JMH_GENERATOR_JAR=$found_jmh_generator_annprocess
JMH_JOPT_SIMPLE_JAR=$found_jopt_simple
JMH_COMMONS_MATH_JAR=$found_commons_math3
if [ [[ "$JMH_CORE_JAR" =~ jmh-core-(.*)\.jar$ ]] ] ; then
JMH_VERSION=${BASH_REMATCH[[1]]}
else
JMH_VERSION=unknown
fi
AC_MSG_NOTICE([JMH core version: $JMH_VERSION])
fi
AC_SUBST(JMH_CORE_JAR)
AC_SUBST(JMH_GENERATOR_JAR)
AC_SUBST(JMH_JOPT_SIMPLE_JAR)
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)
# 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
UTIL_FIXUP_PATH(JTREG_JDK)
AC_SUBST([JTREG_JDK])
# For use in the configure script
JTREG_JAVA="$FIXPATH $JTREG_JDK/bin/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=$($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])
# 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)
])
# Setup the tidy html checker
AC_DEFUN_ONCE([LIB_TESTS_SETUP_TIDY],
[
UTIL_LOOKUP_PROGS(TIDY, tidy)
if test "x$TIDY" != x; then
AC_MSG_CHECKING([if tidy is working properly])
tidy_output=`$TIDY --version 2>&1`
if ! $ECHO "$tidy_output" | $GREP -q "HTML Tidy" 2>&1 > /dev/null; then
AC_MSG_RESULT([no])
AC_MSG_NOTICE([$TIDY is not a valid tidy executable and will be ignored. Output from --version: $tidy_output])
TIDY=
elif ! $ECHO "$tidy_output" | $GREP -q "version" 2>&1 > /dev/null; then
AC_MSG_RESULT([no])
AC_MSG_NOTICE([$TIDY is missing a proper version number and will be ignored. Output from --version: $tidy_output])
TIDY=
else
AC_MSG_RESULT([yes])
AC_MSG_CHECKING([for tidy version])
tidy_version=`$ECHO $tidy_output | $SED -e 's/.*version //g'`
AC_MSG_RESULT([$tidy_version])
fi
fi
AC_SUBST(TIDY)
])
################################################################################
#
# Check if building of the jtreg failure handler should be enabled.
#
AC_DEFUN_ONCE([LIB_TESTS_ENABLE_DISABLE_FAILURE_HANDLER],
[
if test "x$BUILD_ENV" = "xci"; then
BUILD_FAILURE_HANDLER_DEFAULT=auto
else
BUILD_FAILURE_HANDLER_DEFAULT=false
fi
UTIL_ARG_ENABLE(NAME: jtreg-failure-handler, DEFAULT: $BUILD_FAILURE_HANDLER_DEFAULT,
RESULT: BUILD_FAILURE_HANDLER,
DESC: [enable building of the jtreg failure handler],
DEFAULT_DESC: [enabled if jtreg is present and build env is CI],
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)
])
AC_DEFUN_ONCE([LIB_TESTS_ENABLE_DISABLE_JTREG_TEST_THREAD_FACTORY],
[
UTIL_ARG_ENABLE(NAME: jtreg-test-thread-factory, DEFAULT: auto,
RESULT: BUILD_JTREG_TEST_THREAD_FACTORY,
DESC: [enable building of the jtreg test thread factory],
DEFAULT_DESC: [enabled if jtreg is present],
CHECKING_MSG: [if the jtreg test thread factory should be built],
CHECK_AVAILABLE: [
AC_MSG_CHECKING([if the jtreg test thread factory 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_JTREG_TEST_THREAD_FACTORY)
])
|