--- a/make/RunTests.gmk Tue Oct 02 14:15:25 2018 -0700
+++ b/make/RunTests.gmk Tue Oct 02 17:16:01 2018 -0700
@@ -45,7 +45,7 @@
endif
$(eval $(call ParseKeywordVariable, TEST_OPTS, \
- KEYWORDS := JOBS TIMEOUT, \
+ KEYWORDS := JOBS TIMEOUT GENERATE_CDS_ARCHIVE, \
STRING_KEYWORDS := VM_OPTIONS, \
))
@@ -104,6 +104,44 @@
GTEST_VARIANTS := $(strip $(patsubst $(TEST_IMAGE_DIR)/hotspot/gtest/%, %, $(GTEST_LAUNCHER_DIRS)))
################################################################################
+# Setup global test running parameters
+################################################################################
+
+# Each factor variable comes in 3 variants. The first one is reserved for users
+# to use on command line. The other two are for predifined configurations in JDL
+# and for machine specific configurations respectively.
+TEST_JOBS_FACTOR ?= 1
+TEST_JOBS_FACTOR_JDL ?= 1
+TEST_JOBS_FACTOR_MACHINE ?= 1
+
+ifeq ($(TEST_JOBS), 0)
+ # Concurrency based on min(cores / 2, 12) * TEST_JOBS_FACTOR
+ TEST_JOBS := $(shell $(AWK) \
+ 'BEGIN { \
+ c = $(NUM_CORES) / 2; \
+ if (c > 12) c = 12; \
+ c = c * $(TEST_JOBS_FACTOR); \
+ c = c * $(TEST_JOBS_FACTOR_JDL); \
+ c = c * $(TEST_JOBS_FACTOR_MACHINE); \
+ if (c < 1) c = 1; \
+ printf "%.0f", c; \
+ }')
+endif
+
+# Optionally create a CDS archive before running tests
+ifeq ($(TEST_OPTS_GENERATE_CDS_ARCHIVE), true)
+ CDS_ARCHIVE_FILE := $(TEST_RESULTS_DIR)/cds_archive.jsa
+
+ $(CDS_ARCHIVE_FILE): $(JDK_IMAGE_DIR)
+ $(FIXPATH) $(PRODUCT_HOME)/bin/java -XX:+UnlockDiagnosticVMOptions \
+ -XX:SharedArchiveFile=$(CDS_ARCHIVE_FILE) -Xshare:dump
+
+ CDS_VM_ARGS := -XX:+UnlockDiagnosticVMOptions -XX:SharedArchiveFile=$(CDS_ARCHIVE_FILE)
+ JTREG_OPTIONS += $(addprefix -vmoption:, $(CDS_VM_ARGS))
+ TEST_PREREQS += $(CDS_ARCHIVE_FILE)
+endif
+
+################################################################################
# Parse control variables
################################################################################
@@ -119,7 +157,8 @@
endif
$(eval $(call ParseKeywordVariable, JTREG, \
- KEYWORDS := JOBS TIMEOUT TEST_MODE ASSERT VERBOSE RETAIN MAX_MEM, \
+ KEYWORDS := JOBS TIMEOUT TEST_MODE ASSERT VERBOSE RETAIN MAX_MEM \
+ EXTRA_PROBLEM_LISTS, \
STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS, \
))
@@ -143,17 +182,6 @@
# Component-specific Jtreg settings
################################################################################
-ifeq ($(TEST_JOBS), 0)
- # If TEST_JOBS is not specified, hotspot fallback default is
- # min(num_cores / 2, 12).
- hotspot_JTREG_JOBS := $(shell $(EXPR) $(NUM_CORES) / 2)
- ifeq ($(hotspot_JTREG_JOBS), 0)
- hotspot_JTREG_JOBS := 1
- else ifeq ($(shell $(EXPR) $(hotspot_JTREG_JOBS) \> 12), 1)
- hotspot_JTREG_JOBS := 12
- endif
-endif
-
hotspot_JTREG_MAX_MEM := 0
hotspot_JTREG_ASSERT := false
hotspot_JTREG_NATIVEPATH := $(TEST_IMAGE_DIR)/hotspot/jtreg/native
@@ -165,6 +193,8 @@
nashorn_JTREG_PROBLEM_LIST += $(TOPDIR)/test/nashorn/ProblemList.txt
hotspot_JTREG_PROBLEM_LIST += $(TOPDIR)/test/hotspot/jtreg/ProblemList.txt
+langtools_JTREG_MAX_MEM := 768m
+
################################################################################
# Parse test selection
#
@@ -368,7 +398,7 @@
$1_GTEST_REPEAT :=--gtest_repeat=$$(GTEST_REPEAT)
endif
- run-test-$1:
+ run-test-$1: $(TEST_PREREQS)
$$(call LogWarn)
$$(call LogWarn, Running test '$$($1_TEST)')
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
@@ -447,12 +477,11 @@
$1_TEST_NAME := $$(strip $$(patsubst jtreg:%, %, $$($1_TEST)))
- $1_COMPONENT := \
+ $1_TEST_ROOT := \
$$(strip $$(foreach root, $$(JTREG_TESTROOTS), \
- $$(if $$(filter $$(root)%, $$(JTREG_TOPDIR)/$$($1_TEST_NAME)), \
- $$(lastword $$(subst /, $$(SPACE), $$(root))) \
- ) \
+ $$(if $$(filter $$(root)%, $$(JTREG_TOPDIR)/$$($1_TEST_NAME)), $$(root)) \
))
+ $1_COMPONENT := $$(lastword $$(subst /, $$(SPACE), $$($1_TEST_ROOT)))
# This will work only as long as just hotspot has the additional "jtreg" directory
ifeq ($$($1_COMPONENT), jtreg)
$1_COMPONENT := hotspot
@@ -476,10 +505,8 @@
$$(eval $$(call SetJtregValue,$1,JTREG_PROBLEM_LIST))
ifneq ($(TEST_JOBS), 0)
- # User has specified TEST_JOBS, use that as fallback default
$$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(TEST_JOBS)))
else
- # Use JOBS as default (except for hotspot)
$$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(JOBS)))
endif
@@ -531,6 +558,14 @@
$1_JTREG_BASIC_OPTIONS += $$(addprefix -exclude:, $$($1_JTREG_PROBLEM_LIST))
endif
+ ifneq ($$(JTREG_EXTRA_PROBLEM_LISTS), )
+ # Accept both absolute paths as well as relative to the current test root.
+ $1_JTREG_BASIC_OPTIONS += $$(addprefix -exclude:, $$(wildcard \
+ $$(JTREG_EXTRA_PROBLEM_LISTS) \
+ $$(addprefix $$($1_TEST_ROOT)/, $$(JTREG_EXTRA_PROBLEM_LISTS)) \
+ ))
+ endif
+
ifneq ($$(JIB_HOME), )
$1_JTREG_BASIC_OPTIONS += -e:JIB_HOME=$$(JIB_HOME)
endif
@@ -544,7 +579,7 @@
clean-workdir-$1:
$$(RM) -r $$($1_TEST_SUPPORT_DIR)
- run-test-$1: clean-workdir-$1
+ run-test-$1: clean-workdir-$1 $(TEST_PREREQS)
$$(call LogWarn)
$$(call LogWarn, Running test '$$($1_TEST)')
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
@@ -631,7 +666,7 @@
$$(error Invalid special test specification: $$($1_TEST_NAME))
endif
- run-test-$1:
+ run-test-$1: $(TEST_PREREQS)
$$(call LogWarn)
$$(call LogWarn, Running test '$$($1_TEST)')
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))