make/RunTests.gmk
branchihse-runtestprebuilt-branch
changeset 56931 aff106ae3507
parent 56917 e3334aaef781
child 56932 7346896cdea2
equal deleted inserted replaced
56924:3ff24f395d16 56931:aff106ae3507
    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     KEYWORDS := JOBS TIMEOUT GENERATE_CDS_ARCHIVE, \
    48     SINGLE_KEYWORDS := JOBS TIMEOUT GENERATE_CDS_ARCHIVE, \
    49     STRING_KEYWORDS := VM_OPTIONS, \
    49     STRING_KEYWORDS := VM_OPTIONS, \
    50 ))
    50 ))
    51 
    51 
    52 # Helper function to propagate TEST_OPTS values.
    52 # Helper function to propagate TEST_OPTS values.
    53 #
    53 #
   130 
   130 
   131 # Optionally create a CDS archive before running tests
   131 # Optionally create a CDS archive before running tests
   132 ifeq ($(TEST_OPTS_GENERATE_CDS_ARCHIVE), true)
   132 ifeq ($(TEST_OPTS_GENERATE_CDS_ARCHIVE), true)
   133   CDS_ARCHIVE_FILE := $(TEST_RESULTS_DIR)/cds_archive.jsa
   133   CDS_ARCHIVE_FILE := $(TEST_RESULTS_DIR)/cds_archive.jsa
   134 
   134 
   135   $(CDS_ARCHIVE_FILE): $(JDK_IMAGE_DIR)
   135   $(CDS_ARCHIVE_FILE): $(JDK_IMAGE_DIR)/release
   136 	$(FIXPATH) $(PRODUCT_HOME)/bin/java -XX:+UnlockDiagnosticVMOptions \
   136 	$(call MakeTargetDir)
   137 	    -XX:SharedArchiveFile=$(CDS_ARCHIVE_FILE) -Xshare:dump
   137 	$(call ExecuteWithLog, $(CDS_ARCHIVE_FILE), \
       
   138 	    $(FIXPATH) $(JDK_IMAGE_DIR)/bin/java -XX:+UnlockDiagnosticVMOptions \
       
   139 	        -XX:SharedArchiveFile=$(CDS_ARCHIVE_FILE) -Xshare:dump \
       
   140 	)
   138 
   141 
   139   CDS_VM_ARGS := -XX:+UnlockDiagnosticVMOptions -XX:SharedArchiveFile=$(CDS_ARCHIVE_FILE)
   142   CDS_VM_ARGS := -XX:+UnlockDiagnosticVMOptions -XX:SharedArchiveFile=$(CDS_ARCHIVE_FILE)
   140   JTREG_OPTIONS += $(addprefix -vmoption:, $(CDS_VM_ARGS))
   143   JTREG_OPTIONS += $(addprefix -vmoption:, $(CDS_VM_ARGS))
   141   TEST_PREREQS += $(CDS_ARCHIVE_FILE)
   144   TEST_PREREQS += $(CDS_ARCHIVE_FILE)
   142 endif
   145 endif
   155   $(eval $(call SetTestOpt,JOBS,JTREG))
   158   $(eval $(call SetTestOpt,JOBS,JTREG))
   156   $(eval $(call SetTestOpt,TIMEOUT,JTREG))
   159   $(eval $(call SetTestOpt,TIMEOUT,JTREG))
   157 endif
   160 endif
   158 
   161 
   159 $(eval $(call ParseKeywordVariable, JTREG, \
   162 $(eval $(call ParseKeywordVariable, JTREG, \
   160     KEYWORDS := JOBS TIMEOUT TEST_MODE ASSERT VERBOSE RETAIN MAX_MEM \
   163     SINGLE_KEYWORDS := JOBS TIMEOUT TEST_MODE ASSERT VERBOSE RETAIN MAX_MEM \
   161         EXTRA_PROBLEM_LISTS, \
   164         EXTRA_PROBLEM_LISTS KEYWORDS, \
   162     STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS, \
   165     STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS, \
   163 ))
   166 ))
   164 
   167 
   165 ifneq ($(JTREG), )
   168 ifneq ($(JTREG), )
   166   # Inform the user
   169   # Inform the user
   167   $(info Running tests using JTREG control variable '$(JTREG)')
   170   $(info Running tests using JTREG control variable '$(JTREG)')
   168 endif
   171 endif
   169 
   172 
   170 $(eval $(call ParseKeywordVariable, GTEST, \
   173 $(eval $(call ParseKeywordVariable, GTEST, \
   171     KEYWORDS := REPEAT, \
   174     SINGLE_KEYWORDS := REPEAT, \
   172     STRING_KEYWORDS := OPTIONS VM_OPTIONS, \
   175     STRING_KEYWORDS := OPTIONS VM_OPTIONS, \
   173 ))
   176 ))
   174 
   177 
   175 ifneq ($(GTEST), )
   178 ifneq ($(GTEST), )
   176   # Inform the user
   179   # Inform the user
   402 	$$(call LogWarn)
   405 	$$(call LogWarn)
   403 	$$(call LogWarn, Running test '$$($1_TEST)')
   406 	$$(call LogWarn, Running test '$$($1_TEST)')
   404 	$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
   407 	$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
   405 	$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/gtest, \
   408 	$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/gtest, \
   406 	    $$(FIXPATH) $$(TEST_IMAGE_DIR)/hotspot/gtest/$$($1_VARIANT)/gtestLauncher \
   409 	    $$(FIXPATH) $$(TEST_IMAGE_DIR)/hotspot/gtest/$$($1_VARIANT)/gtestLauncher \
   407 	         -jdk $(JDK_IMAGE_DIR) $$($1_GTEST_FILTER) \
   410 	        -jdk $(JDK_IMAGE_DIR) $$($1_GTEST_FILTER) \
   408 	         --gtest_output=xml:$$($1_TEST_RESULTS_DIR)/gtest.xml \
   411 	        --gtest_output=xml:$$($1_TEST_RESULTS_DIR)/gtest.xml \
   409 	         $$($1_GTEST_REPEAT) $$(GTEST_OPTIONS) $$(GTEST_VM_OPTIONS) \
   412 	        $$($1_GTEST_REPEAT) $$(GTEST_OPTIONS) \
       
   413 	        $$(CDS_VM_ARGS) $$(GTEST_VM_OPTIONS) \
   410 	        > >($(TEE) $$($1_TEST_RESULTS_DIR)/gtest.txt) \
   414 	        > >($(TEE) $$($1_TEST_RESULTS_DIR)/gtest.txt) \
   411 	    && $$(ECHO) $$$$? > $$($1_EXITCODE) \
   415 	    && $$(ECHO) $$$$? > $$($1_EXITCODE) \
   412 	    || $$(ECHO) $$$$? > $$($1_EXITCODE) \
   416 	    || $$(ECHO) $$$$? > $$($1_EXITCODE) \
   413 	)
   417 	)
   414 
   418 
   502   $$(eval $$(call SetJtregValue,$1,JTREG_MAX_MEM,512m))
   506   $$(eval $$(call SetJtregValue,$1,JTREG_MAX_MEM,512m))
   503   $$(eval $$(call SetJtregValue,$1,JTREG_NATIVEPATH))
   507   $$(eval $$(call SetJtregValue,$1,JTREG_NATIVEPATH))
   504   $$(eval $$(call SetJtregValue,$1,JTREG_BASIC_OPTIONS))
   508   $$(eval $$(call SetJtregValue,$1,JTREG_BASIC_OPTIONS))
   505   $$(eval $$(call SetJtregValue,$1,JTREG_PROBLEM_LIST))
   509   $$(eval $$(call SetJtregValue,$1,JTREG_PROBLEM_LIST))
   506 
   510 
       
   511   # Only the problem list for the current test root should be used.
       
   512   $1_JTREG_PROBLEM_LIST := $$(filter $$($1_TEST_ROOT)%, $$($1_JTREG_PROBLEM_LIST))
       
   513 
   507   ifneq ($(TEST_JOBS), 0)
   514   ifneq ($(TEST_JOBS), 0)
   508     $$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(TEST_JOBS)))
   515     $$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(TEST_JOBS)))
   509   else
   516   else
   510     $$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(JOBS)))
   517     $$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(JOBS)))
   511   endif
   518   endif
   512 
   519 
   513   # Make sure MaxRAMPercentage is high enough to not cause OOM or swapping since
   520   # Make sure MaxRAMPercentage is high enough to not cause OOM or swapping since
   514   # we may end up with a lot of JVM's
   521   # we may end up with a lot of JVM's
   515   $1_JTREG_MAX_RAM_PERCENTAGE := $$(shell $$(EXPR) 25 / $$($1_JTREG_JOBS))
   522   $1_JTREG_MAX_RAM_PERCENTAGE := $$(shell $$(EXPR) 25 / $$($1_JTREG_JOBS))
   516 
   523 
       
   524   $$(call PrintVar, TEST_OPTS_TIMEOUT)
       
   525   $$(call PrintVar, JTREG_TIMEOUT)
   517   JTREG_TIMEOUT ?= 4
   526   JTREG_TIMEOUT ?= 4
   518   JTREG_VERBOSE ?= fail,error,summary
   527   JTREG_VERBOSE ?= fail,error,summary
   519   JTREG_RETAIN ?= fail,error
   528   JTREG_RETAIN ?= fail,error
   520 
   529 
   521   ifneq ($$($1_JTREG_MAX_MEM), 0)
   530   ifneq ($$($1_JTREG_MAX_MEM), 0)
   526   $1_JTREG_BASIC_OPTIONS += -$$($1_JTREG_TEST_MODE) \
   535   $1_JTREG_BASIC_OPTIONS += -$$($1_JTREG_TEST_MODE) \
   527       -verbose:$$(JTREG_VERBOSE) -retain:$$(JTREG_RETAIN) \
   536       -verbose:$$(JTREG_VERBOSE) -retain:$$(JTREG_RETAIN) \
   528       -concurrency:$$($1_JTREG_JOBS) -timeoutFactor:$$(JTREG_TIMEOUT) \
   537       -concurrency:$$($1_JTREG_JOBS) -timeoutFactor:$$(JTREG_TIMEOUT) \
   529       -vmoption:-XX:MaxRAMPercentage=$$($1_JTREG_MAX_RAM_PERCENTAGE)
   538       -vmoption:-XX:MaxRAMPercentage=$$($1_JTREG_MAX_RAM_PERCENTAGE)
   530 
   539 
   531   $1_JTREG_BASIC_OPTIONS += -automatic -keywords:\!ignore -ignore:quiet
   540   $1_JTREG_BASIC_OPTIONS += -automatic -ignore:quiet
   532 
   541 
   533   # Make it possible to specify the JIB_DATA_DIR for tests using the
   542   # Make it possible to specify the JIB_DATA_DIR for tests using the
   534   # JIB Artifact resolver
   543   # JIB Artifact resolver
   535   $1_JTREG_BASIC_OPTIONS += -e:JIB_DATA_DIR
   544   $1_JTREG_BASIC_OPTIONS += -e:JIB_DATA_DIR
   536   # Some tests needs to find a boot JDK using the JDK8_HOME variable.
   545   # Some tests needs to find a boot JDK using the JDK8_HOME variable.
   572 
   581 
   573   $1_JTREG_BASIC_OPTIONS += -e:TEST_IMAGE_GRAAL_DIR=${TEST_IMAGE_DIR}/hotspot/jtreg/graal
   582   $1_JTREG_BASIC_OPTIONS += -e:TEST_IMAGE_GRAAL_DIR=${TEST_IMAGE_DIR}/hotspot/jtreg/graal
   574 
   583 
   575   ifneq ($$(JTREG_FAILURE_HANDLER_OPTIONS), )
   584   ifneq ($$(JTREG_FAILURE_HANDLER_OPTIONS), )
   576     $1_JTREG_LAUNCHER_OPTIONS += -Djava.library.path="$(JTREG_FAILURE_HANDLER_DIR)"
   585     $1_JTREG_LAUNCHER_OPTIONS += -Djava.library.path="$(JTREG_FAILURE_HANDLER_DIR)"
       
   586   endif
       
   587 
       
   588   ifneq ($$(JTREG_KEYWORDS), )
       
   589     # The keywords string may contain problematic characters and may be quoted
       
   590     # already when it arrives here. Remove any existing quotes and replace them
       
   591     # with one set of single quotes.
       
   592     $1_JTREG_BASIC_OPTIONS += \
       
   593         -k:'$$(patsubst $$(SQUOTE)%$$(SQUOTE),%,$$(patsubst $$(DQUOTE)%$$(DQUOTE),%,$$(JTREG_KEYWORDS)))'
   577   endif
   594   endif
   578 
   595 
   579   clean-workdir-$1:
   596   clean-workdir-$1:
   580 	$$(RM) -r $$($1_TEST_SUPPORT_DIR)
   597 	$$(RM) -r $$($1_TEST_SUPPORT_DIR)
   581 
   598