8191923: Save run-test summary to file

Reviewed-by: tbell
This commit is contained in:
Magnus Ihse Bursie 2017-11-27 22:22:03 +01:00
parent 030e675ed3
commit ab02ac3528

View File

@ -37,6 +37,7 @@ $(eval $(call IncludeCustomExtension, RunTests.gmk))
TEST_RESULTS_DIR := $(OUTPUTDIR)/test-results TEST_RESULTS_DIR := $(OUTPUTDIR)/test-results
TEST_SUPPORT_DIR := $(OUTPUTDIR)/test-support TEST_SUPPORT_DIR := $(OUTPUTDIR)/test-support
TEST_SUMMARY := $(TEST_RESULTS_DIR)/test-summary.txt
ifeq ($(CUSTOM_ROOT), ) ifeq ($(CUSTOM_ROOT), )
JTREG_TOPDIR := $(TOPDIR) JTREG_TOPDIR := $(TOPDIR)
@ -521,42 +522,46 @@ endif
TEST_FAILURE := false TEST_FAILURE := false
run-test: $(TARGETS) run-test: $(TARGETS)
# Print a table of the result of all tests run and their result # Create and print a table of the result of all tests run
$(ECHO) $(RM) $(TEST_SUMMARY).old 2> /dev/null
$(ECHO) ============================== $(MV) $(TEST_SUMMARY) $(TEST_SUMMARY).old 2> /dev/null || true
$(ECHO) Test summary $(ECHO) >> $(TEST_SUMMARY) ==============================
$(ECHO) ============================== $(ECHO) >> $(TEST_SUMMARY) Test summary
$(PRINTF) "%2s %-49s %5s %5s %5s %5s %2s\n" " " TEST \ $(ECHO) >> $(TEST_SUMMARY) ==============================
TOTAL PASS FAIL ERROR " " $(PRINTF) >> $(TEST_SUMMARY) "%2s %-49s %5s %5s %5s %5s %2s\n" " " \
TEST TOTAL PASS FAIL ERROR " "
$(foreach test, $(TESTS_TO_RUN), \ $(foreach test, $(TESTS_TO_RUN), \
$(eval TEST_ID := $(shell $(ECHO) $(strip $(test)) | \ $(eval TEST_ID := $(shell $(ECHO) $(strip $(test)) | \
$(TR) -cs '[a-z][A-Z][0-9]\n' '_')) \ $(TR) -cs '[a-z][A-Z][0-9]\n' '_')) \
$(eval NAME_PATTERN := $(shell $(ECHO) $(test) | $(TR) -c \\n _)) \ $(eval NAME_PATTERN := $(shell $(ECHO) $(test) | $(TR) -c \\n _)) \
$(if $(filter __________________________________________________%, $(NAME_PATTERN)), \ $(if $(filter __________________________________________________%, $(NAME_PATTERN)), \
$(eval TEST_NAME := ) \ $(eval TEST_NAME := ) \
$(PRINTF) "%2s %-49s\n" " " "$(test)" $(NEWLINE) \ $(PRINTF) >> $(TEST_SUMMARY) "%2s %-49s\n" " " "$(test)" $(NEWLINE) \
, \ , \
$(eval TEST_NAME := $(test)) \ $(eval TEST_NAME := $(test)) \
) \ ) \
$(if $(filter $($(TEST_ID)_PASSED), $($(TEST_ID)_TOTAL)), \ $(if $(filter $($(TEST_ID)_PASSED), $($(TEST_ID)_TOTAL)), \
$(PRINTF) "%2s %-49s %5d %5d %5d %5d %2s\n" " " "$(TEST_NAME)" \ $(PRINTF) >> $(TEST_SUMMARY) "%2s %-49s %5d %5d %5d %5d %2s\n" \
$($(TEST_ID)_TOTAL) $($(TEST_ID)_PASSED) $($(TEST_ID)_FAILED) \ " " "$(TEST_NAME)" $($(TEST_ID)_TOTAL) $($(TEST_ID)_PASSED) \
$($(TEST_ID)_ERROR) " " $(NEWLINE) \ $($(TEST_ID)_FAILED) $($(TEST_ID)_ERROR) " " $(NEWLINE) \
, \ , \
$(PRINTF) "%2s %-49s %5d %5d %5d %5d %2s\n" ">>" "$(TEST_NAME)" \ $(PRINTF) >> $(TEST_SUMMARY) "%2s %-49s %5d %5d %5d %5d %2s\n" \
$($(TEST_ID)_TOTAL) $($(TEST_ID)_PASSED) $($(TEST_ID)_FAILED) \ ">>" "$(TEST_NAME)" $($(TEST_ID)_TOTAL) $($(TEST_ID)_PASSED) \
$($(TEST_ID)_ERROR) "<<" $(NEWLINE) \ $($(TEST_ID)_FAILED) $($(TEST_ID)_ERROR) "<<" $(NEWLINE) \
$(eval TEST_FAILURE := true) \ $(eval TEST_FAILURE := true) \
) \ ) \
) )
$(ECHO) ============================== $(ECHO) >> $(TEST_SUMMARY) ==============================
$(if $(filter true, $(TEST_FAILURE)), \ $(if $(filter true, $(TEST_FAILURE)), \
$(ECHO) TEST FAILURE $(NEWLINE) \ $(ECHO) >> $(TEST_SUMMARY) TEST FAILURE $(NEWLINE) \
$(MKDIR) -p $(MAKESUPPORT_OUTPUTDIR) $(NEWLINE) \
$(TOUCH) $(MAKESUPPORT_OUTPUTDIR)/exit-with-error \ $(TOUCH) $(MAKESUPPORT_OUTPUTDIR)/exit-with-error \
, \ , \
$(ECHO) TEST SUCCESS \ $(ECHO) >> $(TEST_SUMMARY) TEST SUCCESS \
) )
$(ECHO) $(ECHO)
$(CAT) $(TEST_SUMMARY)
$(ECHO)
################################################################################ ################################################################################