make/RunTests.gmk
changeset 53464 650527b39f00
parent 53460 65c813da7c65
child 53465 d982794784f1
equal deleted inserted replaced
53463:b2d1c3b0bd31 53464:650527b39f00
    43     TEST_OPTS := VM_OPTIONS=$(TEST_VM_OPTS)
    43     TEST_OPTS := VM_OPTIONS=$(TEST_VM_OPTS)
    44   endif
    44   endif
    45 endif
    45 endif
    46 
    46 
    47 $(eval $(call ParseKeywordVariable, TEST_OPTS, \
    47 $(eval $(call ParseKeywordVariable, TEST_OPTS, \
    48     SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR AOT_MODULES JCOV, \
    48     SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR JCOV, \
    49     STRING_KEYWORDS := VM_OPTIONS JAVA_OPTIONS, \
    49     STRING_KEYWORDS := VM_OPTIONS JAVA_OPTIONS AOT_MODULES, \
    50 ))
    50 ))
    51 
    51 
    52 # Helper function to propagate TEST_OPTS values.
    52 # Helper function to propagate TEST_OPTS values.
    53 #
    53 #
    54 # Note: No spaces are allowed around the arguments.
    54 # Note: No spaces are allowed around the arguments.
   102       -timeoutHandler:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler \
   102       -timeoutHandler:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler \
   103       -observer:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver \
   103       -observer:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver \
   104       -timeoutHandlerTimeout:0
   104       -timeoutHandlerTimeout:0
   105 endif
   105 endif
   106 
   106 
   107 GTEST_LAUNCHER_DIRS := $(patsubst %/gtestLauncher, %, $(wildcard $(TEST_IMAGE_DIR)/hotspot/gtest/*/gtestLauncher))
   107 GTEST_LAUNCHER_DIRS := $(patsubst %/gtestLauncher, %, \
   108 GTEST_VARIANTS := $(strip $(patsubst $(TEST_IMAGE_DIR)/hotspot/gtest/%, %, $(GTEST_LAUNCHER_DIRS)))
   108     $(wildcard $(TEST_IMAGE_DIR)/hotspot/gtest/*/gtestLauncher))
       
   109 GTEST_VARIANTS := $(strip $(patsubst $(TEST_IMAGE_DIR)/hotspot/gtest/%, %, \
       
   110     $(GTEST_LAUNCHER_DIRS)))
   109 
   111 
   110 ################################################################################
   112 ################################################################################
   111 # Optionally create AOT libraries for specified modules before running tests.
   113 # Optionally create AOT libraries for specified modules before running tests.
   112 # Note, this could not be done during JDK build time.
   114 # Note, this could not be done during JDK build time.
   113 ################################################################################
   115 ################################################################################
   128 define SetupAotModuleBody
   130 define SetupAotModuleBody
   129   $1_AOT_LIB := $$($1_BIN)/$$(call SHARED_LIBRARY,$$($1_MODULE))
   131   $1_AOT_LIB := $$($1_BIN)/$$(call SHARED_LIBRARY,$$($1_MODULE))
   130   $1_AOT_CCLIST := $$(wildcard $$(TOPDIR)/test/hotspot/jtreg/compiler/aot/scripts/$$($1_MODULE)-list.txt)
   132   $1_AOT_CCLIST := $$(wildcard $$(TOPDIR)/test/hotspot/jtreg/compiler/aot/scripts/$$($1_MODULE)-list.txt)
   131 
   133 
   132   # Create jaotc flags.
   134   # Create jaotc flags.
   133   # VM flags which don't affect AOT code generation are filtered out: -Xcomp, -XX:+-TieredCompilation
   135   # VM flags which don't affect AOT code generation are filtered out:
       
   136   # -Xcomp, -XX:+-TieredCompilation
   134   $1_JAOTC_OPTS := \
   137   $1_JAOTC_OPTS := \
   135       -J-Xmx4g --info \
   138       -J-Xmx4g --info \
   136       $$(addprefix -J, $$(filter-out -Xcomp %TieredCompilation, $$($1_VM_OPTIONS))) \
   139       $$(addprefix -J, $$(filter-out -Xcomp %TieredCompilation, $$($1_VM_OPTIONS))) \
   137       $$(addprefix --compile-commands$(SPACE), $$($1_AOT_CCLIST)) \
   140       $$(addprefix --compile-commands$(SPACE), $$($1_AOT_CCLIST)) \
   138       --linker-path $$(LD_JAOTC) \
   141       --linker-path $$(LD_JAOTC) \
   243 
   246 
   244 $(eval $(call SetTestOpt,JOBS,JTREG))
   247 $(eval $(call SetTestOpt,JOBS,JTREG))
   245 $(eval $(call SetTestOpt,TIMEOUT_FACTOR,JTREG))
   248 $(eval $(call SetTestOpt,TIMEOUT_FACTOR,JTREG))
   246 
   249 
   247 $(eval $(call ParseKeywordVariable, JTREG, \
   250 $(eval $(call ParseKeywordVariable, JTREG, \
   248     SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR TEST_MODE ASSERT VERBOSE RETAIN MAX_MEM \
   251     SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR TEST_MODE ASSERT VERBOSE RETAIN \
   249         EXTRA_PROBLEM_LISTS KEYWORDS AOT_MODULES, \
   252         MAX_MEM, \
   250     STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS, \
   253     STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS KEYWORDS \
       
   254         EXTRA_PROBLEM_LISTS AOT_MODULES, \
   251 ))
   255 ))
   252 
   256 
   253 ifneq ($(JTREG), )
   257 ifneq ($(JTREG), )
   254   # Inform the user
   258   # Inform the user
   255   $(info Running tests using JTREG control variable '$(JTREG)')
   259   $(info Running tests using JTREG control variable '$(JTREG)')
   260 $(eval $(call SetTestOpt,VM_OPTIONS,GTEST))
   264 $(eval $(call SetTestOpt,VM_OPTIONS,GTEST))
   261 $(eval $(call SetTestOpt,JAVA_OPTIONS,GTEST))
   265 $(eval $(call SetTestOpt,JAVA_OPTIONS,GTEST))
   262 $(eval $(call SetTestOpt,AOT_MODULES,GTEST))
   266 $(eval $(call SetTestOpt,AOT_MODULES,GTEST))
   263 
   267 
   264 $(eval $(call ParseKeywordVariable, GTEST, \
   268 $(eval $(call ParseKeywordVariable, GTEST, \
   265     SINGLE_KEYWORDS := REPEAT AOT_MODULES, \
   269     SINGLE_KEYWORDS := REPEAT, \
   266     STRING_KEYWORDS := OPTIONS VM_OPTIONS JAVA_OPTIONS, \
   270     STRING_KEYWORDS := OPTIONS VM_OPTIONS JAVA_OPTIONS AOT_MODULES, \
   267 ))
   271 ))
   268 
   272 
   269 ifneq ($(GTEST), )
   273 ifneq ($(GTEST), )
   270   # Inform the user
   274   # Inform the user
   271   $(info Running tests using GTEST control variable '$(GTEST)')
   275   $(info Running tests using GTEST control variable '$(GTEST)')
   276 $(eval $(call SetTestOpt,VM_OPTIONS,MICRO))
   280 $(eval $(call SetTestOpt,VM_OPTIONS,MICRO))
   277 $(eval $(call SetTestOpt,JAVA_OPTIONS,MICRO))
   281 $(eval $(call SetTestOpt,JAVA_OPTIONS,MICRO))
   278 
   282 
   279 $(eval $(call ParseKeywordVariable, MICRO, \
   283 $(eval $(call ParseKeywordVariable, MICRO, \
   280     SINGLE_KEYWORDS := ITER FORK TIME WARMUP_ITER WARMUP_TIME, \
   284     SINGLE_KEYWORDS := ITER FORK TIME WARMUP_ITER WARMUP_TIME, \
   281     STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS RESULTS_FORMAT TEST_JDK BENCHMARKS_JAR, \
   285     STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS RESULTS_FORMAT TEST_JDK \
       
   286         BENCHMARKS_JAR, \
   282 ))
   287 ))
   283 
   288 
   284 ifneq ($(MICRO), )
   289 ifneq ($(MICRO), )
   285   # Inform the user
   290   # Inform the user
   286   $(info Running tests using MICRO control variable '$(MICRO)')
   291   $(info Running tests using MICRO control variable '$(MICRO)')
   342   )
   347   )
   343 endef
   348 endef
   344 
   349 
   345 # Helper function to determine if a test specification is a microbenchmark test
   350 # Helper function to determine if a test specification is a microbenchmark test
   346 #
   351 #
   347 # It is a microbenchmark test if it is either "micro", or "micro:" followed by an optional
   352 # It is a microbenchmark test if it is either "micro", or "micro:" followed by
   348 # test filter string.
   353 # an optional test filter string.
   349 define ParseMicroTestSelection
   354 define ParseMicroTestSelection
   350   $(if $(filter micro%, $1), \
   355   $(if $(filter micro%, $1), \
   351     $(if $(filter micro, $1), \
   356     $(if $(filter micro, $1), \
   352       micro:all \
   357       micro:all \
   353     , \
   358     , \
   433 endef
   438 endef
   434 
   439 
   435 # Helper function to determine if a test specification is a special test
   440 # Helper function to determine if a test specification is a special test
   436 #
   441 #
   437 # It is a special test if it is "special:" followed by a test name,
   442 # It is a special test if it is "special:" followed by a test name,
   438 # if it is "make:" or "make-" followed by a make test, or any of the special test names
   443 # if it is "make:" or "make-" followed by a make test, or any of the special
   439 # as a single word.
   444 # test names as a single word.
   440 define ParseSpecialTestSelection
   445 define ParseSpecialTestSelection
   441   $(if $(filter special:%, $1), \
   446   $(if $(filter special:%, $1), \
   442     $1 \
   447     $1 \
   443   ) \
   448   ) \
   444   $(if $(filter make%, $1), \
   449   $(if $(filter make%, $1), \
   631   # Current tests needs to open java.io
   636   # Current tests needs to open java.io
   632   $1_MICRO_JAVA_OPTIONS += --add-opens=java.base/java.io=ALL-UNNAMED
   637   $1_MICRO_JAVA_OPTIONS += --add-opens=java.base/java.io=ALL-UNNAMED
   633 
   638 
   634   # Save output as JSON or CSV file
   639   # Save output as JSON or CSV file
   635   ifneq ($$(MICRO_RESULTS_FORMAT), )
   640   ifneq ($$(MICRO_RESULTS_FORMAT), )
   636     $1_MICRO_BASIC_OPTIONS += -rf $$(MICRO_RESULTS_FORMAT) -rff $$($1_TEST_RESULTS_DIR)/jmh-result.$(MICRO_RESULTS_FORMAT)
   641     $1_MICRO_BASIC_OPTIONS += -rf $$(MICRO_RESULTS_FORMAT)
       
   642     $1_MICRO_BASIC_OPTIONS += -rff $$($1_TEST_RESULTS_DIR)/jmh-result.$(MICRO_RESULTS_FORMAT)
   637   endif
   643   endif
   638 
   644 
   639   ifneq ($$(MICRO_VM_OPTIONS)$$(MICRO_JAVA_OPTIONS), )
   645   ifneq ($$(MICRO_VM_OPTIONS)$$(MICRO_JAVA_OPTIONS), )
   640     $1_MICRO_VM_OPTIONS := -jvmArgs $$(MICRO_VM_OPTIONS) $$(MICRO_JAVA_OPTIONS)
   646     $1_MICRO_VM_OPTIONS := -jvmArgs $$(MICRO_VM_OPTIONS) $$(MICRO_JAVA_OPTIONS)
   641   endif
   647   endif
   662 	$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
   668 	$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
   663 	$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/micro, \
   669 	$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/micro, \
   664 	    $$($1_MICRO_TEST_JDK)/bin/java $$($1_MICRO_JAVA_OPTIONS) -jar $$($1_MICRO_BENCHMARKS_JAR) \
   670 	    $$($1_MICRO_TEST_JDK)/bin/java $$($1_MICRO_JAVA_OPTIONS) -jar $$($1_MICRO_BENCHMARKS_JAR) \
   665 	        $$($1_MICRO_ITER) $$($1_MICRO_FORK) $$($1_MICRO_TIME) \
   671 	        $$($1_MICRO_ITER) $$($1_MICRO_FORK) $$($1_MICRO_TIME) \
   666 	        $$($1_MICRO_WARMUP_ITER) $$($1_MICRO_WARMUP_TIME) \
   672 	        $$($1_MICRO_WARMUP_ITER) $$($1_MICRO_WARMUP_TIME) \
   667 	        $$($1_MICRO_VM_OPTIONS) $$($1_MICRO_BASIC_OPTIONS) $$(MICRO_OPTIONS)  \
   673 	        $$($1_MICRO_VM_OPTIONS) $$($1_MICRO_BASIC_OPTIONS) $$(MICRO_OPTIONS) \
   668 	        $$($1_TEST_NAME) \
   674 	        $$($1_TEST_NAME) \
   669 	        > >($(TEE) $$($1_TEST_RESULTS_DIR)/micro.txt) \
   675 	        > >($(TEE) $$($1_TEST_RESULTS_DIR)/micro.txt) \
   670 	    && $$(ECHO) $$$$? > $$($1_EXITCODE) \
   676 	    && $$(ECHO) $$$$? > $$($1_EXITCODE) \
   671 	    || $$(ECHO) $$$$? > $$($1_EXITCODE) \
   677 	    || $$(ECHO) $$$$? > $$($1_EXITCODE) \
   672 	)
   678 	)