8015510: (s) Improve JTReg location detection and provide location to test/Makefile
authormduigou
Tue, 04 Jun 2013 10:36:00 +0200
changeset 17664 2cb42641740b
parent 17663 d2ae6f7a7e7b
child 17665 b5d71396c863
8015510: (s) Improve JTReg location detection and provide location to test/Makefile Reviewed-by: erikj
common/autoconf/generated-configure.sh
common/autoconf/toolchain.m4
common/makefiles/Main.gmk
--- a/common/autoconf/generated-configure.sh	Tue Jun 04 10:23:37 2013 +0200
+++ b/common/autoconf/generated-configure.sh	Tue Jun 04 10:36:00 2013 +0200
@@ -681,8 +681,8 @@
 SHARED_LIBRARY
 OBJ_SUFFIX
 COMPILER_NAME
+JT_HOME
 JTREGEXE
-JT_HOME
 LIPO
 ac_ct_OBJDUMP
 OBJDUMP
@@ -3782,7 +3782,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1370333982
+DATE_WHEN_GENERATED=1370334570
 
 ###############################################################################
 #
@@ -16177,14 +16177,28 @@
 # Check whether --with-jtreg was given.
 if test "${with_jtreg+set}" = set; then :
   withval=$with_jtreg;
-fi
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JTReg Regression Test Harness" >&5
-$as_echo_n "checking for JTReg Regression Test Harness... " >&6; }
-
-  if test "x$with_jtreg" != x; then
-    JT_HOME="$with_jtreg"
+else
+  with_jtreg=no
+fi
+
+
+  if test "x$with_jtreg" = xno; then
+    # jtreg disabled
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jtreg" >&5
+$as_echo_n "checking for jtreg... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  else
+    if test "x$with_jtreg" != xyes; then
+      # with path specified.
+      JT_HOME="$with_jtreg"
+    fi
+
+    if test "x$JT_HOME" != x; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jtreg" >&5
+$as_echo_n "checking for jtreg... " >&6; }
+
+      # use JT_HOME enviroment var.
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -16307,17 +16321,79 @@
     JT_HOME="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JT_HOME" >&5
-$as_echo "$JT_HOME" >&6; }
-
-    # jtreg win32 script works for everybody
-    JTREGEXE="$JT_HOME/win32/bin/jtreg"
-    if test ! -f "$JTREGEXE"; then
-      as_fn_error $? "JTReg executable does not exist: $JTREGEXE" "$LINENO" 5
-    fi
-  else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+
+      # jtreg win32 script works for everybody
+      JTREGEXE="$JT_HOME/win32/bin/jtreg"
+
+      if test ! -f "$JTREGEXE"; then
+        as_fn_error $? "JTReg executable does not exist: $JTREGEXE" "$LINENO" 5
+      fi
+
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JTREGEXE" >&5
+$as_echo "$JTREGEXE" >&6; }
+    else
+      # try to find jtreg on path
+
+    for ac_prog in jtreg
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_JTREGEXE+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $JTREGEXE in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_JTREGEXE="$JTREGEXE" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_JTREGEXE="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+JTREGEXE=$ac_cv_path_JTREGEXE
+if test -n "$JTREGEXE"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JTREGEXE" >&5
+$as_echo "$JTREGEXE" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$JTREGEXE" && break
+done
+
+
+    if test "x$JTREGEXE" = x; then
+        if test "xjtreg" = x; then
+          PROG_NAME=jtregexe
+        else
+          PROG_NAME=jtreg
+        fi
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $PROG_NAME!" >&5
+$as_echo "$as_me: Could not find $PROG_NAME!" >&6;}
+        as_fn_error $? "Cannot continue" "$LINENO" 5
+    fi
+
+
+      JT_HOME="`$DIRNAME $JTREGEXE`"
+    fi
   fi
 
 
--- a/common/autoconf/toolchain.m4	Tue Jun 04 10:23:37 2013 +0200
+++ b/common/autoconf/toolchain.m4	Tue Jun 04 10:36:00 2013 +0200
@@ -36,7 +36,7 @@
     $ECHO $COMPILER_VERSION_TEST | $GREP "^.*: Sun $COMPILER_NAME" > /dev/null
     if test $? -ne 0; then
       GCC_VERSION_TEST=`$COMPILER --version 2>&1 | $HEAD -n 1`
-      
+
       AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required Sun Studio compiler.])
       AC_MSG_NOTICE([The result from running with -V was: "$COMPILER_VERSION_TEST" and with --version: "$GCC_VERSION_TEST"])
       AC_MSG_ERROR([Sun Studio compiler is required. Try setting --with-tools-dir.])
@@ -69,7 +69,7 @@
       AC_MSG_NOTICE([The result from running with --version was: "$COMPILER_VERSION_TEST"])
       AC_MSG_ERROR([GCC compiler is required. Try setting --with-tools-dir.])
     fi
-    
+
     # First line typically looks something like:
     # gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
     COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* \(@<:@1-9@:>@@<:@0-9.@:>@*\)/\1/p"`
@@ -142,7 +142,7 @@
   BASIC_REMOVE_SYMBOLIC_LINKS(TEST_COMPILER)
   AC_MSG_RESULT([$TEST_COMPILER])
   AC_MSG_CHECKING([if $1 is disguised ccache])
-  
+
   COMPILER_BASENAME=`$BASENAME "$TEST_COMPILER"`
   if test "x$COMPILER_BASENAME" = "xccache"; then
     AC_MSG_RESULT([yes, trying to find proper $COMPILER_NAME compiler])
@@ -226,11 +226,11 @@
                     ],
                     [])
 
-if test "x$SYS_ROOT" != "x/" ; then                    
+if test "x$SYS_ROOT" != "x/" ; then
     CFLAGS="--sysroot=$SYS_ROOT $CFLAGS"
     CXXFLAGS="--sysroot=$SYS_ROOT $CXXFLAGS"
-    OBJCFLAGS="--sysroot=$SYS_ROOT $OBJCFLAGS" 
-    OBJCXXFLAGS="--sysroot=$SYS_ROOT $OBJCFLAGS" 
+    OBJCFLAGS="--sysroot=$SYS_ROOT $OBJCFLAGS"
+    OBJCXXFLAGS="--sysroot=$SYS_ROOT $OBJCFLAGS"
     CPPFLAGS="--sysroot=$SYS_ROOT $CPPFLAGS"
     LDFLAGS="--sysroot=$SYS_ROOT $LDFLAGS"
 fi
@@ -330,7 +330,7 @@
 COMPILER_NAME=gcc
 COMPILER_TYPE=CC
 AS_IF([test "x$OPENJDK_TARGET_OS" = xwindows], [
-    # For now, assume that we are always compiling using cl.exe. 
+    # For now, assume that we are always compiling using cl.exe.
     CC_OUT_OPTION=-Fo
     EXE_OUT_OPTION=-out:
     LD_OUT_OPTION=-out:
@@ -491,7 +491,7 @@
 
 ###############################################################################
 #
-# How to compile shared libraries. 
+# How to compile shared libraries.
 #
 
 if test "x$GCC" = xyes; then
@@ -525,7 +525,7 @@
         SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
         SHARED_LIBRARY_SUFFIX='.dylib'
         EXE_SUFFIX=''
-        SET_SHARED_LIBRARY_NAME='-Xlinker -install_name -Xlinker @rpath/[$]1' 
+        SET_SHARED_LIBRARY_NAME='-Xlinker -install_name -Xlinker @rpath/[$]1'
         SET_SHARED_LIBRARY_MAPFILE=''
         SET_SHARED_LIBRARY_ORIGIN='-Xlinker -rpath -Xlinker @loader_path/.'
         SET_EXECUTABLE_ORIGIN="$SET_SHARED_LIBRARY_ORIGIN"
@@ -676,7 +676,7 @@
         # Use single precision floating point with 'float'
         CC_HIGHEST="$CC_HIGHEST -fsingle"
         # Assume memory references via basic pointer types do not alias
-        #   (Source with excessing pointer casting and data access with mixed 
+        #   (Source with excessing pointer casting and data access with mixed
         #    pointer types are not recommended)
         CC_HIGHEST="$CC_HIGHEST -xalias_level=basic"
         # Use intrinsic or inline versions for math/std functions
@@ -892,7 +892,7 @@
 fi
 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMACOSX -D_ALLBSD_SOURCE"
-    # Setting these parameters makes it an error to link to macosx APIs that are 
+    # Setting these parameters makes it an error to link to macosx APIs that are
     # newer than the given OS version and makes the linked binaries compatible even
     # if built on a newer version of the OS.
     # The expected format is X.Y.Z
@@ -940,12 +940,12 @@
 # Which should we link to? Are we lucky enough that the binary api to the libjvm.so library
 # is identical for client and server? Yes. Which is picked at runtime (client or server)?
 # Neither, since the chosen libjvm.so has already been loaded by the launcher, all the following
-# libraries will link to whatever is in memory. Yuck. 
+# libraries will link to whatever is in memory. Yuck.
 #
 # Thus we offer the compiler to find libjvm.so first in server then in client. It works. Ugh.
 if test "x$COMPILER_NAME" = xcl; then
     LDFLAGS_JDK="$LDFLAGS_JDK -nologo -opt:ref -incremental:no"
-    if test "x$OPENJDK_TARGET_CPU" = xx86; then 
+    if test "x$OPENJDK_TARGET_CPU" = xx86; then
         LDFLAGS_JDK="$LDFLAGS_JDK -safeseh"
     fi
     # TODO: make -debug optional "--disable-full-debug-symbols"
@@ -965,7 +965,7 @@
         if test -n "$HAS_GNU_HASH"; then
             LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker --hash-style=both "
         fi
-        if test "x$OPENJDK_TARGET_OS" = xlinux; then 
+        if test "x$OPENJDK_TARGET_OS" = xlinux; then
           # And since we now know that the linker is gnu, then add -z defs, to forbid
           # undefined symbols in object files.
           LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -z -Xlinker defs"
@@ -1006,7 +1006,7 @@
 
 # Adjust flags according to debug level.
 case $DEBUG_LEVEL in
-      fastdebug ) 
+      fastdebug )
               CFLAGS="$CFLAGS $D_FLAG"
               JAVAC_FLAGS="$JAVAC_FLAGS -g"
               ;;
@@ -1018,9 +1018,9 @@
 	      CXX_O_FLAG_NORM="$CXX_O_FLAG_NONE"
               JAVAC_FLAGS="$JAVAC_FLAGS -g"
               ;;
-esac              
+esac
 
-                
+
 AC_SUBST(CFLAGS_JDKLIB)
 AC_SUBST(CFLAGS_JDKEXE)
 
@@ -1092,28 +1092,45 @@
   AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
 ])
 
-# Setup the JTREG paths 
-AC_DEFUN_ONCE([TOOLCHAIN_SETUP_JTREG], 
-[ 
-  AC_ARG_WITH(jtreg, [AS_HELP_STRING([--with-jtreg], 
-  [Regression Test Harness @<:@probed@:>@])]) 
- 
-  AC_MSG_CHECKING([for JTReg Regression Test Harness]) 
- 
-  if test "x$with_jtreg" != x; then 
-    JT_HOME="$with_jtreg"
-    BASIC_FIXUP_PATH([JT_HOME])
-    AC_MSG_RESULT($JT_HOME)
- 
-    # jtreg win32 script works for everybody 
-    JTREGEXE="$JT_HOME/win32/bin/jtreg"
-    if test ! -f "$JTREGEXE"; then
-      AC_MSG_ERROR([JTReg executable does not exist: $JTREGEXE])
+# Setup the JTREG paths
+AC_DEFUN_ONCE([TOOLCHAIN_SETUP_JTREG],
+[
+  AC_ARG_WITH(jtreg, [AS_HELP_STRING([--with-jtreg],
+  [Regression Test Harness @<:@probed@:>@])],
+  [],
+  [with_jtreg=no])
+
+  if test "x$with_jtreg" = xno; then
+    # jtreg disabled
+    AC_MSG_CHECKING([for jtreg])
+    AC_MSG_RESULT(no)
+  else
+    if test "x$with_jtreg" != xyes; then
+      # with path specified.
+      JT_HOME="$with_jtreg"
     fi
-  else 
-    AC_MSG_RESULT(no)
-  fi 
- 
-  AC_SUBST(JT_HOME) 
-  AC_SUBST(JTREGEXE) 
+
+    if test "x$JT_HOME" != x; then
+      AC_MSG_CHECKING([for jtreg])
+
+      # use JT_HOME enviroment var.
+      BASIC_FIXUP_PATH([JT_HOME])
+
+      # jtreg win32 script works for everybody
+      JTREGEXE="$JT_HOME/win32/bin/jtreg"
+
+      if test ! -f "$JTREGEXE"; then
+        AC_MSG_ERROR([JTReg executable does not exist: $JTREGEXE])
+      fi
+
+      AC_MSG_RESULT($JTREGEXE)
+    else
+      # try to find jtreg on path
+      BASIC_REQUIRE_PROG(JTREGEXE, jtreg)
+      JT_HOME="`$DIRNAME $JTREGEXE`"
+    fi
+  fi
+
+  AC_SUBST(JT_HOME)
+  AC_SUBST(JTREGEXE)
 ])
--- a/common/makefiles/Main.gmk	Tue Jun 04 10:23:37 2013 +0200
+++ b/common/makefiles/Main.gmk	Tue Jun 04 10:36:00 2013 +0200
@@ -183,7 +183,7 @@
 test: images test-only
 test-only: start-make
 	@$(call TargetEnter)
-	@($(CD) $(SRC_ROOT)/test && $(BUILD_LOG_WRAPPER) $(MAKE) -j1 -k MAKEFLAGS= PRODUCT_HOME=$(JDK_IMAGE_DIR) JPRT_JAVA_HOME=$(JDK_IMAGE_DIR) ALT_OUTPUTDIR=$(OUTPUT_ROOT) $(TEST)) || true
+	@($(CD) $(SRC_ROOT)/test && $(BUILD_LOG_WRAPPER) $(MAKE) -j1 -k JT_HOME=$(JT_HOME) MAKEFLAGS= PRODUCT_HOME=$(JDK_IMAGE_DIR) JPRT_JAVA_HOME=$(JDK_IMAGE_DIR) ALT_OUTPUTDIR=$(OUTPUT_ROOT) $(TEST)) || true
 	@$(call TargetExit)
 
 # Stores the tips for each repository. This file is be used when constructing the jdk image and can be