changeset 2400:ef851705e3e1 jdk8u232-b02

8222737: [TESTBUG] Allow for tier 1 like testing in OpenJDK 8u Reviewed-by: shade, adinn, andrew
author sgehwolf
date Thu, 25 Apr 2019 14:01:57 +0200
parents d932feeb203d
children c5ca527b0afd
files Makefile make/Main.gmk test/Makefile
diffstat 3 files changed, 56 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Thu Jul 25 16:23:25 2019 +0100
+++ b/Makefile	Thu Apr 25 14:01:57 2019 +0200
@@ -101,7 +101,7 @@
 	$(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 @@
 	$(info )
 	$(info .  make test 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
--- a/make/Main.gmk	Thu Jul 25 16:23:25 2019 +0100
+++ b/make/Main.gmk	Thu Apr 25 14:01:57 2019 +0200
@@ -172,11 +172,17 @@
 	@$(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.
--- a/test/Makefile	Thu Jul 25 16:23:25 2019 +0100
+++ b/test/Makefile	Thu Apr 25 14:01:57 2019 +0200
@@ -50,6 +50,22 @@
 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 @@
 
 # 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 @@
 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 @@
 ################################################################
 
 # Phony targets (e.g. these are not filenames)
-.PHONY: all clean
+.PHONY: all clean summary_tier1 prep_tier1
 
 ################################################################