test/Makefile

Print this page
rev 1815 : 8016577: langtools/test/Makefile should only set some vars if unset
Reviewed-by: duke

@@ -86,17 +86,21 @@
 else
   SLASH_JAVA = /java
 endif
 
 # Default JTREG to run
-ifdef JPRT_JTREG_HOME
-  JTREG_HOME = $(JPRT_JTREG_HOME)
-else
-  JTREG_HOME = $(SLASH_JAVA)/re/jtreg/4.1/promoted/latest/binaries/jtreg
+ifndef JT_HOME
+  ifdef JPRT_JTREG_HOME
+    JT_HOME = $(JPRT_JTREG_HOME)
+  else
+    JT_HOME = $(SLASH_JAVA)/re/jtreg/4.1/promoted/latest/binaries/jtreg
+    $(warning Using default for JT_HOME: $(JT_HOME))
+  endif
 endif
-JTREG = $(JTREG_HOME)/$(JT_PLATFORM)/bin/jtreg
-JTDIFF = $(JTREG_HOME)/$(JT_PLATFORM)/bin/jtdiff
+
+JTREG = $(JT_HOME)/$(JT_PLATFORM)/bin/jtreg
+JTDIFF = $(JT_HOME)/$(JT_PLATFORM)/bin/jtdiff
 
 # Default JCK to run
 ifdef JPRT_JCK_HOME
   JCK_HOME = $(JPRT_JCK_HOME)
 else

@@ -107,37 +111,47 @@
 #
 # JT_JAVA is the version of java used to run jtreg/JCK. Since it is now
 # standard to execute tests in sameVM mode, it should normally be set the
 # same as TESTJAVA (although not necessarily so.)
 #
-ifdef JPRT_JAVA_HOME
+ifndef JT_JAVA
+  ifdef JPRT_JAVA_HOME
   JT_JAVA = $(JPRT_JAVA_HOME)
-else
+  else
+    # Use default.
   JT_JAVA = $(SLASH_JAVA)/re/jdk/1.7.0/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
+    $(warning Using default for JT_JAVA: $(JT_JAVA))
+  endif
 endif
 
 # Default JDK to test
-ifdef JPRT_IMPORT_PRODUCT_HOME
+ifndef TESTJAVA
+  ifdef JPRT_IMPORT_PRODUCT_HOME
   TESTJAVA = $(JPRT_IMPORT_PRODUCT_HOME)
-else
-  TESTJAVA = $(SLASH_JAVA)/re/jdk/1.7.0/promoted/latest/binaries/$(PLATFORM)-$(ARCH)
-endif
-
-# PRODUCT_HOME is a JPRT variable pointing to a directory containing the output from 
-# make/Makefile
-# For langtools, this is a directory containing build and dist
-# For a control build, this is build/$(PRODUCT)-$(ARCH)/XYZ-image 
-#       (i.e, j2sdk-image or jdk-module-image)
-ifdef PRODUCT_HOME
-  ifeq ($(shell [ -r $(PRODUCT_HOME)/dist/lib/classes.jar ]; echo $$?),0)
-    TESTBOOTCLASSPATH = $(PRODUCT_HOME)/dist/lib/classes.jar
-  endif
+  else
+    # PRODUCT_HOME is a JPRT variable pointing to a directory containing the build output
+    # For langtools, this is a directory containing build and dist
+    # For a control build, this is build/$(PRODUCT)-$(ARCH)/XYZ-image
+    #   (i.e, j2sdk-image or jdk-module-image)
+    ifdef PRODUCT_HOME
   ifeq ($(shell [ -r $(PRODUCT_HOME)/bin/javac$(EXE_SUFFIX) ]; echo $$?),0)
     TESTJAVA = $(PRODUCT_HOME)
+      else
+        $(error Invalid PRODUCT_HOME - does not point to a JDK instance: $(PRODUCT_HOME))
+      endif
+    else
+      # last ditch
+      TESTJAVA = $(SLASH_JAVA)/re/jdk/1.7.0/promoted/latest/binaries/$(PLATFORM)-$(ARCH)
+      $(warning Using default for TESTJAVA: $(TESTJAVA))
+    endif
   endif
 endif
 
+ifeq ($(shell [ -r $(TESTJAVA)/dist/lib/classes.jar ]; echo $$?),0)
+  TESTBOOTCLASSPATH = $(TESTJAVA)/dist/lib/classes.jar
+endif
+
 ifdef TESTBOOTCLASSPATH
   JTREG_OPTIONS += -Xbootclasspath/p:$(TESTBOOTCLASSPATH)
 ### In the following, -refvmoptions is an undocumented option
 ### The following does not work JCK 7 b30 2/6/2010. Awaiting b31. 
   JCK_OPTIONS += \

@@ -146,11 +160,11 @@
 endif
 
 # Concurrency is the number of tests that can execute at once. 
 # On an otherwise empty machine, suggest setting to (#cpus + 2)
 # If unset, the default is (#cpus)
-### RFE: determine and use #cpus
+# when invoked via root repo "make test" it is set to $(JOBS)
 ifdef CONCURRENCY
   JTREG_OPTIONS += -agentvm -concurrency:$(CONCURRENCY)
 else
   JTREG_OPTIONS += -samevm
 endif

@@ -248,11 +262,11 @@
 javap:          JTREG_TESTDIRS = tools/javap
 jdeps:          JTREG_TESTDIRS = tools/jdeps
 
 # Run jtreg tests
 #
-# JTREG_HOME
+# JT_HOME
 #       Installed location of jtreg
 # JT_JAVA
 #       Version of java used to run jtreg.  Should normally be the same as TESTJAVA
 # TESTJAVA
 #       Version of java to be tested.  

@@ -432,6 +446,5 @@
         jck-compiler jck-compiler-tests jck-compiler-summary \
         jck-runtime jck-runtime-tests jck-runtime-summary check-jck
 
 # No use of suffix rules
 .SUFFIXES:
-