< prev index next >

make/RunTests.gmk

Print this page
rev 53836 : 8219395: integrate gcov w/ run-test
Reviewed-by: duke


  95   JTREG_TOPDIR := $(CUSTOM_ROOT)
  96 endif
  97 
  98 JTREG_FAILURE_HANDLER_DIR := $(TEST_IMAGE_DIR)/failure_handler
  99 JTREG_FAILURE_HANDLER := $(JTREG_FAILURE_HANDLER_DIR)/jtregFailureHandler.jar
 100 
 101 ifneq ($(wildcard $(JTREG_FAILURE_HANDLER)), )
 102   JTREG_FAILURE_HANDLER_OPTIONS := \
 103       -timeoutHandlerDir:$(JTREG_FAILURE_HANDLER) \
 104       -observerDir:$(JTREG_FAILURE_HANDLER) \
 105       -timeoutHandler:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler \
 106       -observer:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver \
 107       -timeoutHandlerTimeout:0
 108 endif
 109 
 110 GTEST_LAUNCHER_DIRS := $(patsubst %/gtestLauncher, %, \
 111     $(wildcard $(TEST_IMAGE_DIR)/hotspot/gtest/*/gtestLauncher))
 112 GTEST_VARIANTS := $(strip $(patsubst $(TEST_IMAGE_DIR)/hotspot/gtest/%, %, \
 113     $(GTEST_LAUNCHER_DIRS)))
 114 



 115 ifeq ($(TEST_OPTS_JCOV), true)
 116   JCOV_OUTPUT_DIR := $(TEST_RESULTS_DIR)/jcov-output
 117   JCOV_GRABBER_LOG := $(JCOV_OUTPUT_DIR)/grabber.log
 118   JCOV_RESULT_FILE := $(JCOV_OUTPUT_DIR)/result.xml
 119   JCOV_REPORT := $(JCOV_OUTPUT_DIR)/report
 120   JCOV_MEM_OPTIONS := -Xms64m -Xmx4g
 121 
 122   # Replace our normal test JDK with the JCov image.
 123   JDK_UNDER_TEST := $(JCOV_IMAGE_DIR)
 124 
 125   JCOV_ENVIRONMENT := JAVA_TOOL_OPTIONS="$(JCOV_MEM_OPTIONS)" \
 126       _JAVA_OPTIONS="$(JCOV_MEM_OPTIONS)"
 127   JTREG_JCOV_OPTIONS := -e:JAVA_TOOL_OPTIONS='$(JCOV_MEM_OPTIONS)' \
 128       -e:_JAVA_OPTIONS='$(JCOV_MEM_OPTIONS)'
 129 endif
 130 






 131 ################################################################################
 132 # Optionally create AOT libraries for specified modules before running tests.
 133 # Note, this could not be done during JDK build time.
 134 ################################################################################
 135 
 136 # Note, this could not be done during JDK build time.
 137 
 138 # Parameter 1 is the name of the rule.
 139 #
 140 # Remaining parameters are named arguments.
 141 #   MODULE      The module to generate a library for
 142 #   BIN         Output directory in which to put the library
 143 #   VM_OPTIONS  List of JVM arguments to use when creating library
 144 #   OPTIONS_VAR Name of variable to put AOT java options in
 145 #   PREREQS_VAR Name of variable to put all AOT prerequisite rule targets in
 146 #               for test rules to depend on
 147 #
 148 SetupAotModule = $(NamedParamsMacroTemplate)
 149 define SetupAotModuleBody
 150   $1_AOT_LIB := $$($1_BIN)/$$(call SHARED_LIBRARY,$$($1_MODULE))


 153   # Create jaotc flags.
 154   # VM flags which don't affect AOT code generation are filtered out:
 155   # -Xcomp, -XX:+-TieredCompilation
 156   $1_JAOTC_OPTS := \
 157       -J-Xmx4g --info \
 158       $$(addprefix -J, $$(filter-out -Xcomp %TieredCompilation, $$($1_VM_OPTIONS))) \
 159       $$(addprefix --compile-commands$(SPACE), $$($1_AOT_CCLIST)) \
 160       --linker-path $$(LD_JAOTC) \
 161       #
 162 
 163   ifneq ($$(filter -ea, $$($1_VM_OPTIONS)), )
 164     $1_JAOTC_OPTS += --compile-with-assertions
 165   endif
 166 
 167   $$($1_AOT_LIB): $$(JDK_UNDER_TEST)/release \
 168       $$(call DependOnVariable, $1_JAOTC_OPTS) \
 169       $$(call DependOnVariable, JDK_UNDER_TEST)
 170         $$(call LogWarn, Generating $$(patsubst $$(OUTPUTDIR)/%, %, $$@))
 171         $$(call MakeTargetDir)
 172         $$(call ExecuteWithLog, $$@, \

 173             $$(FIXPATH) $$(JDK_UNDER_TEST)/bin/jaotc \
 174                 $$($1_JAOTC_OPTS) --output $$@ --module $$($1_MODULE) \
 175         )
 176         $$(call ExecuteWithLog, $$@.check, \
 177             $$(FIXPATH) $$(JDK_UNDER_TEST)/bin/java \
 178                 $$($1_VM_OPTIONS) -XX:+UnlockDiagnosticVMOptions \
 179                 -XX:+PrintAOT -XX:+UseAOTStrictLoading \
 180                 -XX:AOTLibrary=$$@ -version \
 181                  > $$@.verify-aot \
 182         )
 183 
 184   $1_AOT_OPTIONS += -XX:AOTLibrary=$$($1_AOT_LIB)
 185   $1_AOT_TARGETS += $$($1_AOT_LIB)
 186 endef
 187 
 188 # Parameter 1 is the name of the rule.
 189 #
 190 # Remaining parameters are named arguments.
 191 #   MODULES     The modules to generate a library for
 192 #   VM_OPTIONS  List of JVM arguments to use when creating libraries


 890 
 891   ifneq ($$(JTREG_AOT_MODULES), )
 892     $$(eval $$(call SetupAot, $1, \
 893         MODULES := $$(JTREG_AOT_MODULES), \
 894         VM_OPTIONS := $$(JTREG_VM_OPTIONS) $$(JTREG_JAVA_OPTIONS), \
 895     ))
 896   endif
 897 
 898   ifneq ($$($1_AOT_OPTIONS), )
 899     $1_JTREG_BASIC_OPTIONS += -vmoptions:"$$($1_AOT_OPTIONS)"
 900   endif
 901 
 902   clean-workdir-$1:
 903         $$(RM) -r $$($1_TEST_SUPPORT_DIR)
 904 
 905   run-test-$1: pre-run-test clean-workdir-$1 $$($1_AOT_TARGETS)
 906         $$(call LogWarn)
 907         $$(call LogWarn, Running test '$$($1_TEST)')
 908         $$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
 909         $$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/jtreg, \
 910             $$(JCOV_ENVIRONMENT) \
 911             $$(JAVA) $$($1_JTREG_LAUNCHER_OPTIONS) \
 912                 -Dprogram=jtreg -jar $$(JT_HOME)/lib/jtreg.jar \
 913                 $$($1_JTREG_BASIC_OPTIONS) \
 914                 -testjdk:$$(JDK_UNDER_TEST) \
 915                 -dir:$$(JTREG_TOPDIR) \
 916                 -reportDir:$$($1_TEST_RESULTS_DIR) \
 917                 -workDir:$$($1_TEST_SUPPORT_DIR) \
 918                 $$(JTREG_OPTIONS) \
 919                 $$(JTREG_FAILURE_HANDLER_OPTIONS) \
 920                 $$(JTREG_JCOV_OPTIONS) \
 921                 $$($1_TEST_NAME) \
 922             && $$(ECHO) $$$$? > $$($1_EXITCODE) \
 923             || $$(ECHO) $$$$? > $$($1_EXITCODE) \
 924         )
 925 
 926   $1_RESULT_FILE := $$($1_TEST_RESULTS_DIR)/text/stats.txt
 927 
 928   parse-test-$1: run-test-$1
 929         $$(call LogWarn, Finished running test '$$($1_TEST)')
 930         $$(call LogWarn, Test report is stored in $$(strip \
 931             $$(subst $$(TOPDIR)/, , $$($1_TEST_RESULTS_DIR))))
 932         $$(if $$(wildcard $$($1_RESULT_FILE)), \
 933           $$(eval $1_PASSED := $$(shell $$(AWK) '{ gsub(/[,;]/, ""); \
 934               for (i=1; i<=NF; i++) { if ($$$$i == "passed:") \
 935               print $$$$(i+1) } }' $$($1_RESULT_FILE))) \
 936           $$(if $$($1_PASSED), , $$(eval $1_PASSED := 0)) \
 937           $$(eval $1_FAILED := $$(shell $$(AWK) '{gsub(/[,;]/, ""); \
 938               for (i=1; i<=NF; i++) { if ($$$$i == "failed:") \
 939               print $$$$(i+1) } }' $$($1_RESULT_FILE))) \
 940           $$(if $$($1_FAILED), , $$(eval $1_FAILED := 0)) \




  95   JTREG_TOPDIR := $(CUSTOM_ROOT)
  96 endif
  97 
  98 JTREG_FAILURE_HANDLER_DIR := $(TEST_IMAGE_DIR)/failure_handler
  99 JTREG_FAILURE_HANDLER := $(JTREG_FAILURE_HANDLER_DIR)/jtregFailureHandler.jar
 100 
 101 ifneq ($(wildcard $(JTREG_FAILURE_HANDLER)), )
 102   JTREG_FAILURE_HANDLER_OPTIONS := \
 103       -timeoutHandlerDir:$(JTREG_FAILURE_HANDLER) \
 104       -observerDir:$(JTREG_FAILURE_HANDLER) \
 105       -timeoutHandler:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler \
 106       -observer:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver \
 107       -timeoutHandlerTimeout:0
 108 endif
 109 
 110 GTEST_LAUNCHER_DIRS := $(patsubst %/gtestLauncher, %, \
 111     $(wildcard $(TEST_IMAGE_DIR)/hotspot/gtest/*/gtestLauncher))
 112 GTEST_VARIANTS := $(strip $(patsubst $(TEST_IMAGE_DIR)/hotspot/gtest/%, %, \
 113     $(GTEST_LAUNCHER_DIRS)))
 114 
 115 COV_ENVIRONMENT :=
 116 JTREG_COV_OPTIONS :=
 117 
 118 ifeq ($(TEST_OPTS_JCOV), true)
 119   JCOV_OUTPUT_DIR := $(TEST_RESULTS_DIR)/jcov-output
 120   JCOV_GRABBER_LOG := $(JCOV_OUTPUT_DIR)/grabber.log
 121   JCOV_RESULT_FILE := $(JCOV_OUTPUT_DIR)/result.xml
 122   JCOV_REPORT := $(JCOV_OUTPUT_DIR)/report
 123   JCOV_MEM_OPTIONS := -Xms64m -Xmx4g
 124 
 125   # Replace our normal test JDK with the JCov image.
 126   JDK_UNDER_TEST := $(JCOV_IMAGE_DIR)
 127 
 128   COV_ENVIRONMENT += JAVA_TOOL_OPTIONS="$(JCOV_MEM_OPTIONS)" \
 129       _JAVA_OPTIONS="$(JCOV_MEM_OPTIONS)"
 130   JTREG_COV_OPTIONS += -e:JAVA_TOOL_OPTIONS='$(JCOV_MEM_OPTIONS)' \
 131       -e:_JAVA_OPTIONS='$(JCOV_MEM_OPTIONS)'
 132 endif
 133 
 134 ifeq ($(GCOV_ENABLED), true)
 135   GCOV_OUTPUT_DIR := $(TEST_RESULTS_DIR)/gcov-output
 136   COV_ENVIRONMENT += GCOV_PREFIX="$(GCOV_OUTPUT_DIR)"
 137   JTREG_COV_OPTIONS += -e:GCOV_PREFIX="$(GCOV_OUTPUT_DIR)"
 138 endif
 139 
 140 ################################################################################
 141 # Optionally create AOT libraries for specified modules before running tests.
 142 # Note, this could not be done during JDK build time.
 143 ################################################################################
 144 
 145 # Note, this could not be done during JDK build time.
 146 
 147 # Parameter 1 is the name of the rule.
 148 #
 149 # Remaining parameters are named arguments.
 150 #   MODULE      The module to generate a library for
 151 #   BIN         Output directory in which to put the library
 152 #   VM_OPTIONS  List of JVM arguments to use when creating library
 153 #   OPTIONS_VAR Name of variable to put AOT java options in
 154 #   PREREQS_VAR Name of variable to put all AOT prerequisite rule targets in
 155 #               for test rules to depend on
 156 #
 157 SetupAotModule = $(NamedParamsMacroTemplate)
 158 define SetupAotModuleBody
 159   $1_AOT_LIB := $$($1_BIN)/$$(call SHARED_LIBRARY,$$($1_MODULE))


 162   # Create jaotc flags.
 163   # VM flags which don't affect AOT code generation are filtered out:
 164   # -Xcomp, -XX:+-TieredCompilation
 165   $1_JAOTC_OPTS := \
 166       -J-Xmx4g --info \
 167       $$(addprefix -J, $$(filter-out -Xcomp %TieredCompilation, $$($1_VM_OPTIONS))) \
 168       $$(addprefix --compile-commands$(SPACE), $$($1_AOT_CCLIST)) \
 169       --linker-path $$(LD_JAOTC) \
 170       #
 171 
 172   ifneq ($$(filter -ea, $$($1_VM_OPTIONS)), )
 173     $1_JAOTC_OPTS += --compile-with-assertions
 174   endif
 175 
 176   $$($1_AOT_LIB): $$(JDK_UNDER_TEST)/release \
 177       $$(call DependOnVariable, $1_JAOTC_OPTS) \
 178       $$(call DependOnVariable, JDK_UNDER_TEST)
 179         $$(call LogWarn, Generating $$(patsubst $$(OUTPUTDIR)/%, %, $$@))
 180         $$(call MakeTargetDir)
 181         $$(call ExecuteWithLog, $$@, \
 182             $((COV_ENVIRONMENT) \
 183             $$(FIXPATH) $$(JDK_UNDER_TEST)/bin/jaotc \
 184                 $$($1_JAOTC_OPTS) --output $$@ --module $$($1_MODULE) \
 185         )
 186         $$(call ExecuteWithLog, $$@.check, \
 187             $$(FIXPATH) $$(JDK_UNDER_TEST)/bin/java \
 188                 $$($1_VM_OPTIONS) -XX:+UnlockDiagnosticVMOptions \
 189                 -XX:+PrintAOT -XX:+UseAOTStrictLoading \
 190                 -XX:AOTLibrary=$$@ -version \
 191                  > $$@.verify-aot \
 192         )
 193 
 194   $1_AOT_OPTIONS += -XX:AOTLibrary=$$($1_AOT_LIB)
 195   $1_AOT_TARGETS += $$($1_AOT_LIB)
 196 endef
 197 
 198 # Parameter 1 is the name of the rule.
 199 #
 200 # Remaining parameters are named arguments.
 201 #   MODULES     The modules to generate a library for
 202 #   VM_OPTIONS  List of JVM arguments to use when creating libraries


 900 
 901   ifneq ($$(JTREG_AOT_MODULES), )
 902     $$(eval $$(call SetupAot, $1, \
 903         MODULES := $$(JTREG_AOT_MODULES), \
 904         VM_OPTIONS := $$(JTREG_VM_OPTIONS) $$(JTREG_JAVA_OPTIONS), \
 905     ))
 906   endif
 907 
 908   ifneq ($$($1_AOT_OPTIONS), )
 909     $1_JTREG_BASIC_OPTIONS += -vmoptions:"$$($1_AOT_OPTIONS)"
 910   endif
 911 
 912   clean-workdir-$1:
 913         $$(RM) -r $$($1_TEST_SUPPORT_DIR)
 914 
 915   run-test-$1: pre-run-test clean-workdir-$1 $$($1_AOT_TARGETS)
 916         $$(call LogWarn)
 917         $$(call LogWarn, Running test '$$($1_TEST)')
 918         $$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
 919         $$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/jtreg, \
 920             $$(COV_ENVIRONMENT) \
 921             $$(JAVA) $$($1_JTREG_LAUNCHER_OPTIONS) \
 922                 -Dprogram=jtreg -jar $$(JT_HOME)/lib/jtreg.jar \
 923                 $$($1_JTREG_BASIC_OPTIONS) \
 924                 -testjdk:$$(JDK_UNDER_TEST) \
 925                 -dir:$$(JTREG_TOPDIR) \
 926                 -reportDir:$$($1_TEST_RESULTS_DIR) \
 927                 -workDir:$$($1_TEST_SUPPORT_DIR) \
 928                 $$(JTREG_OPTIONS) \
 929                 $$(JTREG_FAILURE_HANDLER_OPTIONS) \
 930                 $$(JTREG_COV_OPTIONS) \
 931                 $$($1_TEST_NAME) \
 932             && $$(ECHO) $$$$? > $$($1_EXITCODE) \
 933             || $$(ECHO) $$$$? > $$($1_EXITCODE) \
 934         )
 935 
 936   $1_RESULT_FILE := $$($1_TEST_RESULTS_DIR)/text/stats.txt
 937 
 938   parse-test-$1: run-test-$1
 939         $$(call LogWarn, Finished running test '$$($1_TEST)')
 940         $$(call LogWarn, Test report is stored in $$(strip \
 941             $$(subst $$(TOPDIR)/, , $$($1_TEST_RESULTS_DIR))))
 942         $$(if $$(wildcard $$($1_RESULT_FILE)), \
 943           $$(eval $1_PASSED := $$(shell $$(AWK) '{ gsub(/[,;]/, ""); \
 944               for (i=1; i<=NF; i++) { if ($$$$i == "passed:") \
 945               print $$$$(i+1) } }' $$($1_RESULT_FILE))) \
 946           $$(if $$($1_PASSED), , $$(eval $1_PASSED := 0)) \
 947           $$(eval $1_FAILED := $$(shell $$(AWK) '{gsub(/[,;]/, ""); \
 948               for (i=1; i<=NF; i++) { if ($$$$i == "failed:") \
 949               print $$$$(i+1) } }' $$($1_RESULT_FILE))) \
 950           $$(if $$($1_FAILED), , $$(eval $1_FAILED := 0)) \


< prev index next >