8158992: langtools/test/Makefile: improve support for control via variables
Reviewed-by: jjg
--- a/langtools/test/Makefile Fri Jun 17 14:33:54 2016 -0700
+++ b/langtools/test/Makefile Fri Jun 17 17:09:21 2016 -0600
@@ -84,12 +84,14 @@
endif
# Default JTREG to run
-ifdef JPRT_JTREG_HOME
- JTREG_HOME = $(JPRT_JTREG_HOME)
-else ifdef JT_HOME
- JTREG_HOME = $(JT_HOME)
-else
- JTREG_HOME = $(SLASH_JAVA)/re/jtreg/4.1-jigsaw/nightly/binaries/jtreg/
+ifndef JTREG_HOME
+ ifdef JPRT_JTREG_HOME
+ JTREG_HOME = $(JPRT_JTREG_HOME)
+ else ifdef JT_HOME
+ JTREG_HOME = $(JT_HOME)
+ else
+ JTREG_HOME = $(SLASH_JAVA)/re/jtreg/4.2/promoted/latest/
+ endif
endif
JTREG = $(JTREG_HOME)/bin/jtreg
JTDIFF = $(JTREG_HOME)/bin/jtdiff
@@ -105,10 +107,12 @@
endif
# Default JCK to run
-ifdef JPRT_JCK_HOME
- JCK_HOME = $(JPRT_JCK_HOME)
-else
- JCK_HOME = $(SLASH_JAVA)/re/jck/8/promoted/latest/binaries
+ifndef JCK_HOME
+ ifdef JPRT_JCK_HOME
+ JCK_HOME = $(JPRT_JCK_HOME)
+ else
+ JCK_HOME = $(SLASH_JAVA)/re/jck/8/promoted/latest/binaries
+ endif
endif
# Default JDK for JTREG and JCK
@@ -203,10 +207,10 @@
endif
# Default verbosity setting for jtreg
-JTREG_VERBOSE = fail,error,nopass
+JTREG_VERBOSE ?= fail,error,nopass
# Default verbosity setting for jck
-JCK_VERBOSE = non-pass
+JCK_VERBOSE ?= non-pass
# Assertions: some tests show failures when assertions are enabled.
# Since javac is typically loaded via the bootclassloader (either via TESTJAVA
@@ -232,10 +236,6 @@
# to a given level. Redefine function or preceding FATAL_*_EXIT codes as needed.
EXIT_IF_FATAL = status=$$?; if [ $$status -ge $(1) ]; then exit $$status ; fi
-# The test directories to run
-DEFAULT_TESTDIRS = .
-TESTDIRS = $(DEFAULT_TESTDIRS)
-
# Root of all test results
TEST_OUTPUT_DIR = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools
ABS_TEST_OUTPUT_DIR := \
@@ -260,9 +260,17 @@
jck-runtime: $(JPRT_CLEAN) jck-runtime-tests $(JPRT_ARCHIVE_BUNDLE) jck-runtime-summary
@echo "Testing completed successfully"
+# a way to select tests from outside
+# works for targets 'jtreg', 'jck-compiler', and 'jck-runtime'
+ifdef TEST_SELECTION
+ JTREG_TESTDIRS = $(TEST_SELECTION)
+ JCK_COMPILER_TESTDIRS = $(TEST_SELECTION)
+ JCK_RUNTIME_TESTDIRS = $(TEST_SELECTION)
+endif
+
# for use with JPRT -testrule
all: JTREG_TESTDIRS = .
-jtreg: JTREG_TESTDIRS = .
+jtreg: JTREG_TESTDIRS ?= .
apt: JTREG_TESTDIRS = tools/apt
javac: JTREG_TESTDIRS = tools/javac
javadoc: JTREG_TESTDIRS = tools/javadoc com/sun/javadoc
@@ -270,11 +278,6 @@
javap: JTREG_TESTDIRS = tools/javap
jdeps: JTREG_TESTDIRS = tools/jdeps
-# a way to select jtreg tests from outside
-ifdef TEST_SELECTION
- JTREG_TESTDIRS = $(TEST_SELECTION)
-endif
-
# Run jtreg tests
#
@@ -438,11 +441,11 @@
# Check to make sure these directories exist
check-jck:
- if [ ! -d '$(JCK_HOME)' ]; then \
+ @if [ ! -d '$(JCK_HOME)' ]; then \
echo "JCK_HOME $(JCK_HOME) missing" ; \
$(EXIT) 1 ; \
fi
- if [ ! -d '$(PRODUCT_HOME)' ]; then \
+ @if [ ! -d '$(PRODUCT_HOME)' ]; then \
echo "PRODUCT_HOME $(PRODUCT_HOME) missing" ; \
$(EXIT) 1 ; \
fi