|
1 | 1 | #
|
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. |
3 | 3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | #
|
5 | 5 | # This code is free software; you can redistribute it and/or modify it
|
|
23 | 23 | # questions.
|
24 | 24 | #
|
25 | 25 |
|
| 26 | +################################################################################ |
| 27 | +# Setup libraries and functionalities needed to test the JDK. |
| 28 | +################################################################################ |
| 29 | + |
26 | 30 | ###############################################################################
|
27 | 31 | #
|
28 | 32 | # Setup and check for gtest framework source files
|
@@ -118,3 +122,146 @@ AC_DEFUN_ONCE([LIB_TESTS_SETUP_JMH],
|
118 | 122 | AC_SUBST(JMH_COMMONS_MATH_JAR)
|
119 | 123 | AC_SUBST(JMH_VERSION)
|
120 | 124 | ])
|
| 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 | +]) |
0 commit comments