Skip to content

Commit f1e6b1a

Browse files
committed
8222737: [TESTBUG] Allow for tier 1 like testing in OpenJDK 8u
Reviewed-by: shade, adinn, andrew
1 parent 1dcbaba commit f1e6b1a

File tree

3 files changed

+56
-3
lines changed

3 files changed

+56
-3
lines changed

Makefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ help:
101101
$(info . # generated by configure)
102102
$(info . make dist-clean # Remove all files, including configuration)
103103
$(info . make help # Give some help on using make)
104-
$(info . make test # Run tests, default is all tests (see TEST below))
104+
$(info . make test # Run tests, default is "jdk_core langtools_jtreg" (see TEST below))
105105
$(info )
106106
$(info Targets for specific components)
107107
$(info (Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk, nashorn, images, overlay-images, docs or test))
@@ -125,6 +125,8 @@ help:
125125
$(info )
126126
$(info . make test TEST=<test> # Only run the given test or tests, e.g.)
127127
$(info . # make test TEST="jdk_lang jdk_net")
128+
$(info . # or)
129+
$(info . # make test TEST="tier1")
128130
$(info )
129131

130132
.PHONY: help

make/Main.gmk

+6
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,17 @@ bootcycle-images-only: start-make
172172
@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
173173
@($(CD) $(SRC_ROOT) && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(dir $(SPEC))bootcycle-spec.gmk images)
174174

175+
# If the tests produced a $(TEST)_exitcode.txt file, use the number in that
176+
# file for the exit code of the "make test" invocation.
175177
test: images test-only
176178
test-only: start-make
177179
@$(call TargetEnter)
178180
@($(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
179181
@$(call TargetExit)
182+
@(if [ -r $(OUTPUT_ROOT)/testoutput/$(TEST)_exitcode.txt ]; then \
183+
EXIT=$$($(CAT) $(OUTPUT_ROOT)/testoutput/$(TEST)_exitcode.txt); \
184+
exit $${EXIT}; \
185+
fi)
180186

181187
# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
182188
# used to track the exact sources used to build that image.

test/Makefile

+47-2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ else \
5050
fi
5151
endef
5252

53+
# Macro to print a summary for a given test subdirectory
54+
define SUBDIR_SUMMARY # subdirectory to print summary
55+
if [ -d $1 ] ; then \
56+
if [ -r $1/Stats.txt ] ; then \
57+
cat $1/Stats.txt; \
58+
echo ""; \
59+
else \
60+
echo "ERROR: File does not exist: $1/Stats.txt"; \
61+
exit 1; \
62+
fi; \
63+
else \
64+
echo "WARNING: Expected directory does not exist: $1"; \
65+
echo " Test summary might be incorrect."; \
66+
fi
67+
endef
68+
5369
# Default test target (core)
5470
default: jdk_core langtools_jtreg
5571

@@ -58,14 +74,43 @@ all: jdk_all langtools_all
5874

5975
# Test targets
6076
langtools_% :
61-
@$(NO_STOPPING)$(call SUBDIR_TEST, $(LANGTOOLS_DIR), JT_JAVA=$(PRODUCT_HOME) JTREG_HOME=$(JT_HOME) TEST="$(subst langtools_,,$@)" $(subst langtools_,,$@))
77+
@$(NO_STOPPING)$(call SUBDIR_TEST, $(LANGTOOLS_DIR), JT_JAVA=$(PRODUCT_HOME) JTREG_HOME=$(JT_HOME) UNIQUE_DIR="$@" TEST="$(subst langtools_,,$@)" $(subst langtools_,,$@))
6278

6379
jdk_% core_%s svc_%:
6480
@$(NO_STOPPING)$(call SUBDIR_TEST, $(JDK_DIR), TEST="$@" $@)
6581

6682
hotspot_%:
6783
@$(NO_STOPPING)$(call SUBDIR_TEST, $(HOTSPOT_DIR), TEST="$@" $@)
6884

85+
# Variables for tier1 testing
86+
TIER1_TESTOUTPUT="$(ALT_OUTPUTDIR)/testoutput"
87+
TIER1_STATUS_FILE="$(TIER1_TESTOUTPUT)/tier1_exitcode.txt"
88+
89+
# Note: Test failures are handled via summary_tier1 as the
90+
# tier1 targets are never aborted even if tests fail.
91+
tier1: prep_tier1 jdk_tier1 langtools_tier1 hotspot_tier1 summary_tier1
92+
93+
prep_tier1:
94+
@rm -rf $(TIER1_STATUS_FILE)
95+
96+
# This relies on jdk_tier1, langtools_tier1, hotspot_tier1 producing
97+
# Stats.txt (summary) and exitcode.txt files.
98+
summary_tier1:
99+
@(EXIT_VAL=0; \
100+
echo ""; \
101+
echo "-------------- Test Summary ------------"; \
102+
echo ""; \
103+
for test_dir in $$(find "$(ALT_OUTPUTDIR)" -type d -name \*_tier1); do \
104+
$(call SUBDIR_SUMMARY, $${test_dir}); \
105+
EXIT_VAL=$$(expr $${EXIT_VAL} + $$(cat $${test_dir}/exitcode.txt)); \
106+
done; \
107+
echo $${EXIT_VAL} > $(TIER1_STATUS_FILE); \
108+
echo "For details see:"; \
109+
echo $(TIER1_TESTOUTPUT); \
110+
echo ""; \
111+
echo "-------------- Test Summary ------------"; \
112+
echo "")
113+
69114
#
70115
# jtreg_tests
71116
#
@@ -95,6 +140,6 @@ jtreg_tests:
95140
################################################################
96141

97142
# Phony targets (e.g. these are not filenames)
98-
.PHONY: all clean
143+
.PHONY: all clean summary_tier1 prep_tier1
99144

100145
################################################################

0 commit comments

Comments
 (0)