Thu, 25 Apr 2019 14:01:57 +0200
8222737: [TESTBUG] Allow for tier 1 like testing in OpenJDK 8u
Reviewed-by: shade, adinn, andrew
Makefile | file | annotate | diff | comparison | revisions | |
make/Main.gmk | file | annotate | diff | comparison | revisions | |
test/Makefile | file | annotate | diff | comparison | revisions |
1.1 --- a/Makefile Thu Jul 25 16:23:25 2019 +0100 1.2 +++ b/Makefile Thu Apr 25 14:01:57 2019 +0200 1.3 @@ -101,7 +101,7 @@ 1.4 $(info . # generated by configure) 1.5 $(info . make dist-clean # Remove all files, including configuration) 1.6 $(info . make help # Give some help on using make) 1.7 - $(info . make test # Run tests, default is all tests (see TEST below)) 1.8 + $(info . make test # Run tests, default is "jdk_core langtools_jtreg" (see TEST below)) 1.9 $(info ) 1.10 $(info Targets for specific components) 1.11 $(info (Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk, nashorn, images, overlay-images, docs or test)) 1.12 @@ -125,6 +125,8 @@ 1.13 $(info ) 1.14 $(info . make test TEST=<test> # Only run the given test or tests, e.g.) 1.15 $(info . # make test TEST="jdk_lang jdk_net") 1.16 + $(info . # or) 1.17 + $(info . # make test TEST="tier1") 1.18 $(info ) 1.19 1.20 .PHONY: help
2.1 --- a/make/Main.gmk Thu Jul 25 16:23:25 2019 +0100 2.2 +++ b/make/Main.gmk Thu Apr 25 14:01:57 2019 +0200 2.3 @@ -172,11 +172,17 @@ 2.4 @$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image 2.5 @($(CD) $(SRC_ROOT) && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(dir $(SPEC))bootcycle-spec.gmk images) 2.6 2.7 +# If the tests produced a $(TEST)_exitcode.txt file, use the number in that 2.8 +# file for the exit code of the "make test" invocation. 2.9 test: images test-only 2.10 test-only: start-make 2.11 @$(call TargetEnter) 2.12 @($(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 2.13 @$(call TargetExit) 2.14 + @(if [ -r $(OUTPUT_ROOT)/testoutput/$(TEST)_exitcode.txt ]; then \ 2.15 + EXIT=$$($(CAT) $(OUTPUT_ROOT)/testoutput/$(TEST)_exitcode.txt); \ 2.16 + exit $${EXIT}; \ 2.17 + fi) 2.18 2.19 # Stores the tips for each repository. This file is be used when constructing the jdk image and can be 2.20 # used to track the exact sources used to build that image.
3.1 --- a/test/Makefile Thu Jul 25 16:23:25 2019 +0100 3.2 +++ b/test/Makefile Thu Apr 25 14:01:57 2019 +0200 3.3 @@ -50,6 +50,22 @@ 3.4 fi 3.5 endef 3.6 3.7 +# Macro to print a summary for a given test subdirectory 3.8 +define SUBDIR_SUMMARY # subdirectory to print summary 3.9 +if [ -d $1 ] ; then \ 3.10 + if [ -r $1/Stats.txt ] ; then \ 3.11 + cat $1/Stats.txt; \ 3.12 + echo ""; \ 3.13 + else \ 3.14 + echo "ERROR: File does not exist: $1/Stats.txt"; \ 3.15 + exit 1; \ 3.16 + fi; \ 3.17 +else \ 3.18 + echo "WARNING: Expected directory does not exist: $1"; \ 3.19 + echo " Test summary might be incorrect."; \ 3.20 +fi 3.21 +endef 3.22 + 3.23 # Default test target (core) 3.24 default: jdk_core langtools_jtreg 3.25 3.26 @@ -58,7 +74,7 @@ 3.27 3.28 # Test targets 3.29 langtools_% : 3.30 - @$(NO_STOPPING)$(call SUBDIR_TEST, $(LANGTOOLS_DIR), JT_JAVA=$(PRODUCT_HOME) JTREG_HOME=$(JT_HOME) TEST="$(subst langtools_,,$@)" $(subst langtools_,,$@)) 3.31 + @$(NO_STOPPING)$(call SUBDIR_TEST, $(LANGTOOLS_DIR), JT_JAVA=$(PRODUCT_HOME) JTREG_HOME=$(JT_HOME) UNIQUE_DIR="$@" TEST="$(subst langtools_,,$@)" $(subst langtools_,,$@)) 3.32 3.33 jdk_% core_%s svc_%: 3.34 @$(NO_STOPPING)$(call SUBDIR_TEST, $(JDK_DIR), TEST="$@" $@) 3.35 @@ -66,6 +82,35 @@ 3.36 hotspot_%: 3.37 @$(NO_STOPPING)$(call SUBDIR_TEST, $(HOTSPOT_DIR), TEST="$@" $@) 3.38 3.39 +# Variables for tier1 testing 3.40 +TIER1_TESTOUTPUT="$(ALT_OUTPUTDIR)/testoutput" 3.41 +TIER1_STATUS_FILE="$(TIER1_TESTOUTPUT)/tier1_exitcode.txt" 3.42 + 3.43 +# Note: Test failures are handled via summary_tier1 as the 3.44 +# tier1 targets are never aborted even if tests fail. 3.45 +tier1: prep_tier1 jdk_tier1 langtools_tier1 hotspot_tier1 summary_tier1 3.46 + 3.47 +prep_tier1: 3.48 + @rm -rf $(TIER1_STATUS_FILE) 3.49 + 3.50 +# This relies on jdk_tier1, langtools_tier1, hotspot_tier1 producing 3.51 +# Stats.txt (summary) and exitcode.txt files. 3.52 +summary_tier1: 3.53 + @(EXIT_VAL=0; \ 3.54 + echo ""; \ 3.55 + echo "-------------- Test Summary ------------"; \ 3.56 + echo ""; \ 3.57 + for test_dir in $$(find "$(ALT_OUTPUTDIR)" -type d -name \*_tier1); do \ 3.58 + $(call SUBDIR_SUMMARY, $${test_dir}); \ 3.59 + EXIT_VAL=$$(expr $${EXIT_VAL} + $$(cat $${test_dir}/exitcode.txt)); \ 3.60 + done; \ 3.61 + echo $${EXIT_VAL} > $(TIER1_STATUS_FILE); \ 3.62 + echo "For details see:"; \ 3.63 + echo $(TIER1_TESTOUTPUT); \ 3.64 + echo ""; \ 3.65 + echo "-------------- Test Summary ------------"; \ 3.66 + echo "") 3.67 + 3.68 # 3.69 # jtreg_tests 3.70 # 3.71 @@ -95,6 +140,6 @@ 3.72 ################################################################ 3.73 3.74 # Phony targets (e.g. these are not filenames) 3.75 -.PHONY: all clean 3.76 +.PHONY: all clean summary_tier1 prep_tier1 3.77 3.78 ################################################################