test/Makefile

changeset 2447
ef851705e3e1
parent 1391
7de830a4c219
child 2458
daa47f8cf745
     1.1 --- a/test/Makefile	Thu Jul 25 16:23:25 2019 +0100
     1.2 +++ b/test/Makefile	Thu Apr 25 14:01:57 2019 +0200
     1.3 @@ -50,6 +50,22 @@
     1.4  fi
     1.5  endef
     1.6  
     1.7 +# Macro to print a summary for a given test subdirectory
     1.8 +define SUBDIR_SUMMARY # subdirectory to print summary
     1.9 +if [ -d $1 ] ; then \
    1.10 +  if [ -r $1/Stats.txt ] ; then \
    1.11 +    cat $1/Stats.txt; \
    1.12 +    echo ""; \
    1.13 +  else \
    1.14 +    echo "ERROR: File does not exist: $1/Stats.txt"; \
    1.15 +    exit 1; \
    1.16 +  fi; \
    1.17 +else \
    1.18 +  echo "WARNING: Expected directory does not exist: $1"; \
    1.19 +  echo "         Test summary might be incorrect."; \
    1.20 +fi
    1.21 +endef
    1.22 +
    1.23  # Default test target (core)
    1.24  default: jdk_core langtools_jtreg
    1.25  
    1.26 @@ -58,7 +74,7 @@
    1.27  
    1.28  # Test targets
    1.29  langtools_% :
    1.30 -	@$(NO_STOPPING)$(call SUBDIR_TEST, $(LANGTOOLS_DIR), JT_JAVA=$(PRODUCT_HOME) JTREG_HOME=$(JT_HOME) TEST="$(subst langtools_,,$@)" $(subst langtools_,,$@))
    1.31 +	@$(NO_STOPPING)$(call SUBDIR_TEST, $(LANGTOOLS_DIR), JT_JAVA=$(PRODUCT_HOME) JTREG_HOME=$(JT_HOME) UNIQUE_DIR="$@" TEST="$(subst langtools_,,$@)" $(subst langtools_,,$@))
    1.32  
    1.33  jdk_% core_%s svc_%:
    1.34  	@$(NO_STOPPING)$(call SUBDIR_TEST, $(JDK_DIR), TEST="$@" $@)
    1.35 @@ -66,6 +82,35 @@
    1.36  hotspot_%:
    1.37  	@$(NO_STOPPING)$(call SUBDIR_TEST, $(HOTSPOT_DIR), TEST="$@" $@)
    1.38  
    1.39 +# Variables for tier1 testing
    1.40 +TIER1_TESTOUTPUT="$(ALT_OUTPUTDIR)/testoutput"
    1.41 +TIER1_STATUS_FILE="$(TIER1_TESTOUTPUT)/tier1_exitcode.txt"
    1.42 +
    1.43 +# Note: Test failures are handled via summary_tier1 as the
    1.44 +#       tier1 targets are never aborted even if tests fail.
    1.45 +tier1: prep_tier1 jdk_tier1 langtools_tier1 hotspot_tier1 summary_tier1
    1.46 +
    1.47 +prep_tier1:
    1.48 +	@rm -rf $(TIER1_STATUS_FILE)
    1.49 +
    1.50 +# This relies on jdk_tier1, langtools_tier1, hotspot_tier1 producing
    1.51 +# Stats.txt (summary) and exitcode.txt files.
    1.52 +summary_tier1:
    1.53 +	@(EXIT_VAL=0; \
    1.54 +	  echo ""; \
    1.55 +	  echo "-------------- Test Summary ------------"; \
    1.56 +	  echo ""; \
    1.57 +	  for test_dir in $$(find "$(ALT_OUTPUTDIR)" -type d -name \*_tier1); do \
    1.58 +	    $(call SUBDIR_SUMMARY, $${test_dir}); \
    1.59 +	    EXIT_VAL=$$(expr $${EXIT_VAL} + $$(cat $${test_dir}/exitcode.txt)); \
    1.60 +	  done; \
    1.61 +	  echo $${EXIT_VAL} > $(TIER1_STATUS_FILE); \
    1.62 +	  echo "For details see:"; \
    1.63 +	  echo $(TIER1_TESTOUTPUT); \
    1.64 +	  echo ""; \
    1.65 +	  echo "-------------- Test Summary ------------"; \
    1.66 +	  echo "")
    1.67 +
    1.68  #
    1.69  # jtreg_tests
    1.70  #
    1.71 @@ -95,6 +140,6 @@
    1.72  ################################################################
    1.73  
    1.74  # Phony targets (e.g. these are not filenames)
    1.75 -.PHONY: all clean
    1.76 +.PHONY: all clean summary_tier1 prep_tier1
    1.77  
    1.78  ################################################################

mercurial