301 # Helper function to determine if a test specification is a special test
302 #
303 # It is a special test if it is "special:" followed by a test name,
304 # if it is "make:" or "make-" followed by a make test, or any of the special test names
305 # as a single word.
306 define ParseSpecialTestSelection
307 $(if $(filter special:%, $1), \
308 $1 \
309 ) \
310 $(if $(filter make%, $1), \
311 $(if $(filter make:%, $1), \
312 special:$(strip $1) \
313 ) \
314 $(if $(filter make-%, $1), \
315 special:$(patsubst make-%,make:%, $1) \
316 ) \
317 $(if $(filter make, $1), \
318 special:make:all \
319 )
320 ) \
321 $(if $(filter hotspot-internal failure-handler, $1), \
322 special:$(strip $1) \
323 )
324 endef
325
326 ifeq ($(TEST), )
327 $(info No test selection given in TEST!)
328 $(info Please use e.g. 'make test TEST=tier1' or 'make test-tier1')
329 $(info See doc/testing.[md|html] for help)
330 $(error Cannot continue)
331 endif
332
333 # Now intelligently convert the test selection given by the user in TEST
334 # into a list of fully qualified test descriptors of the tests to run.
335 TESTS_TO_RUN :=
336 $(foreach test, $(TEST), \
337 $(eval PARSED_TESTS := $(call ParseCustomTestSelection, $(test))) \
338 $(if $(strip $(PARSED_TESTS)), , \
339 $(eval PARSED_TESTS += $(call ParseGtestTestSelection, $(test))) \
340 ) \
341 $(if $(strip $(PARSED_TESTS)), , \
657
658 ################################################################################
659
660 ### Rules for special tests
661
662 SetupRunSpecialTest = $(NamedParamsMacroTemplate)
663 define SetupRunSpecialTestBody
664 $1_TEST_RESULTS_DIR := $$(TEST_RESULTS_DIR)/$1
665 $1_TEST_SUPPORT_DIR := $$(TEST_SUPPORT_DIR)/$1
666 $1_EXITCODE := $$($1_TEST_RESULTS_DIR)/exitcode.txt
667
668 $1_FULL_TEST_NAME := $$(strip $$(patsubst special:%, %, $$($1_TEST)))
669 ifneq ($$(findstring :, $$($1_FULL_TEST_NAME)), )
670 $1_TEST_NAME := $$(firstword $$(subst :, ,$$($1_FULL_TEST_NAME)))
671 $1_TEST_ARGS := $$(strip $$(patsubst special:$$($1_TEST_NAME):%, %, $$($1_TEST)))
672 else
673 $1_TEST_NAME := $$($1_FULL_TEST_NAME)
674 $1_TEST_ARGS :=
675 endif
676
677 ifeq ($$($1_TEST_NAME), hotspot-internal)
678 $1_TEST_COMMAND_LINE := \
679 $$(JDK_IMAGE_DIR)/bin/java -XX:+ExecuteInternalVMTests \
680 -XX:+ShowMessageBoxOnError -version
681 else ifeq ($$($1_TEST_NAME), failure-handler)
682 ifeq ($(BUILD_FAILURE_HANDLER), true)
683 $1_TEST_COMMAND_LINE := \
684 ($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f \
685 BuildFailureHandler.gmk test)
686 else
687 $$(error Cannot test failure handler if it is not built)
688 endif
689 else ifeq ($$($1_TEST_NAME), make)
690 $1_TEST_COMMAND_LINE := \
691 ($(CD) $(TOPDIR)/test/make && $(MAKE) $(MAKE_ARGS) -f \
692 TestMake.gmk $$($1_TEST_ARGS))
693 else
694 $$(error Invalid special test specification: $$($1_TEST_NAME))
695 endif
696
697 run-test-$1: $(TEST_PREREQS)
698 $$(call LogWarn)
699 $$(call LogWarn, Running test '$$($1_TEST)')
700 $$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
701 $$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/test-execution, \
|
301 # Helper function to determine if a test specification is a special test
302 #
303 # It is a special test if it is "special:" followed by a test name,
304 # if it is "make:" or "make-" followed by a make test, or any of the special test names
305 # as a single word.
306 define ParseSpecialTestSelection
307 $(if $(filter special:%, $1), \
308 $1 \
309 ) \
310 $(if $(filter make%, $1), \
311 $(if $(filter make:%, $1), \
312 special:$(strip $1) \
313 ) \
314 $(if $(filter make-%, $1), \
315 special:$(patsubst make-%,make:%, $1) \
316 ) \
317 $(if $(filter make, $1), \
318 special:make:all \
319 )
320 ) \
321 $(if $(filter failure-handler, $1), \
322 special:$(strip $1) \
323 )
324 endef
325
326 ifeq ($(TEST), )
327 $(info No test selection given in TEST!)
328 $(info Please use e.g. 'make test TEST=tier1' or 'make test-tier1')
329 $(info See doc/testing.[md|html] for help)
330 $(error Cannot continue)
331 endif
332
333 # Now intelligently convert the test selection given by the user in TEST
334 # into a list of fully qualified test descriptors of the tests to run.
335 TESTS_TO_RUN :=
336 $(foreach test, $(TEST), \
337 $(eval PARSED_TESTS := $(call ParseCustomTestSelection, $(test))) \
338 $(if $(strip $(PARSED_TESTS)), , \
339 $(eval PARSED_TESTS += $(call ParseGtestTestSelection, $(test))) \
340 ) \
341 $(if $(strip $(PARSED_TESTS)), , \
657
658 ################################################################################
659
660 ### Rules for special tests
661
662 SetupRunSpecialTest = $(NamedParamsMacroTemplate)
663 define SetupRunSpecialTestBody
664 $1_TEST_RESULTS_DIR := $$(TEST_RESULTS_DIR)/$1
665 $1_TEST_SUPPORT_DIR := $$(TEST_SUPPORT_DIR)/$1
666 $1_EXITCODE := $$($1_TEST_RESULTS_DIR)/exitcode.txt
667
668 $1_FULL_TEST_NAME := $$(strip $$(patsubst special:%, %, $$($1_TEST)))
669 ifneq ($$(findstring :, $$($1_FULL_TEST_NAME)), )
670 $1_TEST_NAME := $$(firstword $$(subst :, ,$$($1_FULL_TEST_NAME)))
671 $1_TEST_ARGS := $$(strip $$(patsubst special:$$($1_TEST_NAME):%, %, $$($1_TEST)))
672 else
673 $1_TEST_NAME := $$($1_FULL_TEST_NAME)
674 $1_TEST_ARGS :=
675 endif
676
677 ifeq ($$($1_TEST_NAME), failure-handler)
678 ifeq ($(BUILD_FAILURE_HANDLER), true)
679 $1_TEST_COMMAND_LINE := \
680 ($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f \
681 BuildFailureHandler.gmk test)
682 else
683 $$(error Cannot test failure handler if it is not built)
684 endif
685 else ifeq ($$($1_TEST_NAME), make)
686 $1_TEST_COMMAND_LINE := \
687 ($(CD) $(TOPDIR)/test/make && $(MAKE) $(MAKE_ARGS) -f \
688 TestMake.gmk $$($1_TEST_ARGS))
689 else
690 $$(error Invalid special test specification: $$($1_TEST_NAME))
691 endif
692
693 run-test-$1: $(TEST_PREREQS)
694 $$(call LogWarn)
695 $$(call LogWarn, Running test '$$($1_TEST)')
696 $$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
697 $$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/test-execution, \
|