author | ihse |
Wed, 29 Nov 2017 22:40:23 +0100 | |
branch | ihse-testmakefiles-branch |
changeset 55916 | 8cda3ed38148 |
parent 55915 | edbc895d637b |
parent 47986 | 45c5d7817e9e |
child 55917 | 2ac7a4ba6adf |
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, \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
48 |
KEYWORDS := JOBS TIMEOUT, \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
49 |
STRING_KEYWORDS := VM_OPTIONS, \ |
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 |
|
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
63 |
################################################################################ |
44027 | 64 |
# Hook to include the corresponding custom file, if present. |
47314 | 65 |
$(eval $(call IncludeCustomExtension, RunTests.gmk)) |
47956
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
66 |
################################################################################ |
44027 | 67 |
|
47253
92fd0e04e0e1
8187544: Replace BUILD_OUTPUT and OUTPUT_ROOT with OUTPUTDIR
ihse
parents:
47218
diff
changeset
|
68 |
TEST_RESULTS_DIR := $(OUTPUTDIR)/test-results |
92fd0e04e0e1
8187544: Replace BUILD_OUTPUT and OUTPUT_ROOT with OUTPUTDIR
ihse
parents:
47218
diff
changeset
|
69 |
TEST_SUPPORT_DIR := $(OUTPUTDIR)/test-support |
47943 | 70 |
TEST_SUMMARY := $(TEST_RESULTS_DIR)/test-summary.txt |
55899 | 71 |
TEST_LAST_IDS := $(TEST_SUPPORT_DIR)/test-last-ids.txt |
44027 | 72 |
|
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
73 |
ifeq ($(CUSTOM_ROOT), ) |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
74 |
JTREG_TOPDIR := $(TOPDIR) |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
75 |
else |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
76 |
JTREG_TOPDIR := $(CUSTOM_ROOT) |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
77 |
endif |
44027 | 78 |
|
47986 | 79 |
JTREG_FAILURE_HANDLER_DIR := $(TEST_IMAGE_DIR)/failure_handler |
80 |
JTREG_FAILURE_HANDLER := $(JTREG_FAILURE_HANDLER_DIR)/jtregFailureHandler.jar |
|
81 |
||
82 |
ifneq ($(wildcard $(JTREG_FAILURE_HANDLER)), ) |
|
83 |
JTREG_FAILURE_HANDLER_OPTIONS := \ |
|
84 |
-timeoutHandlerDir:$(JTREG_FAILURE_HANDLER) \ |
|
85 |
-observerDir:$(JTREG_FAILURE_HANDLER) \ |
|
86 |
-timeoutHandler:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler \ |
|
87 |
-observer:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver \ |
|
88 |
-timeoutHandlerTimeout:0 |
|
89 |
endif |
|
90 |
||
44027 | 91 |
################################################################################ |
92 |
# Parse control variables |
|
93 |
################################################################################ |
|
94 |
||
47956
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
95 |
ifneq ($(TEST_OPTS), ) |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
96 |
# Inform the user |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
97 |
$(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
|
98 |
|
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
99 |
$(eval $(call SetTestOpt,VM_OPTIONS,JTREG)) |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
100 |
$(eval $(call SetTestOpt,VM_OPTIONS,GTEST)) |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
101 |
|
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
102 |
$(eval $(call SetTestOpt,JOBS,JTREG)) |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
103 |
$(eval $(call SetTestOpt,TIMEOUT,JTREG)) |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
104 |
endif |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
105 |
|
44027 | 106 |
$(eval $(call ParseKeywordVariable, JTREG, \ |
107 |
KEYWORDS := JOBS TIMEOUT TEST_MODE ASSERT VERBOSE RETAIN MAX_MEM, \ |
|
108 |
STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS, \ |
|
109 |
)) |
|
110 |
||
111 |
ifneq ($(JTREG), ) |
|
112 |
# Inform the user |
|
113 |
$(info Running tests using JTREG control variable '$(JTREG)') |
|
114 |
endif |
|
115 |
||
116 |
$(eval $(call ParseKeywordVariable, GTEST, \ |
|
117 |
KEYWORDS := REPEAT, \ |
|
47956
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
118 |
STRING_KEYWORDS := OPTIONS VM_OPTIONS, \ |
44027 | 119 |
)) |
120 |
||
121 |
ifneq ($(GTEST), ) |
|
122 |
# Inform the user |
|
123 |
$(info Running tests using GTEST control variable '$(GTEST)') |
|
124 |
endif |
|
125 |
||
126 |
||
127 |
################################################################################ |
|
128 |
# Component-specific Jtreg settings |
|
129 |
################################################################################ |
|
130 |
||
131 |
ifeq ($(TEST_JOBS), 0) |
|
132 |
# If TEST_JOBS is not specified, hotspot fallback default is |
|
133 |
# min(num_cores / 2, 12). |
|
134 |
hotspot_JTREG_JOBS := $(shell $(EXPR) $(NUM_CORES) / 2) |
|
135 |
ifeq ($(hotspot_JTREG_JOBS), 0) |
|
136 |
hotspot_JTREG_JOBS := 1 |
|
137 |
else ifeq ($(shell $(EXPR) $(hotspot_JTREG_JOBS) \> 12), 1) |
|
138 |
hotspot_JTREG_JOBS := 12 |
|
139 |
endif |
|
140 |
endif |
|
141 |
||
142 |
hotspot_JTREG_MAX_MEM := 0 |
|
143 |
hotspot_JTREG_ASSERT := false |
|
144 |
hotspot_JTREG_NATIVEPATH := $(TEST_IMAGE_DIR)/hotspot/jtreg/native |
|
145 |
jdk_JTREG_NATIVEPATH := $(TEST_IMAGE_DIR)/jdk/jtreg/native |
|
146 |
||
47941
d91b0d2d45cb
8179554: make run-test does not respect ProblemList.txt
ihse
parents:
47939
diff
changeset
|
147 |
jdk_JTREG_PROBLEM_LIST += $(TOPDIR)/test/jdk/ProblemList.txt |
d91b0d2d45cb
8179554: make run-test does not respect ProblemList.txt
ihse
parents:
47939
diff
changeset
|
148 |
jaxp_JTREG_PROBLEM_LIST += $(TOPDIR)/test/jaxp/ProblemList.txt |
d91b0d2d45cb
8179554: make run-test does not respect ProblemList.txt
ihse
parents:
47939
diff
changeset
|
149 |
langtools_JTREG_PROBLEM_LIST += $(TOPDIR)/test/langtools/ProblemList.txt |
d91b0d2d45cb
8179554: make run-test does not respect ProblemList.txt
ihse
parents:
47939
diff
changeset
|
150 |
nashorn_JTREG_PROBLEM_LIST += $(TOPDIR)/test/nashorn/ProblemList.txt |
d91b0d2d45cb
8179554: make run-test does not respect ProblemList.txt
ihse
parents:
47939
diff
changeset
|
151 |
hotspot_JTREG_PROBLEM_LIST += $(TOPDIR)/test/hotspot/jtreg/ProblemList.txt |
44027 | 152 |
|
153 |
################################################################################ |
|
154 |
# Parse test selection |
|
155 |
# |
|
156 |
# The user has given a test selection in the TEST variable. We must parse it |
|
157 |
# and determine what that means in terms of actual calls to the test framework. |
|
158 |
# |
|
159 |
# The parse functions take as argument a test specification as given by the |
|
160 |
# user, and returns a fully qualified test descriptor if it was a match, or |
|
161 |
# nothing if not. A single test specification can result in multiple test |
|
162 |
# descriptors being returned. A valid test descriptor must always be accepted |
|
163 |
# and returned identically. |
|
164 |
################################################################################ |
|
165 |
||
166 |
# Helper function to determine if a test specification is a Gtest test |
|
167 |
# |
|
168 |
# It is a Gtest test if it is either "gtest", or "gtest:" followed by an optional |
|
169 |
# test filter string. |
|
170 |
define ParseGtestTestSelection |
|
171 |
$(if $(filter gtest%, $1), \ |
|
172 |
$(if $(filter gtest, $1), \ |
|
173 |
gtest:all \ |
|
174 |
, \ |
|
175 |
$(if $(filter gtest:, $1), \ |
|
176 |
gtest:all \ |
|
177 |
, \ |
|
178 |
$1 \ |
|
179 |
) \ |
|
180 |
) \ |
|
181 |
) |
|
182 |
endef |
|
183 |
||
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
184 |
# 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
|
185 |
CleanupJtregPath = \ |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
186 |
$(strip $(patsubst %/, %, $(subst $(JTREG_TOPDIR)/,, $1))) |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
187 |
|
47932
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
188 |
# 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
|
189 |
# 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
|
190 |
ExpandJtregRoot = \ |
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
191 |
$(call CleanupJtregPath, $(wildcard \ |
47932
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
192 |
$(if $(filter /%, $1), \ |
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
193 |
$(if $(wildcard $(strip $1)/TEST.ROOT), \ |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
194 |
$1 \ |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
195 |
) \ |
47932
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
196 |
, \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
197 |
$(filter $(addprefix %, $1), $(JTREG_TESTROOTS) $(addsuffix /, $(JTREG_TESTROOTS))) \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
198 |
$(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
|
199 |
) \ |
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
200 |
)) |
47932
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
201 |
|
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
202 |
# 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
|
203 |
# 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
|
204 |
ExpandJtregPath = \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
205 |
$(if $(call ExpandJtregRoot, $1), \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
206 |
$(call ExpandJtregRoot, $1) \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
207 |
, \ |
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
208 |
$(call CleanupJtregPath, $(wildcard \ |
47932
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
209 |
$(if $(filter /%, $1), \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
210 |
$1 \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
211 |
, \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
212 |
$(addsuffix /$(strip $1), $(JTREG_TESTROOTS) $(TEST_BASEDIRS)) \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
213 |
$(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
|
214 |
) \ |
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
215 |
)) \ |
47932
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
216 |
) |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
217 |
|
44027 | 218 |
# Helper function to determine if a test specification is a Jtreg test |
219 |
# |
|
220 |
# It is a Jtreg test if it optionally begins with jtreg:, and then is either |
|
221 |
# 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
|
222 |
# 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
|
223 |
# either absolute or relative to any of the TEST_BASEDIRS or test roots. |
44027 | 224 |
define ParseJtregTestSelection |
225 |
$(eval TEST_NAME := $(strip $(patsubst jtreg:%, %, $1))) \ |
|
226 |
$(if $(or $(findstring :, $(TEST_NAME)), $(findstring /, $(TEST_NAME))), , \ |
|
227 |
$(eval TEST_NAME := :$(TEST_NAME)) \ |
|
228 |
) \ |
|
229 |
$(if $(findstring :, $(TEST_NAME)), \ |
|
230 |
$(if $(filter :%, $(TEST_NAME)), \ |
|
47932
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
231 |
$(eval TEST_GROUP := $(patsubst :%, %, $(TEST_NAME))) \ |
55897 | 232 |
$(eval TEST_ROOTS := $(foreach test_root, $(JTREG_TESTROOTS), \ |
233 |
$(call CleanupJtregPath, $(test_root)))) \ |
|
44027 | 234 |
, \ |
47932
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
235 |
$(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
|
236 |
$(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
|
237 |
$(eval TEST_ROOTS := $(call ExpandJtregRoot, $(TEST_PATH))) \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
238 |
) \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
239 |
$(foreach test_root, $(TEST_ROOTS), \ |
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
240 |
$(if $(filter /%, $(test_root)), \ |
47932
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
241 |
jtreg:$(test_root):$(TEST_GROUP) \ |
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
242 |
, \ |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
243 |
$(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
|
244 |
jtreg:$(test_root):$(TEST_GROUP) \ |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
245 |
) \ |
44027 | 246 |
) \ |
247 |
) \ |
|
248 |
, \ |
|
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
249 |
$(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
|
250 |
$(foreach test_path, $(TEST_PATHS), \ |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
251 |
jtreg:$(test_path) \ |
44027 | 252 |
) \ |
253 |
) |
|
254 |
endef |
|
255 |
||
256 |
ifeq ($(TEST), ) |
|
257 |
$(info No test selection given in TEST!) |
|
258 |
$(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
|
259 |
$(info See doc/testing.[md|html] for help) |
44027 | 260 |
$(error Cannot continue) |
261 |
endif |
|
262 |
||
263 |
# Now intelligently convert the test selection given by the user in TEST |
|
264 |
# into a list of fully qualified test descriptors of the tests to run. |
|
265 |
TESTS_TO_RUN := |
|
266 |
$(foreach test, $(TEST), \ |
|
267 |
$(eval PARSED_TESTS := $(call ParseCustomTestSelection, $(test))) \ |
|
268 |
$(if $(strip $(PARSED_TESTS)), , \ |
|
269 |
$(eval PARSED_TESTS += $(call ParseGtestTestSelection, $(test))) \ |
|
270 |
) \ |
|
271 |
$(if $(strip $(PARSED_TESTS)), , \ |
|
272 |
$(eval PARSED_TESTS += $(call ParseJtregTestSelection, $(test))) \ |
|
273 |
) \ |
|
274 |
$(if $(strip $(PARSED_TESTS)), , \ |
|
275 |
$(eval UNKNOWN_TEST := $(test)) \ |
|
276 |
) \ |
|
277 |
$(eval TESTS_TO_RUN += $(PARSED_TESTS)) \ |
|
278 |
) |
|
279 |
||
280 |
ifneq ($(UNKNOWN_TEST), ) |
|
281 |
$(info Unknown test selection: '$(UNKNOWN_TEST)') |
|
47928
fb62d4519338
8191715: Update documentation pointing to "common" directory
ihse
parents:
47329
diff
changeset
|
282 |
$(info See doc/testing.[md|html] for help) |
44027 | 283 |
$(error Cannot continue) |
284 |
endif |
|
285 |
||
286 |
TESTS_TO_RUN := $(strip $(TESTS_TO_RUN)) |
|
287 |
||
288 |
||
289 |
# Present the result of our parsing to the user |
|
290 |
$(info Test selection '$(TEST)', will run:) |
|
291 |
$(foreach test, $(TESTS_TO_RUN), $(info * $(test))) |
|
292 |
||
293 |
||
294 |
################################################################################ |
|
295 |
# Functions for setting up rules for running the selected tests |
|
296 |
# |
|
297 |
# The SetupRun*Test functions all have the same interface: |
|
298 |
# |
|
299 |
# Parameter 1 is the name of the rule. This is the test id, based on the test |
|
300 |
# descriptor, and this is also used as variable prefix, and the targets |
|
301 |
# generated are listed in a variable by that name. |
|
302 |
# |
|
303 |
# Remaining parameters are named arguments. Currently this is only: |
|
304 |
# TEST -- The properly formatted fully qualified test descriptor |
|
305 |
# |
|
306 |
# After the rule named by the test id has been executed, the following |
|
307 |
# variables will be available: |
|
308 |
# testid_TOTAL - the total number of tests run |
|
309 |
# testid_PASSED - the number of successful tests |
|
310 |
# testid_FAILED - the number of failed tests |
|
311 |
# testid_ERROR - the number of tests was neither successful or failed |
|
312 |
# |
|
313 |
################################################################################ |
|
314 |
||
315 |
### Rules for Gtest |
|
316 |
||
317 |
SetupRunGtestTest = $(NamedParamsMacroTemplate) |
|
318 |
define SetupRunGtestTestBody |
|
319 |
$1_TEST_RESULTS_DIR := $$(TEST_RESULTS_DIR)/$1 |
|
320 |
$1_TEST_SUPPORT_DIR := $$(TEST_SUPPORT_DIR)/$1 |
|
55915 | 321 |
$1_EXITCODE := $$($1_TEST_RESULTS_DIR)/exitcode.txt |
44027 | 322 |
|
323 |
$1_TEST_NAME := $$(strip $$(patsubst gtest:%, %, $$($1_TEST))) |
|
324 |
ifneq ($$($1_TEST_NAME), all) |
|
325 |
$1_GTEST_FILTER := --gtest_filter=$$($1_TEST_NAME)* |
|
326 |
endif |
|
327 |
||
328 |
ifneq ($$(GTEST_REPEAT), ) |
|
329 |
$1_GTEST_REPEAT :=--gtest_repeat=$$(GTEST_REPEAT) |
|
330 |
endif |
|
331 |
||
332 |
run-test-$1: |
|
333 |
$$(call LogWarn) |
|
334 |
$$(call LogWarn, Running test '$$($1_TEST)') |
|
335 |
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR)) |
|
336 |
$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/gtest, \ |
|
337 |
$$(FIXPATH) $$(TEST_IMAGE_DIR)/hotspot/gtest/server/gtestLauncher \ |
|
55915 | 338 |
-jdk $(JDK_IMAGE_DIR) $$($1_GTEST_FILTER) \ |
339 |
--gtest_output=xml:$$($1_TEST_RESULTS_DIR)/gtest.xml \ |
|
55916 | 340 |
$$($1_GTEST_REPEAT) $$(GTEST_OPTIONS) $$(GTEST_VM_OPTIONS) \ |
55915 | 341 |
> >($(TEE) $$($1_TEST_RESULTS_DIR)/gtest.txt) && \ |
342 |
$$(ECHO) $$$$? > $$($1_EXITCODE) || |
|
343 |
$$(ECHO) $$$$? > $$($1_EXITCODE) \ |
|
344 |
) |
|
44027 | 345 |
|
346 |
$1_RESULT_FILE := $$($1_TEST_RESULTS_DIR)/gtest.txt |
|
347 |
||
348 |
parse-test-$1: run-test-$1 |
|
349 |
$$(call LogWarn, Finished running test '$$($1_TEST)') |
|
350 |
$$(call LogWarn, Test report is stored in $$(strip \ |
|
351 |
$$(subst $$(TOPDIR)/, , $$($1_TEST_RESULTS_DIR)))) |
|
47956
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
352 |
$$(if $$(wildcard $$($1_RESULT_FILE)), \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
353 |
$$(eval $1_TOTAL := $$(shell $$(AWK) '/==========.* tests? from .* \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
354 |
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
|
355 |
$$(if $$($1_TOTAL), , $$(eval $1_TOTAL := 0)) \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
356 |
$$(eval $1_PASSED := $$(shell $$(AWK) '/\[ PASSED \] .* tests?./ \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
357 |
{ print $$$$4 }' $$($1_RESULT_FILE))) \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
358 |
$$(if $$($1_PASSED), , $$(eval $1_PASSED := 0)) \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
359 |
$$(eval $1_FAILED := $$(shell $$(AWK) '/\[ FAILED \] .* tests?, \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
360 |
listed below/ { print $$$$4 }' $$($1_RESULT_FILE))) \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
361 |
$$(if $$($1_FAILED), , $$(eval $1_FAILED := 0)) \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
362 |
$$(eval $1_ERROR := $$(shell \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
363 |
$$(EXPR) $$($1_TOTAL) - $$($1_PASSED) - $$($1_FAILED))) \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
364 |
, \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
365 |
$$(eval $1_PASSED := 0) \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
366 |
$$(eval $1_FAILED := 0) \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
367 |
$$(eval $1_ERROR := 1) \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
368 |
$$(eval $1_TOTAL := 1) \ |
72a474c85aee
8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents:
47943
diff
changeset
|
369 |
) |
44027 | 370 |
|
371 |
$1: run-test-$1 parse-test-$1 |
|
372 |
||
373 |
TARGETS += $1 |
|
374 |
endef |
|
375 |
||
376 |
################################################################################ |
|
377 |
||
378 |
### Rules for Jtreg |
|
379 |
||
380 |
# Helper function for SetupRunJtregTest. Set a JTREG_* variable from, in order: |
|
381 |
# 1) Specified by user on command line |
|
382 |
# 2) Component-specific default |
|
383 |
# 3) Generic default |
|
384 |
# |
|
385 |
# Note: No spaces are allowed around the arguments. |
|
386 |
# Arg $1 The test ID (i.e. $1 in SetupRunJtregTest) |
|
387 |
# Arg $2 Base variable, e.g. JTREG_JOBS |
|
388 |
# Arg $3 The default value (optional) |
|
389 |
define SetJtregValue |
|
390 |
ifneq ($$($2), ) |
|
391 |
$1_$2 := $$($2) |
|
392 |
else |
|
393 |
ifneq ($$($$($1_COMPONENT)_$2), ) |
|
394 |
$1_$2 := $$($$($1_COMPONENT)_$2) |
|
395 |
else |
|
396 |
ifneq ($3, ) |
|
397 |
$1_$2 := $3 |
|
398 |
endif |
|
399 |
endif |
|
400 |
endif |
|
401 |
endef |
|
402 |
||
403 |
SetupRunJtregTest = $(NamedParamsMacroTemplate) |
|
404 |
define SetupRunJtregTestBody |
|
405 |
$1_TEST_RESULTS_DIR := $$(TEST_RESULTS_DIR)/$1 |
|
406 |
$1_TEST_SUPPORT_DIR := $$(TEST_SUPPORT_DIR)/$1 |
|
55915 | 407 |
$1_EXITCODE := $$($1_TEST_RESULTS_DIR)/exitcode.txt |
44027 | 408 |
|
409 |
$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
|
410 |
|
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
411 |
$1_COMPONENT := \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
412 |
$$(strip $$(foreach root, $$(JTREG_TESTROOTS), \ |
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
413 |
$$(if $$(filter $$(root)%, $$(JTREG_TOPDIR)/$$($1_TEST_NAME)), \ |
47932
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
414 |
$$(lastword $$(subst /, $$(SPACE), $$(root))) \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
415 |
) \ |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
416 |
)) |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
417 |
# 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
|
418 |
ifeq ($$($1_COMPONENT), jtreg) |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
419 |
$1_COMPONENT := hotspot |
0c22f6b9b5e2
8191820: Fix run-test jtreg test selection and component calculation
ihse
parents:
47928
diff
changeset
|
420 |
endif |
44027 | 421 |
|
45104 | 422 |
ifeq ($$(JT_HOME), ) |
423 |
$$(info Error: jtreg framework is not found.) |
|
424 |
$$(info Please run configure using --with-jtreg.) |
|
425 |
$$(error Cannot continue) |
|
426 |
endif |
|
427 |
||
44027 | 428 |
# Unfortunately, we need different defaults for some JTREG values, |
429 |
# depending on what component we're running. |
|
430 |
||
431 |
# Convert JTREG_foo into $1_JTREG_foo with a suitable value. |
|
432 |
$$(eval $$(call SetJtregValue,$1,JTREG_TEST_MODE,agentvm)) |
|
433 |
$$(eval $$(call SetJtregValue,$1,JTREG_ASSERT,true)) |
|
434 |
$$(eval $$(call SetJtregValue,$1,JTREG_MAX_MEM,512m)) |
|
435 |
$$(eval $$(call SetJtregValue,$1,JTREG_NATIVEPATH)) |
|
436 |
$$(eval $$(call SetJtregValue,$1,JTREG_BASIC_OPTIONS)) |
|
47941
d91b0d2d45cb
8179554: make run-test does not respect ProblemList.txt
ihse
parents:
47939
diff
changeset
|
437 |
$$(eval $$(call SetJtregValue,$1,JTREG_PROBLEM_LIST)) |
44027 | 438 |
|
439 |
ifneq ($(TEST_JOBS), 0) |
|
440 |
# User has specified TEST_JOBS, use that as fallback default |
|
441 |
$$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(TEST_JOBS))) |
|
442 |
else |
|
443 |
# Use JOBS as default (except for hotspot) |
|
444 |
$$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(JOBS))) |
|
445 |
endif |
|
446 |
||
47058
85aaac5701da
8186248: Allow more flexibility in selecting Heap % of available RAM
bobv
parents:
46230
diff
changeset
|
447 |
# Make sure MaxRAMPercentage is high enough to not cause OOM or swapping since |
44027 | 448 |
# 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
|
449 |
$1_JTREG_MAX_RAM_PERCENTAGE := $$(shell $$(EXPR) 25 / $$($1_JTREG_JOBS)) |
44027 | 450 |
|
451 |
JTREG_TIMEOUT ?= 4 |
|
452 |
JTREG_VERBOSE ?= fail,error,summary |
|
453 |
JTREG_RETAIN ?= fail,error |
|
454 |
||
455 |
ifneq ($$($1_JTREG_MAX_MEM), 0) |
|
456 |
$1_JTREG_BASIC_OPTIONS += -vmoption:-Xmx$$($1_JTREG_MAX_MEM) |
|
457 |
$1_JTREG_LAUNCHER_OPTIONS += -Xmx$$($1_JTREG_MAX_MEM) |
|
458 |
endif |
|
459 |
||
460 |
$1_JTREG_BASIC_OPTIONS += -$$($1_JTREG_TEST_MODE) \ |
|
461 |
-verbose:$$(JTREG_VERBOSE) -retain:$$(JTREG_RETAIN) \ |
|
462 |
-concurrency:$$($1_JTREG_JOBS) -timeoutFactor:$$(JTREG_TIMEOUT) \ |
|
47058
85aaac5701da
8186248: Allow more flexibility in selecting Heap % of available RAM
bobv
parents:
46230
diff
changeset
|
463 |
-vmoption:-XX:MaxRAMPercentage=$$($1_JTREG_MAX_RAM_PERCENTAGE) |
44027 | 464 |
|
465 |
$1_JTREG_BASIC_OPTIONS += -automatic -keywords:\!ignore -ignore:quiet |
|
466 |
||
47329 | 467 |
# Make it possible to specify the JIB_DATA_DIR for tests using the |
468 |
# JIB Artifact resolver |
|
469 |
$1_JTREG_BASIC_OPTIONS += -e:JIB_DATA_DIR |
|
44027 | 470 |
# Some tests needs to find a boot JDK using the JDK8_HOME variable. |
471 |
$1_JTREG_BASIC_OPTIONS += -e:JDK8_HOME=$$(BOOT_JDK) |
|
472 |
||
473 |
$1_JTREG_BASIC_OPTIONS += \ |
|
474 |
$$(addprefix -javaoption:, $$(JTREG_JAVA_OPTIONS)) \ |
|
475 |
$$(addprefix -vmoption:, $$(JTREG_VM_OPTIONS)) \ |
|
476 |
# |
|
477 |
||
478 |
ifeq ($$($1_JTREG_ASSERT), true) |
|
479 |
$1_JTREG_BASIC_OPTIONS += -ea -esa |
|
480 |
endif |
|
481 |
||
482 |
ifneq ($$($1_JTREG_NATIVEPATH), ) |
|
483 |
$1_JTREG_BASIC_OPTIONS += -nativepath:$$($1_JTREG_NATIVEPATH) |
|
484 |
endif |
|
485 |
||
47941
d91b0d2d45cb
8179554: make run-test does not respect ProblemList.txt
ihse
parents:
47939
diff
changeset
|
486 |
ifneq ($$($1_JTREG_PROBLEM_LIST), ) |
d91b0d2d45cb
8179554: make run-test does not respect ProblemList.txt
ihse
parents:
47939
diff
changeset
|
487 |
$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
|
488 |
endif |
d91b0d2d45cb
8179554: make run-test does not respect ProblemList.txt
ihse
parents:
47939
diff
changeset
|
489 |
|
46230
e0ca0417b74d
8180600: make run-test does not work with jib test dependencies
erikj
parents:
45104
diff
changeset
|
490 |
ifneq ($$(JIB_JAR), ) |
e0ca0417b74d
8180600: make run-test does not work with jib test dependencies
erikj
parents:
45104
diff
changeset
|
491 |
$1_JTREG_BASIC_OPTIONS += -cpa:$$(JIB_JAR) |
e0ca0417b74d
8180600: make run-test does not work with jib test dependencies
erikj
parents:
45104
diff
changeset
|
492 |
endif |
e0ca0417b74d
8180600: make run-test does not work with jib test dependencies
erikj
parents:
45104
diff
changeset
|
493 |
|
47986 | 494 |
ifneq ($$(JTREG_FAILURE_HANDLER_OPTIONS), ) |
495 |
$1_JTREG_LAUNCHER_OPTIONS += -Djava.library.path="$(JTREG_FAILURE_HANDLER_DIR)" |
|
496 |
endif |
|
497 |
||
47939
fe7596497fb0
8179555: make run-test should always use a fresh, clean JTwork directory
ihse
parents:
47938
diff
changeset
|
498 |
clean-workdir-$1: |
fe7596497fb0
8179555: make run-test should always use a fresh, clean JTwork directory
ihse
parents:
47938
diff
changeset
|
499 |
$$(RM) -r $$($1_TEST_SUPPORT_DIR) |
fe7596497fb0
8179555: make run-test should always use a fresh, clean JTwork directory
ihse
parents:
47938
diff
changeset
|
500 |
|
fe7596497fb0
8179555: make run-test should always use a fresh, clean JTwork directory
ihse
parents:
47938
diff
changeset
|
501 |
run-test-$1: clean-workdir-$1 |
44027 | 502 |
$$(call LogWarn) |
503 |
$$(call LogWarn, Running test '$$($1_TEST)') |
|
504 |
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR)) |
|
505 |
$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/jtreg, \ |
|
506 |
$$(JAVA) $$($1_JTREG_LAUNCHER_OPTIONS) \ |
|
507 |
-Dprogram=jtreg -jar $$(JT_HOME)/lib/jtreg.jar \ |
|
508 |
$$($1_JTREG_BASIC_OPTIONS) \ |
|
509 |
-testjdk:$$(JDK_IMAGE_DIR) \ |
|
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
510 |
-dir:$$(JTREG_TOPDIR) \ |
44027 | 511 |
-reportDir:$$($1_TEST_RESULTS_DIR) \ |
512 |
-workDir:$$($1_TEST_SUPPORT_DIR) \ |
|
513 |
$$(JTREG_OPTIONS) \ |
|
47986 | 514 |
$$(JTREG_FAILURE_HANDLER_OPTIONS) \ |
55915 | 515 |
$$($1_TEST_NAME) && \ |
516 |
$$(ECHO) $$$$? > $$($1_EXITCODE) || |
|
517 |
$$(ECHO) $$$$? > $$($1_EXITCODE) \ |
|
518 |
) |
|
44027 | 519 |
|
520 |
$1_RESULT_FILE := $$($1_TEST_RESULTS_DIR)/text/stats.txt |
|
521 |
||
522 |
parse-test-$1: run-test-$1 |
|
523 |
$$(call LogWarn, Finished running test '$$($1_TEST)') |
|
524 |
$$(call LogWarn, Test report is stored in $$(strip \ |
|
525 |
$$(subst $$(TOPDIR)/, , $$($1_TEST_RESULTS_DIR)))) |
|
47259
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
526 |
$$(if $$(wildcard $$($1_RESULT_FILE)), \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
527 |
$$(eval $1_PASSED := $$(shell $$(AWK) '{ gsub(/[,;]/, ""); \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
528 |
for (i=1; i<=NF; i++) { if ($$$$i == "passed:") \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
529 |
print $$$$(i+1) } }' $$($1_RESULT_FILE))) \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
530 |
$$(if $$($1_PASSED), , $$(eval $1_PASSED := 0)) \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
531 |
$$(eval $1_FAILED := $$(shell $$(AWK) '{gsub(/[,;]/, ""); \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
532 |
for (i=1; i<=NF; i++) { if ($$$$i == "failed:") \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
533 |
print $$$$(i+1) } }' $$($1_RESULT_FILE))) \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
534 |
$$(if $$($1_FAILED), , $$(eval $1_FAILED := 0)) \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
535 |
$$(eval $1_ERROR := $$(shell $$(AWK) '{gsub(/[,;]/, ""); \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
536 |
for (i=1; i<=NF; i++) { if ($$$$i == "error:") \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
537 |
print $$$$(i+1) } }' $$($1_RESULT_FILE))) \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
538 |
$$(if $$($1_ERROR), , $$(eval $1_ERROR := 0)) \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
539 |
$$(eval $1_TOTAL := $$(shell \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
540 |
$$(EXPR) $$($1_PASSED) + $$($1_FAILED) + $$($1_ERROR))) \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
541 |
, \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
542 |
$$(eval $1_PASSED := 0) \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
543 |
$$(eval $1_FAILED := 0) \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
544 |
$$(eval $1_ERROR := 1) \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
545 |
$$(eval $1_TOTAL := 1) \ |
0b347d8efb40
8187672: RunTest displays broken output if jtreg fails completely
ihse
parents:
47253
diff
changeset
|
546 |
) |
44027 | 547 |
|
548 |
$1: run-test-$1 parse-test-$1 |
|
549 |
||
550 |
TARGETS += $1 |
|
551 |
endef |
|
552 |
||
553 |
||
554 |
################################################################################ |
|
555 |
# Setup and execute make rules for all selected tests |
|
556 |
################################################################################ |
|
557 |
||
558 |
# Helper function to determine which handler to use for the given test |
|
559 |
UseGtestTestHandler = \ |
|
560 |
$(if $(filter gtest:%, $1), true) |
|
561 |
||
562 |
UseJtregTestHandler = \ |
|
563 |
$(if $(filter jtreg:%, $1), true) |
|
564 |
||
565 |
# Now process each test to run and setup a proper make rule |
|
566 |
$(foreach test, $(TESTS_TO_RUN), \ |
|
567 |
$(eval TEST_ID := $(shell $(ECHO) $(strip $(test)) | \ |
|
568 |
$(TR) -cs '[a-z][A-Z][0-9]\n' '_')) \ |
|
569 |
$(eval ALL_TEST_IDS += $(TEST_ID)) \ |
|
570 |
$(if $(call UseCustomTestHandler, $(test)), \ |
|
571 |
$(eval $(call SetupRunCustomTest, $(TEST_ID), \ |
|
572 |
TEST := $(test), \ |
|
573 |
)) \ |
|
574 |
) \ |
|
575 |
$(if $(call UseGtestTestHandler, $(test)), \ |
|
576 |
$(eval $(call SetupRunGtestTest, $(TEST_ID), \ |
|
577 |
TEST := $(test), \ |
|
578 |
)) \ |
|
579 |
) \ |
|
580 |
$(if $(call UseJtregTestHandler, $(test)), \ |
|
581 |
$(eval $(call SetupRunJtregTest, $(TEST_ID), \ |
|
582 |
TEST := $(test), \ |
|
583 |
)) \ |
|
584 |
) \ |
|
585 |
) |
|
586 |
||
587 |
# Sort also removes duplicates, so if there is any we'll get fewer words. |
|
588 |
ifneq ($(words $(ALL_TEST_IDS)), $(words $(sort $(ALL_TEST_IDS)))) |
|
589 |
$(error Duplicate test specification) |
|
590 |
endif |
|
591 |
||
592 |
||
593 |
################################################################################ |
|
594 |
# The main target for RunTests.gmk |
|
595 |
################################################################################ |
|
596 |
||
597 |
# The SetupRun*Test functions have populated TARGETS. |
|
598 |
||
599 |
TEST_FAILURE := false |
|
600 |
||
601 |
run-test: $(TARGETS) |
|
47943 | 602 |
# Create and print a table of the result of all tests run |
603 |
$(RM) $(TEST_SUMMARY).old 2> /dev/null |
|
604 |
$(MV) $(TEST_SUMMARY) $(TEST_SUMMARY).old 2> /dev/null || true |
|
55899 | 605 |
$(RM) $(TEST_LAST_IDS).old 2> /dev/null |
606 |
$(MV) $(TEST_LAST_IDS) $(TEST_LAST_IDS).old 2> /dev/null || true |
|
47943 | 607 |
$(ECHO) >> $(TEST_SUMMARY) ============================== |
608 |
$(ECHO) >> $(TEST_SUMMARY) Test summary |
|
609 |
$(ECHO) >> $(TEST_SUMMARY) ============================== |
|
610 |
$(PRINTF) >> $(TEST_SUMMARY) "%2s %-49s %5s %5s %5s %5s %2s\n" " " \ |
|
611 |
TEST TOTAL PASS FAIL ERROR " " |
|
44027 | 612 |
$(foreach test, $(TESTS_TO_RUN), \ |
613 |
$(eval TEST_ID := $(shell $(ECHO) $(strip $(test)) | \ |
|
614 |
$(TR) -cs '[a-z][A-Z][0-9]\n' '_')) \ |
|
55899 | 615 |
$(ECHO) >> $(TEST_LAST_IDS) $(TEST_ID) $(NEWLINE) \ |
47937
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
616 |
$(eval NAME_PATTERN := $(shell $(ECHO) $(test) | $(TR) -c \\n _)) \ |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
617 |
$(if $(filter __________________________________________________%, $(NAME_PATTERN)), \ |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
618 |
$(eval TEST_NAME := ) \ |
47943 | 619 |
$(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
|
620 |
, \ |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
621 |
$(eval TEST_NAME := $(test)) \ |
c1437939b0d8
8177957: run-test summary lines look bad/misleading with long test names
ihse
parents:
47932
diff
changeset
|
622 |
) \ |
44027 | 623 |
$(if $(filter $($(TEST_ID)_PASSED), $($(TEST_ID)_TOTAL)), \ |
47943 | 624 |
$(PRINTF) >> $(TEST_SUMMARY) "%2s %-49s %5d %5d %5d %5d %2s\n" \ |
625 |
" " "$(TEST_NAME)" $($(TEST_ID)_TOTAL) $($(TEST_ID)_PASSED) \ |
|
626 |
$($(TEST_ID)_FAILED) $($(TEST_ID)_ERROR) " " $(NEWLINE) \ |
|
44027 | 627 |
, \ |
47943 | 628 |
$(PRINTF) >> $(TEST_SUMMARY) "%2s %-49s %5d %5d %5d %5d %2s\n" \ |
629 |
">>" "$(TEST_NAME)" $($(TEST_ID)_TOTAL) $($(TEST_ID)_PASSED) \ |
|
630 |
$($(TEST_ID)_FAILED) $($(TEST_ID)_ERROR) "<<" $(NEWLINE) \ |
|
44027 | 631 |
$(eval TEST_FAILURE := true) \ |
632 |
) \ |
|
633 |
) |
|
47943 | 634 |
$(ECHO) >> $(TEST_SUMMARY) ============================== |
44027 | 635 |
$(if $(filter true, $(TEST_FAILURE)), \ |
47943 | 636 |
$(ECHO) >> $(TEST_SUMMARY) TEST FAILURE $(NEWLINE) \ |
637 |
$(MKDIR) -p $(MAKESUPPORT_OUTPUTDIR) $(NEWLINE) \ |
|
44027 | 638 |
$(TOUCH) $(MAKESUPPORT_OUTPUTDIR)/exit-with-error \ |
639 |
, \ |
|
47943 | 640 |
$(ECHO) >> $(TEST_SUMMARY) TEST SUCCESS \ |
44027 | 641 |
) |
642 |
$(ECHO) |
|
47943 | 643 |
$(CAT) $(TEST_SUMMARY) |
644 |
$(ECHO) |
|
44027 | 645 |
|
646 |
################################################################################ |
|
647 |
||
648 |
all: run-test |
|
649 |
||
650 |
.PHONY: default all run-test $(TARGETS) |