diff --git a/Makefile b/Makefile index 7fe922ba458c36ce2d7b0c270ac22127deb04d9d..d1ca32bfd7d79427b130014ee7798c48b03fb535 100644 --- a/Makefile +++ b/Makefile @@ -101,7 +101,7 @@ help: $(info . # generated by configure) $(info . make dist-clean # Remove all files, including configuration) $(info . make help # Give some help on using make) - $(info . make test # Run tests, default is all tests (see TEST below)) + $(info . make test # Run tests, default is "jdk_core langtools_jtreg" (see TEST below)) $(info ) $(info Targets for specific components) $(info (Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk, nashorn, images, overlay-images, docs or test)) @@ -125,6 +125,8 @@ help: $(info ) $(info . make test TEST= # Only run the given test or tests, e.g.) $(info . # make test TEST="jdk_lang jdk_net") + $(info . # or) + $(info . # make test TEST="tier1") $(info ) .PHONY: help diff --git a/make/Main.gmk b/make/Main.gmk index 476a473498db19828cd6c9577c6ac098c0b646ef..7d7a5e58133622ff9e2abffdfccaafc9761d533f 100644 --- a/make/Main.gmk +++ b/make/Main.gmk @@ -172,11 +172,17 @@ bootcycle-images-only: start-make @$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image @($(CD) $(SRC_ROOT) && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(dir $(SPEC))bootcycle-spec.gmk images) +# If the tests produced a $(TEST)_exitcode.txt file, use the number in that +# file for the exit code of the "make test" invocation. test: images test-only test-only: start-make @$(call TargetEnter) @($(CD) $(SRC_ROOT)/test && $(BUILD_LOG_WRAPPER) $(MAKE) -j1 -k MAKEFLAGS= JT_HOME=$(JT_HOME) PRODUCT_HOME=$(JDK_IMAGE_DIR) ALT_OUTPUTDIR=$(OUTPUT_ROOT) CONCURRENCY=$(JOBS) $(TEST)) || true @$(call TargetExit) + @(if [ -r $(OUTPUT_ROOT)/testoutput/$(TEST)_exitcode.txt ]; then \ + EXIT=$$($(CAT) $(OUTPUT_ROOT)/testoutput/$(TEST)_exitcode.txt); \ + exit $${EXIT}; \ + fi) # Stores the tips for each repository. This file is be used when constructing the jdk image and can be # used to track the exact sources used to build that image. diff --git a/test/Makefile b/test/Makefile index 89141cce04b6fe19217dacfd0dbd2fdef8638e7e..28ecdbb6938bf3201082a7cde858fc5882e36f86 100644 --- a/test/Makefile +++ b/test/Makefile @@ -50,6 +50,22 @@ else \ fi endef +# Macro to print a summary for a given test subdirectory +define SUBDIR_SUMMARY # subdirectory to print summary +if [ -d $1 ] ; then \ + if [ -r $1/Stats.txt ] ; then \ + cat $1/Stats.txt; \ + echo ""; \ + else \ + echo "ERROR: File does not exist: $1/Stats.txt"; \ + exit 1; \ + fi; \ +else \ + echo "WARNING: Expected directory does not exist: $1"; \ + echo " Test summary might be incorrect."; \ +fi +endef + # Default test target (core) default: jdk_core langtools_jtreg @@ -58,7 +74,7 @@ all: jdk_all langtools_all # Test targets langtools_% : - @$(NO_STOPPING)$(call SUBDIR_TEST, $(LANGTOOLS_DIR), JT_JAVA=$(PRODUCT_HOME) JTREG_HOME=$(JT_HOME) TEST="$(subst langtools_,,$@)" $(subst langtools_,,$@)) + @$(NO_STOPPING)$(call SUBDIR_TEST, $(LANGTOOLS_DIR), JT_JAVA=$(PRODUCT_HOME) JTREG_HOME=$(JT_HOME) UNIQUE_DIR="$@" TEST="$(subst langtools_,,$@)" $(subst langtools_,,$@)) jdk_% core_%s svc_%: @$(NO_STOPPING)$(call SUBDIR_TEST, $(JDK_DIR), TEST="$@" $@) @@ -66,6 +82,35 @@ jdk_% core_%s svc_%: hotspot_%: @$(NO_STOPPING)$(call SUBDIR_TEST, $(HOTSPOT_DIR), TEST="$@" $@) +# Variables for tier1 testing +TIER1_TESTOUTPUT="$(ALT_OUTPUTDIR)/testoutput" +TIER1_STATUS_FILE="$(TIER1_TESTOUTPUT)/tier1_exitcode.txt" + +# Note: Test failures are handled via summary_tier1 as the +# tier1 targets are never aborted even if tests fail. +tier1: prep_tier1 jdk_tier1 langtools_tier1 hotspot_tier1 summary_tier1 + +prep_tier1: + @rm -rf $(TIER1_STATUS_FILE) + +# This relies on jdk_tier1, langtools_tier1, hotspot_tier1 producing +# Stats.txt (summary) and exitcode.txt files. +summary_tier1: + @(EXIT_VAL=0; \ + echo ""; \ + echo "-------------- Test Summary ------------"; \ + echo ""; \ + for test_dir in $$(find "$(ALT_OUTPUTDIR)" -type d -name \*_tier1); do \ + $(call SUBDIR_SUMMARY, $${test_dir}); \ + EXIT_VAL=$$(expr $${EXIT_VAL} + $$(cat $${test_dir}/exitcode.txt)); \ + done; \ + echo $${EXIT_VAL} > $(TIER1_STATUS_FILE); \ + echo "For details see:"; \ + echo $(TIER1_TESTOUTPUT); \ + echo ""; \ + echo "-------------- Test Summary ------------"; \ + echo "") + # # jtreg_tests # @@ -95,6 +140,6 @@ jtreg_tests: ################################################################ # Phony targets (e.g. these are not filenames) -.PHONY: all clean +.PHONY: all clean summary_tier1 prep_tier1 ################################################################