1 #
2 # Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # This code is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License version 2 only, as
7 # published by the Free Software Foundation. Oracle designates this
8 # particular file as subject to the "Classpath" exception as provided
9 # by Oracle in the LICENSE file that accompanied this code.
10 #
11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # version 2 for more details (a copy is included in the LICENSE file that
15 # accompanied this code).
16 #
17 # You should have received a copy of the GNU General Public License version
18 # 2 along with this work; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 # or visit www.oracle.com if you need additional information or have any
182 ################################################################################
183 # Parse control variables
184 ################################################################################
185
186 ifneq ($(TEST_OPTS), )
187 # Inform the user
188 $(info Running tests using TEST_OPTS control variable '$(TEST_OPTS)')
189 endif
190
191 ### Jtreg
192
193 $(eval $(call SetTestOpt,VM_OPTIONS,JTREG))
194 $(eval $(call SetTestOpt,JAVA_OPTIONS,JTREG))
195
196 $(eval $(call SetTestOpt,JOBS,JTREG))
197 $(eval $(call SetTestOpt,TIMEOUT_FACTOR,JTREG))
198 $(eval $(call SetTestOpt,FAILURE_HANDLER_TIMEOUT,JTREG))
199
200 $(eval $(call ParseKeywordVariable, JTREG, \
201 SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR FAILURE_HANDLER_TIMEOUT \
202 TEST_MODE ASSERT VERBOSE RETAIN MAX_MEM RUN_PROBLEM_LISTS \
203 RETRY_COUNT REPEAT_COUNT MAX_OUTPUT $(CUSTOM_JTREG_SINGLE_KEYWORDS), \
204 STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS KEYWORDS \
205 EXTRA_PROBLEM_LISTS LAUNCHER_OPTIONS \
206 $(CUSTOM_JTREG_STRING_KEYWORDS), \
207 ))
208
209 ifneq ($(JTREG), )
210 # Inform the user
211 $(info Running tests using JTREG control variable '$(JTREG)')
212 endif
213
214 ### Gtest
215
216 $(eval $(call SetTestOpt,VM_OPTIONS,GTEST))
217 $(eval $(call SetTestOpt,JAVA_OPTIONS,GTEST))
218
219 $(eval $(call ParseKeywordVariable, GTEST, \
220 SINGLE_KEYWORDS := REPEAT, \
221 STRING_KEYWORDS := OPTIONS VM_OPTIONS JAVA_OPTIONS, \
222 ))
577 $1_EXITCODE := $$($1_TEST_RESULTS_DIR)/exitcode.txt
578
579 $1_TEST_NAME := $$(strip $$(patsubst micro:%, %, $$($1_TEST)))
580
581 $$(eval $$(call SetMicroValue,$1,MICRO_BENCHMARKS_JAR,$$(TEST_IMAGE_DIR)/micro/benchmarks.jar))
582 $$(eval $$(call SetMicroValue,$1,MICRO_TEST_JDK,$$(JDK_UNDER_TEST)))
583 $$(eval $$(call SetMicroValue,$1,MICRO_JAVA_OPTIONS))
584
585 # Current tests needs to open java.io
586 $1_MICRO_JAVA_OPTIONS += --add-opens=java.base/java.io=ALL-UNNAMED
587
588 # Save output as JSON or CSV file
589 ifneq ($$(MICRO_RESULTS_FORMAT), )
590 $1_MICRO_BASIC_OPTIONS += -rf $$(MICRO_RESULTS_FORMAT)
591 $1_MICRO_BASIC_OPTIONS += -rff $$($1_TEST_RESULTS_DIR)/jmh-result.$(MICRO_RESULTS_FORMAT)
592 endif
593
594 # Set library path for native dependencies
595 $1_JMH_JVM_ARGS := -Djava.library.path=$$(TEST_IMAGE_DIR)/micro/native
596
597 ifneq ($$(MICRO_VM_OPTIONS)$$(MICRO_JAVA_OPTIONS), )
598 $1_JMH_JVM_ARGS += $$(MICRO_VM_OPTIONS) $$(MICRO_JAVA_OPTIONS)
599 endif
600
601 $1_MICRO_VM_OPTIONS := -jvmArgs $(call ShellQuote,$$($1_JMH_JVM_ARGS))
602
603 ifneq ($$(MICRO_ITER), )
604 $1_MICRO_ITER := -i $$(MICRO_ITER)
605 endif
606 ifneq ($$(MICRO_FORK), )
607 $1_MICRO_FORK := -f $$(MICRO_FORK)
608 endif
609 ifneq ($$(MICRO_TIME), )
610 $1_MICRO_TIME := -r $$(MICRO_TIME)
611 endif
612 ifneq ($$(MICRO_WARMUP_ITER), )
613 $1_MICRO_WARMUP_ITER := -wi $$(MICRO_WARMUP_ITER)
614 endif
615 ifneq ($$(MICRO_WARMUP_TIME), )
616 $1_MICRO_WARMUP_TIME := -w $$(MICRO_WARMUP_TIME)
726 $$(eval $$(call SetJtregValue,$1,JTREG_BASIC_OPTIONS))
727 $$(eval $$(call SetJtregValue,$1,JTREG_PROBLEM_LIST))
728
729 # Only the problem list for the current test root should be used.
730 $1_JTREG_PROBLEM_LIST := $$(filter $$($1_TEST_ROOT)%, $$($1_JTREG_PROBLEM_LIST))
731
732 ifneq ($(TEST_JOBS), 0)
733 $$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(TEST_JOBS)))
734 else
735 $$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(JOBS)))
736 endif
737
738 # Make sure MaxRAMPercentage is high enough to not cause OOM or swapping since
739 # we may end up with a lot of JVM's
740 $1_JTREG_MAX_RAM_PERCENTAGE := $$(shell $(AWK) 'BEGIN { print 25 / $$($1_JTREG_JOBS); }')
741
742 JTREG_TIMEOUT_FACTOR ?= 4
743
744 JTREG_VERBOSE ?= fail,error,summary
745 JTREG_RETAIN ?= fail,error
746 JTREG_RUN_PROBLEM_LISTS ?= false
747 JTREG_RETRY_COUNT ?= 0
748 JTREG_REPEAT_COUNT ?= 0
749
750 ifneq ($$(JTREG_RETRY_COUNT), 0)
751 ifneq ($$(JTREG_REPEAT_COUNT), 0)
752 $$(info Error: Cannot use both JTREG_RETRY_COUNT and JTREG_REPEAT_COUNT together.)
753 $$(info Please choose one or the other.)
754 $$(error Cannot continue)
755 endif
756 endif
757
758 ifneq ($$(JTREG_LAUNCHER_OPTIONS), )
759 $1_JTREG_LAUNCHER_OPTIONS += $$(JTREG_LAUNCHER_OPTIONS)
760 endif
761
762 ifneq ($$(JTREG_MAX_OUTPUT), )
763 $1_JTREG_LAUNCHER_OPTIONS += -Djavatest.maxOutputSize=$$(JTREG_MAX_OUTPUT)
764 endif
765
766 ifneq ($$($1_JTREG_MAX_MEM), 0)
767 $1_JTREG_BASIC_OPTIONS += -vmoption:-Xmx$$($1_JTREG_MAX_MEM)
768 $1_JTREG_LAUNCHER_OPTIONS += -Xmx$$($1_JTREG_MAX_MEM)
769 endif
770
771 # Make sure the tmp dir is normalized as some tests will react badly otherwise
772 $1_TEST_TMP_DIR := $$(abspath $$($1_TEST_SUPPORT_DIR)/tmp)
773
774 $1_JTREG_BASIC_OPTIONS += -$$($1_JTREG_TEST_MODE) \
775 -verbose:$$(JTREG_VERBOSE) -retain:$$(JTREG_RETAIN) \
776 -concurrency:$$($1_JTREG_JOBS) -timeoutFactor:$$(JTREG_TIMEOUT_FACTOR) \
777 -vmoption:-XX:MaxRAMPercentage=$$($1_JTREG_MAX_RAM_PERCENTAGE) \
|
1 #
2 # Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # This code is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License version 2 only, as
7 # published by the Free Software Foundation. Oracle designates this
8 # particular file as subject to the "Classpath" exception as provided
9 # by Oracle in the LICENSE file that accompanied this code.
10 #
11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # version 2 for more details (a copy is included in the LICENSE file that
15 # accompanied this code).
16 #
17 # You should have received a copy of the GNU General Public License version
18 # 2 along with this work; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 # or visit www.oracle.com if you need additional information or have any
182 ################################################################################
183 # Parse control variables
184 ################################################################################
185
186 ifneq ($(TEST_OPTS), )
187 # Inform the user
188 $(info Running tests using TEST_OPTS control variable '$(TEST_OPTS)')
189 endif
190
191 ### Jtreg
192
193 $(eval $(call SetTestOpt,VM_OPTIONS,JTREG))
194 $(eval $(call SetTestOpt,JAVA_OPTIONS,JTREG))
195
196 $(eval $(call SetTestOpt,JOBS,JTREG))
197 $(eval $(call SetTestOpt,TIMEOUT_FACTOR,JTREG))
198 $(eval $(call SetTestOpt,FAILURE_HANDLER_TIMEOUT,JTREG))
199
200 $(eval $(call ParseKeywordVariable, JTREG, \
201 SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR FAILURE_HANDLER_TIMEOUT \
202 TEST_MODE ASSERT VERBOSE RETAIN MAIN_WRAPPER MAX_MEM RUN_PROBLEM_LISTS \
203 RETRY_COUNT REPEAT_COUNT MAX_OUTPUT $(CUSTOM_JTREG_SINGLE_KEYWORDS), \
204 STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS KEYWORDS \
205 EXTRA_PROBLEM_LISTS LAUNCHER_OPTIONS \
206 $(CUSTOM_JTREG_STRING_KEYWORDS), \
207 ))
208
209 ifneq ($(JTREG), )
210 # Inform the user
211 $(info Running tests using JTREG control variable '$(JTREG)')
212 endif
213
214 ### Gtest
215
216 $(eval $(call SetTestOpt,VM_OPTIONS,GTEST))
217 $(eval $(call SetTestOpt,JAVA_OPTIONS,GTEST))
218
219 $(eval $(call ParseKeywordVariable, GTEST, \
220 SINGLE_KEYWORDS := REPEAT, \
221 STRING_KEYWORDS := OPTIONS VM_OPTIONS JAVA_OPTIONS, \
222 ))
577 $1_EXITCODE := $$($1_TEST_RESULTS_DIR)/exitcode.txt
578
579 $1_TEST_NAME := $$(strip $$(patsubst micro:%, %, $$($1_TEST)))
580
581 $$(eval $$(call SetMicroValue,$1,MICRO_BENCHMARKS_JAR,$$(TEST_IMAGE_DIR)/micro/benchmarks.jar))
582 $$(eval $$(call SetMicroValue,$1,MICRO_TEST_JDK,$$(JDK_UNDER_TEST)))
583 $$(eval $$(call SetMicroValue,$1,MICRO_JAVA_OPTIONS))
584
585 # Current tests needs to open java.io
586 $1_MICRO_JAVA_OPTIONS += --add-opens=java.base/java.io=ALL-UNNAMED
587
588 # Save output as JSON or CSV file
589 ifneq ($$(MICRO_RESULTS_FORMAT), )
590 $1_MICRO_BASIC_OPTIONS += -rf $$(MICRO_RESULTS_FORMAT)
591 $1_MICRO_BASIC_OPTIONS += -rff $$($1_TEST_RESULTS_DIR)/jmh-result.$(MICRO_RESULTS_FORMAT)
592 endif
593
594 # Set library path for native dependencies
595 $1_JMH_JVM_ARGS := -Djava.library.path=$$(TEST_IMAGE_DIR)/micro/native
596
597 # Allow preview features in microbenchmarks
598 $1_JMH_JVM_ARGS += --enable-preview
599
600 ifneq ($$(MICRO_VM_OPTIONS)$$(MICRO_JAVA_OPTIONS), )
601 $1_JMH_JVM_ARGS += $$(MICRO_VM_OPTIONS) $$(MICRO_JAVA_OPTIONS)
602 endif
603
604 $1_MICRO_VM_OPTIONS := -jvmArgs $(call ShellQuote,$$($1_JMH_JVM_ARGS))
605
606 ifneq ($$(MICRO_ITER), )
607 $1_MICRO_ITER := -i $$(MICRO_ITER)
608 endif
609 ifneq ($$(MICRO_FORK), )
610 $1_MICRO_FORK := -f $$(MICRO_FORK)
611 endif
612 ifneq ($$(MICRO_TIME), )
613 $1_MICRO_TIME := -r $$(MICRO_TIME)
614 endif
615 ifneq ($$(MICRO_WARMUP_ITER), )
616 $1_MICRO_WARMUP_ITER := -wi $$(MICRO_WARMUP_ITER)
617 endif
618 ifneq ($$(MICRO_WARMUP_TIME), )
619 $1_MICRO_WARMUP_TIME := -w $$(MICRO_WARMUP_TIME)
729 $$(eval $$(call SetJtregValue,$1,JTREG_BASIC_OPTIONS))
730 $$(eval $$(call SetJtregValue,$1,JTREG_PROBLEM_LIST))
731
732 # Only the problem list for the current test root should be used.
733 $1_JTREG_PROBLEM_LIST := $$(filter $$($1_TEST_ROOT)%, $$($1_JTREG_PROBLEM_LIST))
734
735 ifneq ($(TEST_JOBS), 0)
736 $$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(TEST_JOBS)))
737 else
738 $$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(JOBS)))
739 endif
740
741 # Make sure MaxRAMPercentage is high enough to not cause OOM or swapping since
742 # we may end up with a lot of JVM's
743 $1_JTREG_MAX_RAM_PERCENTAGE := $$(shell $(AWK) 'BEGIN { print 25 / $$($1_JTREG_JOBS); }')
744
745 JTREG_TIMEOUT_FACTOR ?= 4
746
747 JTREG_VERBOSE ?= fail,error,summary
748 JTREG_RETAIN ?= fail,error
749 JTREG_MAIN_WRAPPER ?=
750 JTREG_RUN_PROBLEM_LISTS ?= false
751 JTREG_RETRY_COUNT ?= 0
752 JTREG_REPEAT_COUNT ?= 0
753
754 ifneq ($$(JTREG_RETRY_COUNT), 0)
755 ifneq ($$(JTREG_REPEAT_COUNT), 0)
756 $$(info Error: Cannot use both JTREG_RETRY_COUNT and JTREG_REPEAT_COUNT together.)
757 $$(info Please choose one or the other.)
758 $$(error Cannot continue)
759 endif
760 endif
761
762 ifneq ($$(JTREG_MAIN_WRAPPER), )
763 JT_HOME = $$(JT_HOME_MW)
764 $1_JTREG_BASIC_OPTIONS += -mainWrapper:$$(JTREG_MAIN_WRAPPER)
765 endif
766
767 ifneq ($$(JTREG_LAUNCHER_OPTIONS), )
768 $1_JTREG_LAUNCHER_OPTIONS += $$(JTREG_LAUNCHER_OPTIONS)
769 endif
770
771 ifneq ($$(JTREG_MAX_OUTPUT), )
772 $1_JTREG_LAUNCHER_OPTIONS += -Djavatest.maxOutputSize=$$(JTREG_MAX_OUTPUT)
773 endif
774
775 ifneq ($$($1_JTREG_MAX_MEM), 0)
776 $1_JTREG_BASIC_OPTIONS += -vmoption:-Xmx$$($1_JTREG_MAX_MEM)
777 $1_JTREG_LAUNCHER_OPTIONS += -Xmx$$($1_JTREG_MAX_MEM)
778 endif
779
780 # Make sure the tmp dir is normalized as some tests will react badly otherwise
781 $1_TEST_TMP_DIR := $$(abspath $$($1_TEST_SUPPORT_DIR)/tmp)
782
783 $1_JTREG_BASIC_OPTIONS += -$$($1_JTREG_TEST_MODE) \
784 -verbose:$$(JTREG_VERBOSE) -retain:$$(JTREG_RETAIN) \
785 -concurrency:$$($1_JTREG_JOBS) -timeoutFactor:$$(JTREG_TIMEOUT_FACTOR) \
786 -vmoption:-XX:MaxRAMPercentage=$$($1_JTREG_MAX_RAM_PERCENTAGE) \
|