author | jwilhelm |
Wed, 24 Oct 2018 18:14:28 -0700 | |
changeset 52279 | a8d239bdaaee |
parent 52125 | 28375a1de254 |
child 52295 | 57d299cdd068 |
child 56978 | 8fbb2fb7589f |
permissions | -rw-r--r-- |
44027 | 1 |
# |
2 |
# Copyright (c) 2016, 2017, 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 |
|
23 |
# questions. |
|
24 |
# |
|
25 |
||
26 |
default: all |
|
27 |
||
28 |
include $(SPEC) |
|
29 |
include MakeBase.gmk |
|
30 |
include FindTests.gmk |
|
31 |
||
32 |
# We will always run multiple tests serially |
|
33 |
.NOTPARALLEL: |
|
34 |
||
47956
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
35 |
################################################################################ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
36 |
# Parse global control variables |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
37 |
################################################################################ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
38 |
|
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
39 |
ifneq ($(TEST_VM_OPTS), ) |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
40 |
ifneq ($(TEST_OPTS), ) |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
41 |
TEST_OPTS := $(TEST_OPTS);VM_OPTIONS=$(TEST_VM_OPTS) |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
42 |
else |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
43 |
TEST_OPTS := VM_OPTIONS=$(TEST_VM_OPTS) |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
44 |
endif |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
45 |
endif |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
46 |
|
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
47 |
$(eval $(call ParseKeywordVariable, TEST_OPTS, \ |
52125
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
48 |
SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR, \ |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
49 |
STRING_KEYWORDS := VM_OPTIONS JAVA_OPTIONS, \ |
47956
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
50 |
)) |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
51 |
|
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
52 |
# Helper function to propagate TEST_OPTS values. |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
53 |
# |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
54 |
# Note: No spaces are allowed around the arguments. |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
55 |
# Arg $1 The variable in TEST_OPTS to propagate |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
56 |
# Arg $2 The control variable to propagate it to |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
57 |
define SetTestOpt |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
58 |
ifneq ($$(TEST_OPTS_$1), ) |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
59 |
$2_$1 := $$(TEST_OPTS_$1) |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
60 |
endif |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
61 |
endef |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
62 |
|
49147
af37d9997bd6
8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents:
48061
diff
changeset
|
63 |
# Setup _NT_SYMBOL_PATH on Windows |
af37d9997bd6
8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents:
48061
diff
changeset
|
64 |
ifeq ($(OPENJDK_TARGET_OS), windows) |
af37d9997bd6
8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents:
48061
diff
changeset
|
65 |
ifndef _NT_SYMBOL_PATH |
af37d9997bd6
8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents:
48061
diff
changeset
|
66 |
# Can't use PathList here as it adds quotes around the value. |
af37d9997bd6
8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents:
48061
diff
changeset
|
67 |
_NT_SYMBOL_PATH := \ |
af37d9997bd6
8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents:
48061
diff
changeset
|
68 |
$(subst $(SPACE),;, $(foreach p, $(sort $(dir $(wildcard \ |
af37d9997bd6
8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents:
48061
diff
changeset
|
69 |
$(addprefix $(SYMBOLS_IMAGE_DIR)/bin/, *.pdb */*.pdb)))), $(call FixPath, $p))) |
af37d9997bd6
8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents:
48061
diff
changeset
|
70 |
export _NT_SYMBOL_PATH |
af37d9997bd6
8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents:
48061
diff
changeset
|
71 |
$(info _NT_SYMBOL_PATH $(_NT_SYMBOL_PATH)) |
af37d9997bd6
8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents:
48061
diff
changeset
|
72 |
endif |
af37d9997bd6
8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents:
48061
diff
changeset
|
73 |
endif |
af37d9997bd6
8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents:
48061
diff
changeset
|
74 |
|
47956
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
75 |
################################################################################ |
44027 | 76 |
# Hook to include the corresponding custom file, if present. |
47314 | 77 |
$(eval $(call IncludeCustomExtension, RunTests.gmk)) |
47956
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
78 |
################################################################################ |
44027 | 79 |
|
47253
92fd0e04e0e1
8187544: Replace BUILD_OUTPUT and OUTPUT_ROOT with OUTPUTDIR
ihse
parents:
47218
diff
changeset
|
80 |
TEST_RESULTS_DIR := $(OUTPUTDIR)/test-results |
92fd0e04e0e1
8187544: Replace BUILD_OUTPUT and OUTPUT_ROOT with OUTPUTDIR
ihse
parents:
47218
diff
changeset
|
81 |
TEST_SUPPORT_DIR := $(OUTPUTDIR)/test-support |
47943 | 82 |
TEST_SUMMARY := $(TEST_RESULTS_DIR)/test-summary.txt |
48042 | 83 |
TEST_LAST_IDS := $(TEST_SUPPORT_DIR)/test-last-ids.txt |
44027 | 84 |
|
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
85 |
ifeq ($(CUSTOM_ROOT), ) |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
86 |
JTREG_TOPDIR := $(TOPDIR) |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
87 |
else |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
88 |
JTREG_TOPDIR := $(CUSTOM_ROOT) |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
89 |
endif |
44027 | 90 |
|
47986 | 91 |
JTREG_FAILURE_HANDLER_DIR := $(TEST_IMAGE_DIR)/failure_handler |
92 |
JTREG_FAILURE_HANDLER := $(JTREG_FAILURE_HANDLER_DIR)/jtregFailureHandler.jar |
|
93 |
||
94 |
ifneq ($(wildcard $(JTREG_FAILURE_HANDLER)), ) |
|
95 |
JTREG_FAILURE_HANDLER_OPTIONS := \ |
|
96 |
-timeoutHandlerDir:$(JTREG_FAILURE_HANDLER) \ |
|
97 |
-observerDir:$(JTREG_FAILURE_HANDLER) \ |
|
98 |
-timeoutHandler:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler \ |
|
99 |
-observer:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver \ |
|
100 |
-timeoutHandlerTimeout:0 |
|
101 |
endif |
|
102 |
||
48058
c5eefa465e37
8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents:
48042
diff
changeset
|
103 |
GTEST_LAUNCHER_DIRS := $(patsubst %/gtestLauncher, %, $(wildcard $(TEST_IMAGE_DIR)/hotspot/gtest/*/gtestLauncher)) |
c5eefa465e37
8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents:
48042
diff
changeset
|
104 |
GTEST_VARIANTS := $(strip $(patsubst $(TEST_IMAGE_DIR)/hotspot/gtest/%, %, $(GTEST_LAUNCHER_DIRS))) |
c5eefa465e37
8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents:
48042
diff
changeset
|
105 |
|
44027 | 106 |
################################################################################ |
52125
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
107 |
# Setup global test running parameters |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
108 |
################################################################################ |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
109 |
|
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
110 |
# Each factor variable comes in 3 variants. The first one is reserved for users |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
111 |
# to use on command line. The other two are for predifined configurations in JDL |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
112 |
# and for machine specific configurations respectively. |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
113 |
TEST_JOBS_FACTOR ?= 1 |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
114 |
TEST_JOBS_FACTOR_JDL ?= 1 |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
115 |
TEST_JOBS_FACTOR_MACHINE ?= 1 |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
116 |
|
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
117 |
ifeq ($(TEST_JOBS), 0) |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
118 |
# Concurrency based on min(cores / 2, 12) * TEST_JOBS_FACTOR |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
119 |
TEST_JOBS := $(shell $(AWK) \ |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
120 |
'BEGIN { \ |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
121 |
c = $(NUM_CORES) / 2; \ |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
122 |
if (c > 12) c = 12; \ |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
123 |
c = c * $(TEST_JOBS_FACTOR); \ |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
124 |
c = c * $(TEST_JOBS_FACTOR_JDL); \ |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
125 |
c = c * $(TEST_JOBS_FACTOR_MACHINE); \ |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
126 |
if (c < 1) c = 1; \ |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
127 |
printf "%.0f", c; \ |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
128 |
}') |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
129 |
endif |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
130 |
|
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
131 |
################################################################################ |
44027 | 132 |
# Parse control variables |
133 |
################################################################################ |
|
134 |
||
47956
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
135 |
ifneq ($(TEST_OPTS), ) |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
136 |
# Inform the user |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
137 |
$(info Running tests using TEST_OPTS control variable '$(TEST_OPTS)') |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
138 |
endif |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
139 |
|
52125
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
140 |
$(eval $(call SetTestOpt,VM_OPTIONS,JTREG)) |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
141 |
$(eval $(call SetTestOpt,JAVA_OPTIONS,JTREG)) |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
142 |
$(eval $(call SetTestOpt,VM_OPTIONS,GTEST)) |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
143 |
$(eval $(call SetTestOpt,JAVA_OPTIONS,GTEST)) |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
144 |
|
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
145 |
$(eval $(call SetTestOpt,JOBS,JTREG)) |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
146 |
$(eval $(call SetTestOpt,TIMEOUT_FACTOR,JTREG)) |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
147 |
|
44027 | 148 |
$(eval $(call ParseKeywordVariable, JTREG, \ |
52125
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
149 |
SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR TEST_MODE ASSERT VERBOSE RETAIN MAX_MEM \ |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
150 |
EXTRA_PROBLEM_LISTS KEYWORDS, \ |
44027 | 151 |
STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS, \ |
152 |
)) |
|
153 |
||
154 |
ifneq ($(JTREG), ) |
|
155 |
# Inform the user |
|
156 |
$(info Running tests using JTREG control variable '$(JTREG)') |
|
157 |
endif |
|
158 |
||
159 |
$(eval $(call ParseKeywordVariable, GTEST, \ |
|
52125
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
160 |
SINGLE_KEYWORDS := REPEAT, \ |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
161 |
STRING_KEYWORDS := OPTIONS VM_OPTIONS JAVA_OPTIONS, \ |
44027 | 162 |
)) |
163 |
||
164 |
ifneq ($(GTEST), ) |
|
165 |
# Inform the user |
|
166 |
$(info Running tests using GTEST control variable '$(GTEST)') |
|
167 |
endif |
|
168 |
||
169 |
||
170 |
################################################################################ |
|
171 |
# Component-specific Jtreg settings |
|
172 |
################################################################################ |
|
173 |
||
174 |
hotspot_JTREG_MAX_MEM := 0 |
|
175 |
hotspot_JTREG_ASSERT := false |
|
176 |
hotspot_JTREG_NATIVEPATH := $(TEST_IMAGE_DIR)/hotspot/jtreg/native |
|
177 |
jdk_JTREG_NATIVEPATH := $(TEST_IMAGE_DIR)/jdk/jtreg/native |
|
178 |
||
47941
d91b0d2d45cb
8179554: make run-test does not respect ProblemList.txt
ihse
parents:
47939
diff
changeset
|
179 |
jdk_JTREG_PROBLEM_LIST += $(TOPDIR)/test/jdk/ProblemList.txt |
d91b0d2d45cb
8179554: make run-test does not respect ProblemList.txt
ihse
parents:
47939
diff
changeset
|
180 |
jaxp_JTREG_PROBLEM_LIST += $(TOPDIR)/test/jaxp/ProblemList.txt |
d91b0d2d45cb
8179554: make run-test does not respect ProblemList.txt
ihse
parents:
47939
diff
changeset
|
181 |
langtools_JTREG_PROBLEM_LIST += $(TOPDIR)/test/langtools/ProblemList.txt |
d91b0d2d45cb
8179554: make run-test does not respect ProblemList.txt
ihse
parents:
47939
diff
changeset
|
182 |
nashorn_JTREG_PROBLEM_LIST += $(TOPDIR)/test/nashorn/ProblemList.txt |
d91b0d2d45cb
8179554: make run-test does not respect ProblemList.txt
ihse
parents:
47939
diff
changeset
|
183 |
hotspot_JTREG_PROBLEM_LIST += $(TOPDIR)/test/hotspot/jtreg/ProblemList.txt |
44027 | 184 |
|
52125
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
185 |
langtools_JTREG_MAX_MEM := 768m |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
186 |
|
44027 | 187 |
################################################################################ |
188 |
# Parse test selection |
|
189 |
# |
|
190 |
# The user has given a test selection in the TEST variable. We must parse it |
|
191 |
# and determine what that means in terms of actual calls to the test framework. |
|
192 |
# |
|
193 |
# The parse functions take as argument a test specification as given by the |
|
194 |
# user, and returns a fully qualified test descriptor if it was a match, or |
|
195 |
# nothing if not. A single test specification can result in multiple test |
|
196 |
# descriptors being returned. A valid test descriptor must always be accepted |
|
197 |
# and returned identically. |
|
198 |
################################################################################ |
|
199 |
||
200 |
# Helper function to determine if a test specification is a Gtest test |
|
201 |
# |
|
202 |
# It is a Gtest test if it is either "gtest", or "gtest:" followed by an optional |
|
48058
c5eefa465e37
8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents:
48042
diff
changeset
|
203 |
# test filter string, and an optional "/<variant>" to select a specific JVM |
c5eefa465e37
8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents:
48042
diff
changeset
|
204 |
# variant. If no variant is specified, all found variants are tested. |
44027 | 205 |
define ParseGtestTestSelection |
206 |
$(if $(filter gtest%, $1), \ |
|
207 |
$(if $(filter gtest, $1), \ |
|
48058
c5eefa465e37
8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents:
48042
diff
changeset
|
208 |
$(addprefix gtest:all/, $(GTEST_VARIANTS)) \ |
44027 | 209 |
, \ |
48058
c5eefa465e37
8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents:
48042
diff
changeset
|
210 |
$(if $(strip $(or $(filter gtest/%, $1) $(filter gtest:/%, $1))), \ |
c5eefa465e37
8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents:
48042
diff
changeset
|
211 |
$(patsubst gtest:/%, gtest:all/%, $(patsubst gtest/%, gtest:/%, $1)) \ |
44027 | 212 |
, \ |
48058
c5eefa465e37
8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents:
48042
diff
changeset
|
213 |
$(if $(filter gtest:%, $1), \ |
c5eefa465e37
8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents:
48042
diff
changeset
|
214 |
$(if $(findstring /, $1), \ |
c5eefa465e37
8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents:
48042
diff
changeset
|
215 |
$1 \ |
c5eefa465e37
8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents:
48042
diff
changeset
|
216 |
, \ |
c5eefa465e37
8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents:
48042
diff
changeset
|
217 |
$(addprefix $1/, $(GTEST_VARIANTS)) \ |
c5eefa465e37
8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents:
48042
diff
changeset
|
218 |
) \ |
c5eefa465e37
8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents:
48042
diff
changeset
|
219 |
) \ |
44027 | 220 |
) \ |
221 |
) \ |
|
222 |
) |
|
223 |
endef |
|
224 |
||
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
225 |
# Helper function that removes the TOPDIR part |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
226 |
CleanupJtregPath = \ |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
227 |
$(strip $(patsubst %/, %, $(subst $(JTREG_TOPDIR)/,, $1))) |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
228 |
|
47932
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
229 |
# Take a partial Jtreg root path and return a full, absolute path to that Jtreg |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
230 |
# root. Also support having "hotspot" as an alias for "hotspot/jtreg". |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
231 |
ExpandJtregRoot = \ |
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
232 |
$(call CleanupJtregPath, $(wildcard \ |
47932
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
233 |
$(if $(filter /%, $1), \ |
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
234 |
$(if $(wildcard $(strip $1)/TEST.ROOT), \ |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
235 |
$1 \ |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
236 |
) \ |
47932
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
237 |
, \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
238 |
$(filter $(addprefix %, $1), $(JTREG_TESTROOTS) $(addsuffix /, $(JTREG_TESTROOTS))) \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
239 |
$(filter $(addprefix %, $(strip $1)/jtreg), $(JTREG_TESTROOTS) $(addsuffix /, $(JTREG_TESTROOTS))) \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
240 |
) \ |
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
241 |
)) |
47932
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
242 |
|
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
243 |
# Take a partial Jtreg test path and return a full, absolute path to that Jtreg |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
244 |
# test. Also support having "hotspot" as an alias for "hotspot/jtreg". |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
245 |
ExpandJtregPath = \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
246 |
$(if $(call ExpandJtregRoot, $1), \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
247 |
$(call ExpandJtregRoot, $1) \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
248 |
, \ |
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
249 |
$(call CleanupJtregPath, $(wildcard \ |
47932
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
250 |
$(if $(filter /%, $1), \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
251 |
$1 \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
252 |
, \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
253 |
$(addsuffix /$(strip $1), $(JTREG_TESTROOTS) $(TEST_BASEDIRS)) \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
254 |
$(addsuffix $(strip $(patsubst hotspot/%, /hotspot/jtreg/%, $1)), $(JTREG_TESTROOTS) $(TEST_BASEDIRS)) \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
255 |
) \ |
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
256 |
)) \ |
47932
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
257 |
) |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
258 |
|
44027 | 259 |
# Helper function to determine if a test specification is a Jtreg test |
260 |
# |
|
261 |
# It is a Jtreg test if it optionally begins with jtreg:, and then is either |
|
262 |
# an unspecified group name (possibly prefixed by :), or a group in a |
|
47932
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
263 |
# specified test root, or a path to a test or test directory, |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
264 |
# either absolute or relative to any of the TEST_BASEDIRS or test roots. |
44027 | 265 |
define ParseJtregTestSelection |
266 |
$(eval TEST_NAME := $(strip $(patsubst jtreg:%, %, $1))) \ |
|
267 |
$(if $(or $(findstring :, $(TEST_NAME)), $(findstring /, $(TEST_NAME))), , \ |
|
268 |
$(eval TEST_NAME := :$(TEST_NAME)) \ |
|
269 |
) \ |
|
270 |
$(if $(findstring :, $(TEST_NAME)), \ |
|
271 |
$(if $(filter :%, $(TEST_NAME)), \ |
|
47932
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
272 |
$(eval TEST_GROUP := $(patsubst :%, %, $(TEST_NAME))) \ |
48042 | 273 |
$(eval TEST_ROOTS := $(foreach test_root, $(JTREG_TESTROOTS), \ |
274 |
$(call CleanupJtregPath, $(test_root)))) \ |
|
44027 | 275 |
, \ |
47932
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
276 |
$(eval TEST_PATH := $(word 1, $(subst :, $(SPACE), $(TEST_NAME)))) \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
277 |
$(eval TEST_GROUP := $(word 2, $(subst :, $(SPACE), $(TEST_NAME)))) \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
278 |
$(eval TEST_ROOTS := $(call ExpandJtregRoot, $(TEST_PATH))) \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
279 |
) \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
280 |
$(foreach test_root, $(TEST_ROOTS), \ |
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
281 |
$(if $(filter /%, $(test_root)), \ |
47932
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
282 |
jtreg:$(test_root):$(TEST_GROUP) \ |
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
283 |
, \ |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
284 |
$(if $(filter $(TEST_GROUP), $($(JTREG_TOPDIR)/$(test_root)_JTREG_TEST_GROUPS)), \ |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
285 |
jtreg:$(test_root):$(TEST_GROUP) \ |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
286 |
) \ |
44027 | 287 |
) \ |
288 |
) \ |
|
289 |
, \ |
|
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
290 |
$(eval TEST_PATHS := $(call ExpandJtregPath, $(TEST_NAME))) \ |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
291 |
$(foreach test_path, $(TEST_PATHS), \ |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
292 |
jtreg:$(test_path) \ |
44027 | 293 |
) \ |
294 |
) |
|
295 |
endef |
|
296 |
||
48061
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
297 |
# Helper function to determine if a test specification is a special test |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
298 |
# |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
299 |
# It is a special test if it is "special:" followed by a test name. |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
300 |
define ParseSpecialTestSelection |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
301 |
$(if $(filter special:%, $1), \ |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
302 |
$1 \ |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
303 |
) |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
304 |
endef |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
305 |
|
44027 | 306 |
ifeq ($(TEST), ) |
307 |
$(info No test selection given in TEST!) |
|
308 |
$(info Please use e.g. 'run-test TEST=tier1' or 'run-test-tier1') |
|
47928
fb62d4519338
8191715: Update documentation pointing to "common" directory
ihse
parents:
47329
diff
changeset
|
309 |
$(info See doc/testing.[md|html] for help) |
44027 | 310 |
$(error Cannot continue) |
311 |
endif |
|
312 |
||
313 |
# Now intelligently convert the test selection given by the user in TEST |
|
314 |
# into a list of fully qualified test descriptors of the tests to run. |
|
315 |
TESTS_TO_RUN := |
|
316 |
$(foreach test, $(TEST), \ |
|
317 |
$(eval PARSED_TESTS := $(call ParseCustomTestSelection, $(test))) \ |
|
318 |
$(if $(strip $(PARSED_TESTS)), , \ |
|
319 |
$(eval PARSED_TESTS += $(call ParseGtestTestSelection, $(test))) \ |
|
320 |
) \ |
|
321 |
$(if $(strip $(PARSED_TESTS)), , \ |
|
322 |
$(eval PARSED_TESTS += $(call ParseJtregTestSelection, $(test))) \ |
|
323 |
) \ |
|
324 |
$(if $(strip $(PARSED_TESTS)), , \ |
|
48061
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
325 |
$(eval PARSED_TESTS += $(call ParseSpecialTestSelection, $(test))) \ |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
326 |
) \ |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
327 |
$(if $(strip $(PARSED_TESTS)), , \ |
44027 | 328 |
$(eval UNKNOWN_TEST := $(test)) \ |
329 |
) \ |
|
330 |
$(eval TESTS_TO_RUN += $(PARSED_TESTS)) \ |
|
331 |
) |
|
332 |
||
333 |
ifneq ($(UNKNOWN_TEST), ) |
|
334 |
$(info Unknown test selection: '$(UNKNOWN_TEST)') |
|
47928
fb62d4519338
8191715: Update documentation pointing to "common" directory
ihse
parents:
47329
diff
changeset
|
335 |
$(info See doc/testing.[md|html] for help) |
44027 | 336 |
$(error Cannot continue) |
337 |
endif |
|
338 |
||
339 |
TESTS_TO_RUN := $(strip $(TESTS_TO_RUN)) |
|
340 |
||
341 |
||
342 |
# Present the result of our parsing to the user |
|
343 |
$(info Test selection '$(TEST)', will run:) |
|
344 |
$(foreach test, $(TESTS_TO_RUN), $(info * $(test))) |
|
345 |
||
346 |
||
347 |
################################################################################ |
|
348 |
# Functions for setting up rules for running the selected tests |
|
349 |
# |
|
350 |
# The SetupRun*Test functions all have the same interface: |
|
351 |
# |
|
352 |
# Parameter 1 is the name of the rule. This is the test id, based on the test |
|
353 |
# descriptor, and this is also used as variable prefix, and the targets |
|
354 |
# generated are listed in a variable by that name. |
|
355 |
# |
|
356 |
# Remaining parameters are named arguments. Currently this is only: |
|
357 |
# TEST -- The properly formatted fully qualified test descriptor |
|
358 |
# |
|
359 |
# After the rule named by the test id has been executed, the following |
|
360 |
# variables will be available: |
|
361 |
# testid_TOTAL - the total number of tests run |
|
362 |
# testid_PASSED - the number of successful tests |
|
363 |
# testid_FAILED - the number of failed tests |
|
364 |
# testid_ERROR - the number of tests was neither successful or failed |
|
365 |
# |
|
366 |
################################################################################ |
|
367 |
||
368 |
### Rules for Gtest |
|
369 |
||
370 |
SetupRunGtestTest = $(NamedParamsMacroTemplate) |
|
371 |
define SetupRunGtestTestBody |
|
372 |
$1_TEST_RESULTS_DIR := $$(TEST_RESULTS_DIR)/$1 |
|
373 |
$1_TEST_SUPPORT_DIR := $$(TEST_SUPPORT_DIR)/$1 |
|
48042 | 374 |
$1_EXITCODE := $$($1_TEST_RESULTS_DIR)/exitcode.txt |
44027 | 375 |
|
48058
c5eefa465e37
8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents:
48042
diff
changeset
|
376 |
$1_VARIANT := $$(lastword $$(subst /, , $$($1_TEST))) |
c5eefa465e37
8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents:
48042
diff
changeset
|
377 |
ifeq ($$(filter $$($1_VARIANT), $$(GTEST_VARIANTS)), ) |
c5eefa465e37
8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents:
48042
diff
changeset
|
378 |
$$(error Invalid gtest variant '$$($1_VARIANT)'. Valid variants: $$(GTEST_VARIANTS)) |
c5eefa465e37
8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents:
48042
diff
changeset
|
379 |
endif |
c5eefa465e37
8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents:
48042
diff
changeset
|
380 |
$1_TEST_NAME := $$(strip $$(patsubst %/$$($1_VARIANT), %, \ |
c5eefa465e37
8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents:
48042
diff
changeset
|
381 |
$$(patsubst gtest:%, %, $$($1_TEST)))) |
44027 | 382 |
ifneq ($$($1_TEST_NAME), all) |
383 |
$1_GTEST_FILTER := --gtest_filter=$$($1_TEST_NAME)* |
|
384 |
endif |
|
385 |
||
386 |
ifneq ($$(GTEST_REPEAT), ) |
|
387 |
$1_GTEST_REPEAT :=--gtest_repeat=$$(GTEST_REPEAT) |
|
388 |
endif |
|
389 |
||
52125
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
390 |
run-test-$1: $(TEST_PREREQS) |
44027 | 391 |
$$(call LogWarn) |
392 |
$$(call LogWarn, Running test '$$($1_TEST)') |
|
393 |
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR)) |
|
394 |
$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/gtest, \ |
|
48058
c5eefa465e37
8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents:
48042
diff
changeset
|
395 |
$$(FIXPATH) $$(TEST_IMAGE_DIR)/hotspot/gtest/$$($1_VARIANT)/gtestLauncher \ |
52125
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
396 |
-jdk $(JDK_IMAGE_DIR) $$($1_GTEST_FILTER) \ |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
397 |
--gtest_output=xml:$$($1_TEST_RESULTS_DIR)/gtest.xml \ |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
398 |
$$($1_GTEST_REPEAT) $$(GTEST_OPTIONS) $$(GTEST_VM_OPTIONS) \ |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
399 |
$$($1_GTEST_JAVA_OPTIONS) \ |
48042 | 400 |
> >($(TEE) $$($1_TEST_RESULTS_DIR)/gtest.txt) \ |
401 |
&& $$(ECHO) $$$$? > $$($1_EXITCODE) \ |
|
402 |
|| $$(ECHO) $$$$? > $$($1_EXITCODE) \ |
|
403 |
) |
|
44027 | 404 |
|
405 |
$1_RESULT_FILE := $$($1_TEST_RESULTS_DIR)/gtest.txt |
|
406 |
||
407 |
parse-test-$1: run-test-$1 |
|
408 |
$$(call LogWarn, Finished running test '$$($1_TEST)') |
|
409 |
$$(call LogWarn, Test report is stored in $$(strip \ |
|
410 |
$$(subst $$(TOPDIR)/, , $$($1_TEST_RESULTS_DIR)))) |
|
48042 | 411 |
$$(if $$(wildcard $$($1_RESULT_FILE)), \ |
47956
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
412 |
$$(eval $1_TOTAL := $$(shell $$(AWK) '/==========.* tests? from .* \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
413 |
test cases? ran/ { print $$$$2 }' $$($1_RESULT_FILE))) \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
414 |
$$(if $$($1_TOTAL), , $$(eval $1_TOTAL := 0)) \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
415 |
$$(eval $1_PASSED := $$(shell $$(AWK) '/\[ PASSED \] .* tests?./ \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
416 |
{ print $$$$4 }' $$($1_RESULT_FILE))) \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
417 |
$$(if $$($1_PASSED), , $$(eval $1_PASSED := 0)) \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
418 |
$$(eval $1_FAILED := $$(shell $$(AWK) '/\[ FAILED \] .* tests?, \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
419 |
listed below/ { print $$$$4 }' $$($1_RESULT_FILE))) \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
420 |
$$(if $$($1_FAILED), , $$(eval $1_FAILED := 0)) \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
421 |
$$(eval $1_ERROR := $$(shell \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
422 |
$$(EXPR) $$($1_TOTAL) - $$($1_PASSED) - $$($1_FAILED))) \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
423 |
, \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
424 |
$$(eval $1_PASSED := 0) \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
425 |
$$(eval $1_FAILED := 0) \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
426 |
$$(eval $1_ERROR := 1) \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
427 |
$$(eval $1_TOTAL := 1) \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
428 |
) |
44027 | 429 |
|
430 |
$1: run-test-$1 parse-test-$1 |
|
431 |
||
432 |
TARGETS += $1 |
|
433 |
endef |
|
434 |
||
435 |
################################################################################ |
|
436 |
||
437 |
### Rules for Jtreg |
|
438 |
||
439 |
# Helper function for SetupRunJtregTest. Set a JTREG_* variable from, in order: |
|
440 |
# 1) Specified by user on command line |
|
441 |
# 2) Component-specific default |
|
442 |
# 3) Generic default |
|
443 |
# |
|
444 |
# Note: No spaces are allowed around the arguments. |
|
445 |
# Arg $1 The test ID (i.e. $1 in SetupRunJtregTest) |
|
446 |
# Arg $2 Base variable, e.g. JTREG_JOBS |
|
447 |
# Arg $3 The default value (optional) |
|
448 |
define SetJtregValue |
|
449 |
ifneq ($$($2), ) |
|
450 |
$1_$2 := $$($2) |
|
451 |
else |
|
452 |
ifneq ($$($$($1_COMPONENT)_$2), ) |
|
453 |
$1_$2 := $$($$($1_COMPONENT)_$2) |
|
454 |
else |
|
455 |
ifneq ($3, ) |
|
456 |
$1_$2 := $3 |
|
457 |
endif |
|
458 |
endif |
|
459 |
endif |
|
460 |
endef |
|
461 |
||
462 |
SetupRunJtregTest = $(NamedParamsMacroTemplate) |
|
463 |
define SetupRunJtregTestBody |
|
464 |
$1_TEST_RESULTS_DIR := $$(TEST_RESULTS_DIR)/$1 |
|
465 |
$1_TEST_SUPPORT_DIR := $$(TEST_SUPPORT_DIR)/$1 |
|
48042 | 466 |
$1_EXITCODE := $$($1_TEST_RESULTS_DIR)/exitcode.txt |
44027 | 467 |
|
468 |
$1_TEST_NAME := $$(strip $$(patsubst jtreg:%, %, $$($1_TEST))) |
|
47932
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
469 |
|
52125
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
470 |
$1_TEST_ROOT := \ |
47932
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
471 |
$$(strip $$(foreach root, $$(JTREG_TESTROOTS), \ |
52125
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
472 |
$$(if $$(filter $$(root)%, $$(JTREG_TOPDIR)/$$($1_TEST_NAME)), $$(root)) \ |
47932
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
473 |
)) |
52125
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
474 |
$1_COMPONENT := $$(lastword $$(subst /, $$(SPACE), $$($1_TEST_ROOT))) |
47932
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
475 |
# This will work only as long as just hotspot has the additional "jtreg" directory |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
476 |
ifeq ($$($1_COMPONENT), jtreg) |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
477 |
$1_COMPONENT := hotspot |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
478 |
endif |
44027 | 479 |
|
45104 | 480 |
ifeq ($$(JT_HOME), ) |
481 |
$$(info Error: jtreg framework is not found.) |
|
482 |
$$(info Please run configure using --with-jtreg.) |
|
483 |
$$(error Cannot continue) |
|
484 |
endif |
|
485 |
||
44027 | 486 |
# Unfortunately, we need different defaults for some JTREG values, |
487 |
# depending on what component we're running. |
|
488 |
||
489 |
# Convert JTREG_foo into $1_JTREG_foo with a suitable value. |
|
490 |
$$(eval $$(call SetJtregValue,$1,JTREG_TEST_MODE,agentvm)) |
|
491 |
$$(eval $$(call SetJtregValue,$1,JTREG_ASSERT,true)) |
|
492 |
$$(eval $$(call SetJtregValue,$1,JTREG_MAX_MEM,512m)) |
|
493 |
$$(eval $$(call SetJtregValue,$1,JTREG_NATIVEPATH)) |
|
494 |
$$(eval $$(call SetJtregValue,$1,JTREG_BASIC_OPTIONS)) |
|
47941
d91b0d2d45cb
8179554: make run-test does not respect ProblemList.txt
ihse
parents:
47939
diff
changeset
|
495 |
$$(eval $$(call SetJtregValue,$1,JTREG_PROBLEM_LIST)) |
44027 | 496 |
|
52125
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
497 |
# Only the problem list for the current test root should be used. |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
498 |
$1_JTREG_PROBLEM_LIST := $$(filter $$($1_TEST_ROOT)%, $$($1_JTREG_PROBLEM_LIST)) |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
499 |
|
44027 | 500 |
ifneq ($(TEST_JOBS), 0) |
501 |
$$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(TEST_JOBS))) |
|
502 |
else |
|
503 |
$$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(JOBS))) |
|
504 |
endif |
|
505 |
||
47058
85aaac5701da
8186248: Allow more flexibility in selecting Heap % of available RAM
bobv
parents:
46230
diff
changeset
|
506 |
# Make sure MaxRAMPercentage is high enough to not cause OOM or swapping since |
44027 | 507 |
# we may end up with a lot of JVM's |
47058
85aaac5701da
8186248: Allow more flexibility in selecting Heap % of available RAM
bobv
parents:
46230
diff
changeset
|
508 |
$1_JTREG_MAX_RAM_PERCENTAGE := $$(shell $$(EXPR) 25 / $$($1_JTREG_JOBS)) |
44027 | 509 |
|
52125
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
510 |
JTREG_TIMEOUT_FACTOR ?= 4 |
44027 | 511 |
JTREG_VERBOSE ?= fail,error,summary |
512 |
JTREG_RETAIN ?= fail,error |
|
513 |
||
514 |
ifneq ($$($1_JTREG_MAX_MEM), 0) |
|
515 |
$1_JTREG_BASIC_OPTIONS += -vmoption:-Xmx$$($1_JTREG_MAX_MEM) |
|
516 |
$1_JTREG_LAUNCHER_OPTIONS += -Xmx$$($1_JTREG_MAX_MEM) |
|
517 |
endif |
|
518 |
||
519 |
$1_JTREG_BASIC_OPTIONS += -$$($1_JTREG_TEST_MODE) \ |
|
520 |
-verbose:$$(JTREG_VERBOSE) -retain:$$(JTREG_RETAIN) \ |
|
52125
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
521 |
-concurrency:$$($1_JTREG_JOBS) -timeoutFactor:$$(JTREG_TIMEOUT_FACTOR) \ |
47058
85aaac5701da
8186248: Allow more flexibility in selecting Heap % of available RAM
bobv
parents:
46230
diff
changeset
|
522 |
-vmoption:-XX:MaxRAMPercentage=$$($1_JTREG_MAX_RAM_PERCENTAGE) |
44027 | 523 |
|
52125
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
524 |
$1_JTREG_BASIC_OPTIONS += -automatic -ignore:quiet |
44027 | 525 |
|
47329 | 526 |
# Make it possible to specify the JIB_DATA_DIR for tests using the |
527 |
# JIB Artifact resolver |
|
528 |
$1_JTREG_BASIC_OPTIONS += -e:JIB_DATA_DIR |
|
44027 | 529 |
# Some tests needs to find a boot JDK using the JDK8_HOME variable. |
530 |
$1_JTREG_BASIC_OPTIONS += -e:JDK8_HOME=$$(BOOT_JDK) |
|
49147
af37d9997bd6
8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents:
48061
diff
changeset
|
531 |
# If running on Windows, propagate the _NT_SYMBOL_PATH to enable |
af37d9997bd6
8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents:
48061
diff
changeset
|
532 |
# symbol lookup in hserr files |
af37d9997bd6
8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents:
48061
diff
changeset
|
533 |
ifeq ($$(OPENJDK_TARGET_OS), windows) |
af37d9997bd6
8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents:
48061
diff
changeset
|
534 |
$1_JTREG_BASIC_OPTIONS += -e:_NT_SYMBOL_PATH |
af37d9997bd6
8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents:
48061
diff
changeset
|
535 |
endif |
44027 | 536 |
|
537 |
$1_JTREG_BASIC_OPTIONS += \ |
|
538 |
$$(addprefix -javaoption:, $$(JTREG_JAVA_OPTIONS)) \ |
|
539 |
$$(addprefix -vmoption:, $$(JTREG_VM_OPTIONS)) \ |
|
540 |
# |
|
541 |
||
542 |
ifeq ($$($1_JTREG_ASSERT), true) |
|
543 |
$1_JTREG_BASIC_OPTIONS += -ea -esa |
|
544 |
endif |
|
545 |
||
546 |
ifneq ($$($1_JTREG_NATIVEPATH), ) |
|
547 |
$1_JTREG_BASIC_OPTIONS += -nativepath:$$($1_JTREG_NATIVEPATH) |
|
548 |
endif |
|
549 |
||
47941
d91b0d2d45cb
8179554: make run-test does not respect ProblemList.txt
ihse
parents:
47939
diff
changeset
|
550 |
ifneq ($$($1_JTREG_PROBLEM_LIST), ) |
d91b0d2d45cb
8179554: make run-test does not respect ProblemList.txt
ihse
parents:
47939
diff
changeset
|
551 |
$1_JTREG_BASIC_OPTIONS += $$(addprefix -exclude:, $$($1_JTREG_PROBLEM_LIST)) |
d91b0d2d45cb
8179554: make run-test does not respect ProblemList.txt
ihse
parents:
47939
diff
changeset
|
552 |
endif |
d91b0d2d45cb
8179554: make run-test does not respect ProblemList.txt
ihse
parents:
47939
diff
changeset
|
553 |
|
52125
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
554 |
ifneq ($$(JTREG_EXTRA_PROBLEM_LISTS), ) |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
555 |
# Accept both absolute paths as well as relative to the current test root. |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
556 |
$1_JTREG_BASIC_OPTIONS += $$(addprefix -exclude:, $$(wildcard \ |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
557 |
$$(JTREG_EXTRA_PROBLEM_LISTS) \ |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
558 |
$$(addprefix $$($1_TEST_ROOT)/, $$(JTREG_EXTRA_PROBLEM_LISTS)) \ |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
559 |
)) |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
560 |
endif |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
561 |
|
51856
11b9d3a6f31c
8211037: Load jib jars dynamically from JibArtifactManager
erikj
parents:
50908
diff
changeset
|
562 |
ifneq ($$(JIB_HOME), ) |
11b9d3a6f31c
8211037: Load jib jars dynamically from JibArtifactManager
erikj
parents:
50908
diff
changeset
|
563 |
$1_JTREG_BASIC_OPTIONS += -e:JIB_HOME=$$(JIB_HOME) |
46230
e0ca0417b74d
8180600: make run-test does not work with jib test dependencies
erikj
parents:
45104
diff
changeset
|
564 |
endif |
e0ca0417b74d
8180600: make run-test does not work with jib test dependencies
erikj
parents:
45104
diff
changeset
|
565 |
|
50908 | 566 |
$1_JTREG_BASIC_OPTIONS += -e:TEST_IMAGE_GRAAL_DIR=${TEST_IMAGE_DIR}/hotspot/jtreg/graal |
567 |
||
47986 | 568 |
ifneq ($$(JTREG_FAILURE_HANDLER_OPTIONS), ) |
569 |
$1_JTREG_LAUNCHER_OPTIONS += -Djava.library.path="$(JTREG_FAILURE_HANDLER_DIR)" |
|
570 |
endif |
|
571 |
||
52125
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
572 |
ifneq ($$(JTREG_KEYWORDS), ) |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
573 |
# The keywords string may contain problematic characters and may be quoted |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
574 |
# already when it arrives here. Remove any existing quotes and replace them |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
575 |
# with one set of single quotes. |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
576 |
$1_JTREG_KEYWORDS := \ |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
577 |
$$(strip $$(subst $$(SQUOTE),,$$(subst $$(DQUOTE),,$$(JTREG_KEYWORDS)))) |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
578 |
ifneq ($$($1_JTREG_KEYWORDS), ) |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
579 |
$1_JTREG_BASIC_OPTIONS += -k:'$$($1_JTREG_KEYWORDS)' |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
580 |
endif |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
581 |
endif |
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
582 |
|
47939
fe7596497fb0
8179555: make run-test should always use a fresh, clean JTwork directory
ihse
parents:
47938
diff
changeset
|
583 |
clean-workdir-$1: |
fe7596497fb0
8179555: make run-test should always use a fresh, clean JTwork directory
ihse
parents:
47938
diff
changeset
|
584 |
$$(RM) -r $$($1_TEST_SUPPORT_DIR) |
fe7596497fb0
8179555: make run-test should always use a fresh, clean JTwork directory
ihse
parents:
47938
diff
changeset
|
585 |
|
52125
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
586 |
run-test-$1: clean-workdir-$1 $(TEST_PREREQS) |
44027 | 587 |
$$(call LogWarn) |
588 |
$$(call LogWarn, Running test '$$($1_TEST)') |
|
589 |
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR)) |
|
590 |
$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/jtreg, \ |
|
591 |
$$(JAVA) $$($1_JTREG_LAUNCHER_OPTIONS) \ |
|
592 |
-Dprogram=jtreg -jar $$(JT_HOME)/lib/jtreg.jar \ |
|
593 |
$$($1_JTREG_BASIC_OPTIONS) \ |
|
594 |
-testjdk:$$(JDK_IMAGE_DIR) \ |
|
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
595 |
-dir:$$(JTREG_TOPDIR) \ |
44027 | 596 |
-reportDir:$$($1_TEST_RESULTS_DIR) \ |
597 |
-workDir:$$($1_TEST_SUPPORT_DIR) \ |
|
598 |
$$(JTREG_OPTIONS) \ |
|
47986 | 599 |
$$(JTREG_FAILURE_HANDLER_OPTIONS) \ |
48042 | 600 |
$$($1_TEST_NAME) \ |
601 |
&& $$(ECHO) $$$$? > $$($1_EXITCODE) \ |
|
602 |
|| $$(ECHO) $$$$? > $$($1_EXITCODE) \ |
|
603 |
) |
|
44027 | 604 |
|
605 |
$1_RESULT_FILE := $$($1_TEST_RESULTS_DIR)/text/stats.txt |
|
606 |
||
607 |
parse-test-$1: run-test-$1 |
|
608 |
$$(call LogWarn, Finished running test '$$($1_TEST)') |
|
609 |
$$(call LogWarn, Test report is stored in $$(strip \ |
|
610 |
$$(subst $$(TOPDIR)/, , $$($1_TEST_RESULTS_DIR)))) |
|
48042 | 611 |
$$(if $$(wildcard $$($1_RESULT_FILE)), \ |
47259
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
612 |
$$(eval $1_PASSED := $$(shell $$(AWK) '{ gsub(/[,;]/, ""); \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
613 |
for (i=1; i<=NF; i++) { if ($$$$i == "passed:") \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
614 |
print $$$$(i+1) } }' $$($1_RESULT_FILE))) \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
615 |
$$(if $$($1_PASSED), , $$(eval $1_PASSED := 0)) \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
616 |
$$(eval $1_FAILED := $$(shell $$(AWK) '{gsub(/[,;]/, ""); \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
617 |
for (i=1; i<=NF; i++) { if ($$$$i == "failed:") \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
618 |
print $$$$(i+1) } }' $$($1_RESULT_FILE))) \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
619 |
$$(if $$($1_FAILED), , $$(eval $1_FAILED := 0)) \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
620 |
$$(eval $1_ERROR := $$(shell $$(AWK) '{gsub(/[,;]/, ""); \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
621 |
for (i=1; i<=NF; i++) { if ($$$$i == "error:") \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
622 |
print $$$$(i+1) } }' $$($1_RESULT_FILE))) \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
623 |
$$(if $$($1_ERROR), , $$(eval $1_ERROR := 0)) \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
624 |
$$(eval $1_TOTAL := $$(shell \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
625 |
$$(EXPR) $$($1_PASSED) + $$($1_FAILED) + $$($1_ERROR))) \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
626 |
, \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
627 |
$$(eval $1_PASSED := 0) \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
628 |
$$(eval $1_FAILED := 0) \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
629 |
$$(eval $1_ERROR := 1) \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
630 |
$$(eval $1_TOTAL := 1) \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
631 |
) |
44027 | 632 |
|
633 |
$1: run-test-$1 parse-test-$1 |
|
634 |
||
635 |
TARGETS += $1 |
|
636 |
endef |
|
637 |
||
48061
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
638 |
################################################################################ |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
639 |
|
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
640 |
### Rules for special tests |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
641 |
|
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
642 |
SetupRunSpecialTest = $(NamedParamsMacroTemplate) |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
643 |
define SetupRunSpecialTestBody |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
644 |
$1_TEST_RESULTS_DIR := $$(TEST_RESULTS_DIR)/$1 |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
645 |
$1_TEST_SUPPORT_DIR := $$(TEST_SUPPORT_DIR)/$1 |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
646 |
$1_EXITCODE := $$($1_TEST_RESULTS_DIR)/exitcode.txt |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
647 |
|
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
648 |
$1_FULL_TEST_NAME := $$(strip $$(patsubst special:%, %, $$($1_TEST))) |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
649 |
ifneq ($$(findstring :, $$($1_FULL_TEST_NAME)), ) |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
650 |
$1_TEST_NAME := $$(firstword $$(subst :, ,$$($1_FULL_TEST_NAME))) |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
651 |
$1_TEST_ARGS := $$(strip $$(patsubst special:$$($1_TEST_NAME):%, %, $$($1_TEST))) |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
652 |
else |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
653 |
$1_TEST_NAME := $$($1_FULL_TEST_NAME) |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
654 |
$1_TEST_ARGS := |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
655 |
endif |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
656 |
|
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
657 |
ifeq ($$($1_TEST_NAME), hotspot-internal) |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
658 |
$1_TEST_COMMAND_LINE := \ |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
659 |
$$(JDK_IMAGE_DIR)/bin/java -XX:+ExecuteInternalVMTests \ |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
660 |
-XX:+ShowMessageBoxOnError -version |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
661 |
else ifeq ($$($1_TEST_NAME), failure-handler) |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
662 |
$1_TEST_COMMAND_LINE := \ |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
663 |
($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f \ |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
664 |
BuildFailureHandler.gmk test) |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
665 |
else ifeq ($$($1_TEST_NAME), make) |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
666 |
$1_TEST_COMMAND_LINE := \ |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
667 |
($(CD) $(TOPDIR)/test/make && $(MAKE) $(MAKE_ARGS) -f \ |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
668 |
TestMake.gmk $$($1_TEST_ARGS)) |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
669 |
else |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
670 |
$$(error Invalid special test specification: $$($1_TEST_NAME)) |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
671 |
endif |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
672 |
|
52125
28375a1de254
8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents:
51856
diff
changeset
|
673 |
run-test-$1: $(TEST_PREREQS) |
48061
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
674 |
$$(call LogWarn) |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
675 |
$$(call LogWarn, Running test '$$($1_TEST)') |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
676 |
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR)) |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
677 |
$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/test-execution, \ |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
678 |
$$($1_TEST_COMMAND_LINE) \ |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
679 |
> >($(TEE) $$($1_TEST_RESULTS_DIR)/test-output.txt) \ |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
680 |
&& $$(ECHO) $$$$? > $$($1_EXITCODE) \ |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
681 |
|| $$(ECHO) $$$$? > $$($1_EXITCODE) \ |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
682 |
) |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
683 |
|
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
684 |
$1_RESULT_FILE := $$($1_TEST_RESULTS_DIR)/gtest.txt |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
685 |
|
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
686 |
# We can not parse the various "special" tests. |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
687 |
parse-test-$1: run-test-$1 |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
688 |
$$(call LogWarn, Finished running test '$$($1_TEST)') |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
689 |
$$(call LogWarn, Test report is stored in $$(strip \ |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
690 |
$$(subst $$(TOPDIR)/, , $$($1_TEST_RESULTS_DIR)))) |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
691 |
$$(call LogWarn, Warning: Special test results are not properly parsed!) |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
692 |
$$(eval $1_PASSED := 0) |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
693 |
$$(eval $1_FAILED := 0) |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
694 |
$$(eval $1_ERROR := 0) |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
695 |
$$(eval $1_TOTAL := 0) |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
696 |
|
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
697 |
$1: run-test-$1 parse-test-$1 |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
698 |
|
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
699 |
TARGETS += $1 |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
700 |
endef |
44027 | 701 |
|
702 |
################################################################################ |
|
703 |
# Setup and execute make rules for all selected tests |
|
704 |
################################################################################ |
|
705 |
||
706 |
# Helper function to determine which handler to use for the given test |
|
707 |
UseGtestTestHandler = \ |
|
708 |
$(if $(filter gtest:%, $1), true) |
|
709 |
||
710 |
UseJtregTestHandler = \ |
|
711 |
$(if $(filter jtreg:%, $1), true) |
|
712 |
||
48061
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
713 |
UseSpecialTestHandler = \ |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
714 |
$(if $(filter special:%, $1), true) |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
715 |
|
44027 | 716 |
# Now process each test to run and setup a proper make rule |
717 |
$(foreach test, $(TESTS_TO_RUN), \ |
|
718 |
$(eval TEST_ID := $(shell $(ECHO) $(strip $(test)) | \ |
|
48042 | 719 |
$(TR) -cs '[a-z][A-Z][0-9]\n' '[_*1000]')) \ |
44027 | 720 |
$(eval ALL_TEST_IDS += $(TEST_ID)) \ |
721 |
$(if $(call UseCustomTestHandler, $(test)), \ |
|
722 |
$(eval $(call SetupRunCustomTest, $(TEST_ID), \ |
|
723 |
TEST := $(test), \ |
|
724 |
)) \ |
|
725 |
) \ |
|
726 |
$(if $(call UseGtestTestHandler, $(test)), \ |
|
727 |
$(eval $(call SetupRunGtestTest, $(TEST_ID), \ |
|
728 |
TEST := $(test), \ |
|
729 |
)) \ |
|
730 |
) \ |
|
731 |
$(if $(call UseJtregTestHandler, $(test)), \ |
|
732 |
$(eval $(call SetupRunJtregTest, $(TEST_ID), \ |
|
733 |
TEST := $(test), \ |
|
734 |
)) \ |
|
735 |
) \ |
|
48061
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
736 |
$(if $(call UseSpecialTestHandler, $(test)), \ |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
737 |
$(eval $(call SetupRunSpecialTest, $(TEST_ID), \ |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
738 |
TEST := $(test), \ |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
739 |
)) \ |
665769d3cee4
8193014: Add "special" tests to run-test to cover odd cases
ihse
parents:
48058
diff
changeset
|
740 |
) \ |
44027 | 741 |
) |
742 |
||
743 |
# Sort also removes duplicates, so if there is any we'll get fewer words. |
|
744 |
ifneq ($(words $(ALL_TEST_IDS)), $(words $(sort $(ALL_TEST_IDS)))) |
|
745 |
$(error Duplicate test specification) |
|
746 |
endif |
|
747 |
||
748 |
||
749 |
################################################################################ |
|
750 |
# The main target for RunTests.gmk |
|
751 |
################################################################################ |
|
752 |
||
753 |
# The SetupRun*Test functions have populated TARGETS. |
|
754 |
||
755 |
TEST_FAILURE := false |
|
756 |
||
757 |
run-test: $(TARGETS) |
|
47943 | 758 |
# Create and print a table of the result of all tests run |
759 |
$(RM) $(TEST_SUMMARY).old 2> /dev/null |
|
760 |
$(MV) $(TEST_SUMMARY) $(TEST_SUMMARY).old 2> /dev/null || true |
|
48042 | 761 |
$(RM) $(TEST_LAST_IDS).old 2> /dev/null |
762 |
$(MV) $(TEST_LAST_IDS) $(TEST_LAST_IDS).old 2> /dev/null || true |
|
47943 | 763 |
$(ECHO) >> $(TEST_SUMMARY) ============================== |
764 |
$(ECHO) >> $(TEST_SUMMARY) Test summary |
|
765 |
$(ECHO) >> $(TEST_SUMMARY) ============================== |
|
766 |
$(PRINTF) >> $(TEST_SUMMARY) "%2s %-49s %5s %5s %5s %5s %2s\n" " " \ |
|
767 |
TEST TOTAL PASS FAIL ERROR " " |
|
44027 | 768 |
$(foreach test, $(TESTS_TO_RUN), \ |
769 |
$(eval TEST_ID := $(shell $(ECHO) $(strip $(test)) | \ |
|
48042 | 770 |
$(TR) -cs '[a-z][A-Z][0-9]\n' '[_*1000]')) \ |
771 |
$(ECHO) >> $(TEST_LAST_IDS) $(TEST_ID) $(NEWLINE) \ |
|
772 |
$(eval NAME_PATTERN := $(shell $(ECHO) $(test) | $(TR) -c '\n' '[_*1000]')) \ |
|
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
773 |
$(if $(filter __________________________________________________%, $(NAME_PATTERN)), \ |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
774 |
$(eval TEST_NAME := ) \ |
47943 | 775 |
$(PRINTF) >> $(TEST_SUMMARY) "%2s %-49s\n" " " "$(test)" $(NEWLINE) \ |
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
776 |
, \ |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
777 |
$(eval TEST_NAME := $(test)) \ |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
778 |
) \ |
44027 | 779 |
$(if $(filter $($(TEST_ID)_PASSED), $($(TEST_ID)_TOTAL)), \ |
47943 | 780 |
$(PRINTF) >> $(TEST_SUMMARY) "%2s %-49s %5d %5d %5d %5d %2s\n" \ |
781 |
" " "$(TEST_NAME)" $($(TEST_ID)_TOTAL) $($(TEST_ID)_PASSED) \ |
|
782 |
$($(TEST_ID)_FAILED) $($(TEST_ID)_ERROR) " " $(NEWLINE) \ |
|
44027 | 783 |
, \ |
47943 | 784 |
$(PRINTF) >> $(TEST_SUMMARY) "%2s %-49s %5d %5d %5d %5d %2s\n" \ |
785 |
">>" "$(TEST_NAME)" $($(TEST_ID)_TOTAL) $($(TEST_ID)_PASSED) \ |
|
786 |
$($(TEST_ID)_FAILED) $($(TEST_ID)_ERROR) "<<" $(NEWLINE) \ |
|
44027 | 787 |
$(eval TEST_FAILURE := true) \ |
788 |
) \ |
|
789 |
) |
|
47943 | 790 |
$(ECHO) >> $(TEST_SUMMARY) ============================== |
44027 | 791 |
$(if $(filter true, $(TEST_FAILURE)), \ |
47943 | 792 |
$(ECHO) >> $(TEST_SUMMARY) TEST FAILURE $(NEWLINE) \ |
793 |
$(MKDIR) -p $(MAKESUPPORT_OUTPUTDIR) $(NEWLINE) \ |
|
44027 | 794 |
$(TOUCH) $(MAKESUPPORT_OUTPUTDIR)/exit-with-error \ |
795 |
, \ |
|
47943 | 796 |
$(ECHO) >> $(TEST_SUMMARY) TEST SUCCESS \ |
44027 | 797 |
) |
798 |
$(ECHO) |
|
47943 | 799 |
$(CAT) $(TEST_SUMMARY) |
800 |
$(ECHO) |
|
44027 | 801 |
|
802 |
################################################################################ |
|
803 |
||
804 |
all: run-test |
|
805 |
||
806 |
.PHONY: default all run-test $(TARGETS) |