author | ihse |
Thu, 01 Mar 2018 17:00:23 +0100 | |
branch | ihse-cflags-rewrite-branch |
changeset 56221 | bdf8f77aad3a |
parent 48980 | ab7784555b4c |
child 49147 | af37d9997bd6 |
child 49179 | 4b273ed9a82d |
permissions | -rw-r--r-- |
42424 | 1 |
# |
48980
ab7784555b4c
8197906: Enable CDS mode execution of jtreg tests via make
mseledtsov
parents:
48693
diff
changeset
|
2 |
# Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved. |
42424 | 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 |
# |
|
27 |
# Common logic to run various tests for a component, to be included by the |
|
28 |
# component specific test makefiles. |
|
29 |
# |
|
30 |
||
31 |
# Default values for some properties that can be overridden by components. |
|
32 |
USE_JTREG_VERSION ?= 4.2 |
|
33 |
JTREG_VM_TYPE ?= -agentvm |
|
34 |
USE_JTREG_ASSERT ?= true |
|
35 |
LIMIT_JTREG_VM_MEMORY ?= true |
|
36 |
||
37 |
.DEFAULT : all |
|
38 |
||
39 |
# Empty these to get rid of some default rules |
|
40 |
.SUFFIXES: |
|
41 |
.SUFFIXES: .java |
|
42 |
CO= |
|
43 |
GET= |
|
44 |
||
45 |
# Utilities used |
|
46 |
AWK = awk |
|
47 |
CAT = cat |
|
48 |
CD = cd |
|
49 |
CHMOD = chmod |
|
50 |
CP = cp |
|
51 |
CUT = cut |
|
52 |
DIRNAME = dirname |
|
53 |
ECHO = echo |
|
54 |
EGREP = egrep |
|
55 |
EXPAND = expand |
|
56 |
FIND = find |
|
57 |
MKDIR = mkdir |
|
58 |
PWD = pwd |
|
59 |
RM = rm -f |
|
60 |
SED = sed |
|
61 |
SORT = sort |
|
62 |
TEE = tee |
|
63 |
UNAME = uname |
|
64 |
UNIQ = uniq |
|
65 |
WC = wc |
|
66 |
ZIPEXE = zip |
|
67 |
||
68 |
# Get OS name from uname (Cygwin inexplicably adds _NT-5.1) |
|
69 |
UNAME_S := $(shell $(UNAME) -s | $(CUT) -f1 -d_) |
|
70 |
||
71 |
# Commands to run on paths to make mixed paths for java on windows |
|
72 |
ifeq ($(findstring CYGWIN,$(UNAME_S)), CYGWIN) |
|
73 |
# Location of developer shared files |
|
74 |
SLASH_JAVA = J: |
|
75 |
GETMIXEDPATH = cygpath -m |
|
76 |
PLATFORM = windows |
|
77 |
else |
|
78 |
# Location of developer shared files |
|
79 |
SLASH_JAVA = /java |
|
80 |
GETMIXEDPATH = $(ECHO) |
|
81 |
PLATFORM = unix # we only care about windows or bsd. |
|
82 |
ifeq ($(UNAME_S), Darwin) |
|
83 |
PLATFORM = bsd |
|
84 |
endif |
|
85 |
ifeq ($(findstring BSD,$(UNAME_S)), BSD) |
|
86 |
PLATFORM = bsd |
|
87 |
endif |
|
88 |
endif |
|
89 |
||
90 |
ifdef ALT_SLASH_JAVA |
|
91 |
SLASH_JAVA = $(ALT_SLASH_JAVA) |
|
92 |
endif |
|
93 |
||
94 |
# Root of this test area (important to use full paths in some places) |
|
95 |
TEST_ROOT := $(shell $(PWD)) |
|
96 |
||
97 |
# Root of all test results |
|
98 |
ifdef TEST_OUTPUT_DIR |
|
99 |
$(shell $(MKDIR) -p $(TEST_OUTPUT_DIR)/jtreg) |
|
100 |
ABS_TEST_OUTPUT_DIR := \ |
|
101 |
$(shell $(CD) $(TEST_OUTPUT_DIR)/jtreg && $(PWD)) |
|
102 |
else |
|
103 |
ifdef ALT_OUTPUTDIR |
|
104 |
ABS_OUTPUTDIR = $(shell $(CD) $(ALT_OUTPUTDIR) && $(PWD)) |
|
105 |
else |
|
106 |
ABS_OUTPUTDIR = $(shell $(CD) $(TEST_ROOT)/.. && $(PWD)) |
|
107 |
endif |
|
108 |
||
109 |
ABS_PLATFORM_BUILD_ROOT = $(ABS_OUTPUTDIR) |
|
110 |
ABS_TEST_OUTPUT_DIR := $(ABS_PLATFORM_BUILD_ROOT)/testoutput/$(UNIQUE_DIR) |
|
111 |
endif |
|
112 |
||
113 |
# Expect JPRT to set PRODUCT_HOME (the product or jdk in this case to test) |
|
114 |
ifndef PRODUCT_HOME |
|
115 |
# Try to use images/jdk if it exists |
|
116 |
ABS_JDK_IMAGE = $(ABS_PLATFORM_BUILD_ROOT)/images/jdk |
|
117 |
PRODUCT_HOME := \ |
|
118 |
$(shell \ |
|
119 |
if [ -d $(ABS_JDK_IMAGE) ] ; then \ |
|
120 |
$(ECHO) "$(ABS_JDK_IMAGE)"; \ |
|
121 |
else \ |
|
122 |
$(ECHO) "$(ABS_PLATFORM_BUILD_ROOT)"; \ |
|
123 |
fi) |
|
124 |
PRODUCT_HOME := $(PRODUCT_HOME) |
|
125 |
endif |
|
126 |
||
127 |
# Expect JPRT to set JPRT_PRODUCT_ARGS (e.g. -server etc.) |
|
128 |
# Should be passed into 'java' only. |
|
129 |
# Could include: -d64 -server -client OR any java option |
|
130 |
ifdef JPRT_PRODUCT_ARGS |
|
131 |
JAVA_ARGS = $(JPRT_PRODUCT_ARGS) |
|
132 |
endif |
|
133 |
||
134 |
# Expect JPRT to set JPRT_PRODUCT_VM_ARGS (e.g. -Xcomp etc.) |
|
135 |
# Should be passed into anything running the vm (java, javac, javadoc, ...). |
|
136 |
ifdef JPRT_PRODUCT_VM_ARGS |
|
137 |
JAVA_VM_ARGS = $(JPRT_PRODUCT_VM_ARGS) |
|
138 |
endif |
|
139 |
||
140 |
ifneq ($(NATIVE_TEST_PATH), ) |
|
141 |
# jtreg -nativepath <dir> |
|
142 |
# |
|
143 |
# Local make tests will be TEST_IMAGE_DIR and JPRT with jprt.use.reg.test.bundle=true |
|
144 |
# should be JPRT_TESTNATIVE_PATH |
|
145 |
ifdef TEST_IMAGE_DIR |
|
146 |
TESTNATIVE_DIR = $(TEST_IMAGE_DIR) |
|
147 |
else ifdef JPRT_TESTNATIVE_PATH |
|
148 |
TESTNATIVE_DIR = $(JPRT_TESTNATIVE_PATH) |
|
149 |
endif |
|
150 |
ifdef TESTNATIVE_DIR |
|
151 |
JTREG_NATIVE_PATH = -nativepath:$(shell $(GETMIXEDPATH) "$(TESTNATIVE_DIR)/$(NATIVE_TEST_PATH)") |
|
152 |
endif |
|
153 |
endif |
|
154 |
||
155 |
ifeq ($(USE_FAILURE_HANDLER), true) |
|
156 |
# jtreg failure handler config |
|
157 |
ifeq ($(FAILURE_HANDLER_DIR), ) |
|
158 |
ifneq ($(TESTNATIVE_DIR), ) |
|
159 |
FAILURE_HANDLER_DIR := $(TESTNATIVE_DIR)/failure_handler |
|
160 |
endif |
|
161 |
endif |
|
162 |
ifneq ($(FAILURE_HANDLER_DIR), ) |
|
163 |
FAILURE_HANDLER_DIR_MIXED := $(shell $(GETMIXEDPATH) "$(FAILURE_HANDLER_DIR)") |
|
164 |
JTREG_FAILURE_HANDLER_OPTIONS := \ |
|
165 |
-timeoutHandlerDir:$(FAILURE_HANDLER_DIR_MIXED)/jtregFailureHandler.jar \ |
|
166 |
-observerDir:$(FAILURE_HANDLER_DIR_MIXED)/jtregFailureHandler.jar \ |
|
167 |
-timeoutHandler:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler \ |
|
168 |
-observer:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver \ |
|
169 |
-timeoutHandlerTimeout:0 |
|
170 |
ifeq ($(PLATFORM), windows) |
|
171 |
JTREG_FAILURE_HANDLER_OPTIONS += -J-Djava.library.path="$(FAILURE_HANDLER_DIR_MIXED)" |
|
172 |
endif |
|
173 |
endif |
|
174 |
endif |
|
175 |
||
48980
ab7784555b4c
8197906: Enable CDS mode execution of jtreg tests via make
mseledtsov
parents:
48693
diff
changeset
|
176 |
|
ab7784555b4c
8197906: Enable CDS mode execution of jtreg tests via make
mseledtsov
parents:
48693
diff
changeset
|
177 |
# Optionally create a CDS archive before running tests |
ab7784555b4c
8197906: Enable CDS mode execution of jtreg tests via make
mseledtsov
parents:
48693
diff
changeset
|
178 |
ifeq ($(GENERATE_CDS_ARCHIVE), true) |
ab7784555b4c
8197906: Enable CDS mode execution of jtreg tests via make
mseledtsov
parents:
48693
diff
changeset
|
179 |
CDS_ARCHIVE_FILE := $(ABS_TEST_OUTPUT_DIR)/cds_archive.jsa |
ab7784555b4c
8197906: Enable CDS mode execution of jtreg tests via make
mseledtsov
parents:
48693
diff
changeset
|
180 |
|
ab7784555b4c
8197906: Enable CDS mode execution of jtreg tests via make
mseledtsov
parents:
48693
diff
changeset
|
181 |
$(CDS_ARCHIVE_FILE): $(PRODUCT_HOME) |
ab7784555b4c
8197906: Enable CDS mode execution of jtreg tests via make
mseledtsov
parents:
48693
diff
changeset
|
182 |
$(PRODUCT_HOME)/bin/java -XX:+UnlockDiagnosticVMOptions \ |
ab7784555b4c
8197906: Enable CDS mode execution of jtreg tests via make
mseledtsov
parents:
48693
diff
changeset
|
183 |
-XX:SharedArchiveFile=$(shell $(GETMIXEDPATH) "$(CDS_ARCHIVE_FILE)") -Xshare:dump |
ab7784555b4c
8197906: Enable CDS mode execution of jtreg tests via make
mseledtsov
parents:
48693
diff
changeset
|
184 |
|
ab7784555b4c
8197906: Enable CDS mode execution of jtreg tests via make
mseledtsov
parents:
48693
diff
changeset
|
185 |
CDS_VM_ARGS := -XX:+UnlockDiagnosticVMOptions -XX:SharedArchiveFile=$(shell $(GETMIXEDPATH) "$(CDS_ARCHIVE_FILE)") |
ab7784555b4c
8197906: Enable CDS mode execution of jtreg tests via make
mseledtsov
parents:
48693
diff
changeset
|
186 |
JTREG_TEST_OPTIONS += $(addprefix -vmoption:, $(CDS_VM_ARGS)) |
ab7784555b4c
8197906: Enable CDS mode execution of jtreg tests via make
mseledtsov
parents:
48693
diff
changeset
|
187 |
TEST_PREREQS += $(CDS_ARCHIVE_FILE) |
ab7784555b4c
8197906: Enable CDS mode execution of jtreg tests via make
mseledtsov
parents:
48693
diff
changeset
|
188 |
endif |
ab7784555b4c
8197906: Enable CDS mode execution of jtreg tests via make
mseledtsov
parents:
48693
diff
changeset
|
189 |
|
42424 | 190 |
# Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results) |
191 |
ifdef JPRT_ARCHIVE_BUNDLE |
|
192 |
ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE) |
|
193 |
endif |
|
194 |
||
195 |
# How to create the test bundle (pass or fail, we want to create this) |
|
196 |
# Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed. |
|
47434
7be5c153e8a4
8189664: Stop producing ARCHIVE_BUNDLE.zip from test makefiles unless asked to
erikj
parents:
47329
diff
changeset
|
197 |
ifneq ($(ARCHIVE_BUNDLE), ) |
7be5c153e8a4
8189664: Stop producing ARCHIVE_BUNDLE.zip from test makefiles unless asked to
erikj
parents:
47329
diff
changeset
|
198 |
ZIP_UP_RESULTS = ( $(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)` \ |
42424 | 199 |
&& $(CD) $(ABS_TEST_OUTPUT_DIR) \ |
200 |
&& $(CHMOD) -R a+r . \ |
|
47434
7be5c153e8a4
8189664: Stop producing ARCHIVE_BUNDLE.zip from test makefiles unless asked to
erikj
parents:
47329
diff
changeset
|
201 |
&& $(ZIPEXE) -q -r $(ARCHIVE_BUNDLE) . ) ; |
7be5c153e8a4
8189664: Stop producing ARCHIVE_BUNDLE.zip from test makefiles unless asked to
erikj
parents:
47329
diff
changeset
|
202 |
CLEAN_ARCHIVE_BUNDLE = @$(RM) $(ARCHIVE_BUNDLE) |
7be5c153e8a4
8189664: Stop producing ARCHIVE_BUNDLE.zip from test makefiles unless asked to
erikj
parents:
47329
diff
changeset
|
203 |
endif |
42424 | 204 |
|
47479 | 205 |
# AddressSanitizer |
206 |
ifeq ($(ASAN_ENABLED), yes) |
|
207 |
export ASAN_OPTIONS="handle_segv=0 detect_leaks=0" |
|
208 |
JTREG_BASIC_OPTIONS += -e:ASAN_OPTIONS=$(ASAN_OPTIONS) |
|
209 |
ifneq ($(DEVKIT_LIB_DIR),) |
|
210 |
export LD_LIBRARY_PATH:=$(LD_LIBRARY_PATH):$(DEVKIT_LIB_DIR) |
|
211 |
JTREG_BASIC_OPTIONS += -e:LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) |
|
212 |
endif |
|
213 |
endif |
|
214 |
||
42424 | 215 |
# important results files |
216 |
SUMMARY_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport/text/summary.txt") |
|
217 |
STATS_TXT_NAME = Stats.txt |
|
218 |
STATS_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/$(STATS_TXT_NAME)") |
|
219 |
RUNLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/runlist.txt") |
|
220 |
PASSLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/passlist.txt") |
|
221 |
FAILLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/faillist.txt") |
|
222 |
EXITCODE = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/exitcode.txt") |
|
223 |
||
224 |
TESTEXIT = \ |
|
225 |
if [ ! -s $(EXITCODE) ] ; then \ |
|
226 |
$(ECHO) "ERROR: EXITCODE file not filled in."; \ |
|
227 |
$(ECHO) "1" > $(EXITCODE); \ |
|
228 |
fi ; \ |
|
229 |
testExitCode=`$(CAT) $(EXITCODE)`; \ |
|
230 |
$(ECHO) "EXIT CODE: $${testExitCode}"; \ |
|
231 |
exit $${testExitCode} |
|
232 |
||
233 |
ifeq ($(TREAT_EXIT_CODE_1_AS_0), true) |
|
234 |
ADJUST_EXIT_CODE := \ |
|
235 |
if [ $${jtregExitCode} = 1 ] ; then \ |
|
236 |
jtregExitCode=0; \ |
|
237 |
fi |
|
238 |
else |
|
239 |
# colon is the shell no-op |
|
240 |
ADJUST_EXIT_CODE := : |
|
241 |
endif |
|
242 |
||
243 |
BUNDLE_UP_AND_EXIT = \ |
|
244 |
( \ |
|
245 |
jtregExitCode=$$? && \ |
|
246 |
_summary="$(SUMMARY_TXT)"; \ |
|
247 |
$(ADJUST_EXIT_CODE) ; \ |
|
248 |
$(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \ |
|
249 |
$(ECHO) "$${jtregExitCode}" > $(EXITCODE); \ |
|
250 |
if [ -r "$${_summary}" ] ; then \ |
|
251 |
$(ECHO) "Summary: $(UNIQUE_DIR)" > $(STATS_TXT); \ |
|
252 |
$(EXPAND) $${_summary} | $(EGREP) -v ' Not run\.' > $(RUNLIST); \ |
|
253 |
$(EGREP) ' Passed\.' $(RUNLIST) \ |
|
254 |
| $(EGREP) -v ' Error\.' \ |
|
255 |
| $(EGREP) -v ' Failed\.' > $(PASSLIST); \ |
|
256 |
( $(EGREP) ' Failed\.' $(RUNLIST); \ |
|
257 |
$(EGREP) ' Error\.' $(RUNLIST); \ |
|
258 |
$(EGREP) -v ' Passed\.' $(RUNLIST) ) \ |
|
259 |
| $(SORT) | $(UNIQ) > $(FAILLIST); \ |
|
260 |
if [ $${jtregExitCode} != 0 -o -s $(FAILLIST) ] ; then \ |
|
261 |
$(EXPAND) $(FAILLIST) \ |
|
262 |
| $(CUT) -d' ' -f1 \ |
|
263 |
| $(SED) -e 's@^@FAILED: @' >> $(STATS_TXT); \ |
|
264 |
if [ $${jtregExitCode} = 0 ] ; then \ |
|
265 |
jtregExitCode=1; \ |
|
266 |
fi; \ |
|
267 |
fi; \ |
|
268 |
runc="`$(CAT) $(RUNLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \ |
|
269 |
passc="`$(CAT) $(PASSLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \ |
|
270 |
failc="`$(CAT) $(FAILLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \ |
|
271 |
exclc="FIXME CODETOOLS-7900176"; \ |
|
272 |
$(ECHO) "TEST STATS: name=$(UNIQUE_DIR) run=$${runc} pass=$${passc} fail=$${failc}" \ |
|
273 |
>> $(STATS_TXT); \ |
|
274 |
else \ |
|
275 |
$(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \ |
|
276 |
fi; \ |
|
277 |
if [ -f $(STATS_TXT) ] ; then \ |
|
278 |
$(CAT) $(STATS_TXT); \ |
|
279 |
fi; \ |
|
47434
7be5c153e8a4
8189664: Stop producing ARCHIVE_BUNDLE.zip from test makefiles unless asked to
erikj
parents:
47329
diff
changeset
|
280 |
$(ZIP_UP_RESULTS) \ |
42424 | 281 |
$(TESTEXIT) \ |
282 |
) |
|
283 |
||
284 |
################################################################ |
|
285 |
||
286 |
# Prep for output |
|
287 |
# Change execute permissions on shared library files. |
|
288 |
# Files in repositories should never have execute permissions, but |
|
289 |
# there are some tests that have pre-built shared libraries, and these |
|
290 |
# windows dll files must have execute permission. Adding execute |
|
291 |
# permission may happen automatically on windows when using certain |
|
292 |
# versions of mercurial but it cannot be guaranteed. And blindly |
|
293 |
# adding execute permission might be seen as a mercurial 'change', so |
|
294 |
# we avoid adding execute permission to repository files. But testing |
|
295 |
# from a plain source tree needs the chmod a+rx. Applying the chmod to |
|
296 |
# all shared libraries not just dll files. And with CYGWIN and sshd |
|
297 |
# service, you may need CYGWIN=ntsec for this to work. |
|
298 |
prep: |
|
299 |
@$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR) |
|
47285
7513299d1cd0
8188090: Running tests from make causes spurious mercurial changes
mcimadamore
parents:
47218
diff
changeset
|
300 |
@if [ ! -d $(TEST_ROOT)/../../.hg ] && [ ! -d $(TEST_ROOT)/../../../.hg ]; then \ |
42424 | 301 |
$(FIND) $(TEST_ROOT) \( -name \*.dll -o -name \*.DLL -o -name \*.so \) \ |
302 |
-exec $(CHMOD) a+rx {} \; ; \ |
|
303 |
fi |
|
304 |
||
305 |
ifeq ($(CLEAN_BEFORE_PREP), true) |
|
306 |
prep: clean |
|
307 |
||
308 |
endif |
|
309 |
||
310 |
# Cleanup |
|
311 |
clean: |
|
312 |
@$(RM) -r $(ABS_TEST_OUTPUT_DIR) |
|
47434
7be5c153e8a4
8189664: Stop producing ARCHIVE_BUNDLE.zip from test makefiles unless asked to
erikj
parents:
47329
diff
changeset
|
313 |
$(CLEAN_ARCHIVE_BUNDLE) |
42424 | 314 |
|
315 |
################################################################ |
|
316 |
||
317 |
# jtreg tests |
|
318 |
||
319 |
# Expect JT_HOME to be set for jtreg tests. (home for jtreg) |
|
320 |
ifndef JT_HOME |
|
321 |
JT_HOME = $(SLASH_JAVA)/re/jtreg/$(USE_JTREG_VERSION)/promoted/latest/binaries/jtreg |
|
322 |
ifdef JPRT_JTREG_HOME |
|
323 |
JT_HOME = $(JPRT_JTREG_HOME) |
|
324 |
endif |
|
325 |
endif |
|
326 |
||
327 |
# Problematic tests to be excluded |
|
47218 | 328 |
PROBLEM_LISTS=$(call MixedDirs,$(wildcard ProblemList.txt)) |
42424 | 329 |
|
330 |
# Create exclude list for this platform and arch |
|
331 |
ifdef NO_EXCLUDES |
|
332 |
JTREG_EXCLUSIONS = |
|
333 |
else |
|
334 |
JTREG_EXCLUSIONS = $(PROBLEM_LISTS:%=-exclude:%) |
|
335 |
endif |
|
336 |
||
337 |
# convert list of directories to dos paths |
|
338 |
define MixedDirs |
|
339 |
$(foreach i,$1,$(shell $(GETMIXEDPATH) "${i}")) |
|
340 |
endef |
|
341 |
||
342 |
# ------------------------------------------------------------------ |
|
343 |
||
344 |
# When called from JPRT the TESTDIRS variable is set to the jtreg tests to run |
|
345 |
ifdef TESTDIRS |
|
346 |
TEST_SELECTION = $(TESTDIRS) |
|
347 |
endif |
|
348 |
||
48677
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
349 |
ifeq ($(UNAME_S), SunOS) |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
350 |
NUM_CORES := $(shell LC_MESSAGES=C /usr/sbin/psrinfo -v | grep -c on-line) |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
351 |
endif |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
352 |
ifeq ($(UNAME_S), Linux) |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
353 |
NUM_CORES := $(shell cat /proc/cpuinfo | grep -c processor) |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
354 |
endif |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
355 |
ifeq ($(UNAME_S), Darwin) |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
356 |
NUM_CORES := $(shell /usr/sbin/sysctl -n hw.ncpu) |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
357 |
endif |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
358 |
ifeq ($(findstring CYGWIN,$(UNAME_S)), CYGWIN) |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
359 |
ifneq ($(NUMBER_OF_PROCESSORS), ) |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
360 |
NUM_CORES := $(NUMBER_OF_PROCESSORS) |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
361 |
else |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
362 |
ifneq ($(HOTSPOT_BUILD_JOBS), ) |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
363 |
NUM_CORES := $(HOTSPOT_BUILD_JOBS) |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
364 |
else |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
365 |
NUM_CORES := 1 # fallback |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
366 |
endif |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
367 |
endif |
42424 | 368 |
endif |
48677
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
369 |
|
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
370 |
ifndef CONCURRENCY_FACTOR |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
371 |
CONCURRENCY_FACTOR = 1 |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
372 |
endif |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
373 |
|
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
374 |
# Concurrency based on min(cores / 2, 12) * CONCURRENCY_FACTOR |
48693
a2d550f08617
8196524: Align MaxRAMPercentage settings between open and closed
erikj
parents:
48677
diff
changeset
|
375 |
CONCURRENCY := $(shell $(AWK) \ |
48677
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
376 |
'BEGIN { \ |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
377 |
c = $(NUM_CORES) / 2; \ |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
378 |
if (c > 12) c = 12; \ |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
379 |
c = c * $(CONCURRENCY_FACTOR); \ |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
380 |
if (c < 1) c = 1; \ |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
381 |
printf "%.0f", c; \ |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
382 |
}') |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
383 |
JTREG_BASIC_OPTIONS += -concurrency:$(CONCURRENCY) |
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
384 |
|
48693
a2d550f08617
8196524: Align MaxRAMPercentage settings between open and closed
erikj
parents:
48677
diff
changeset
|
385 |
# Make sure MaxRAMPercentage is low enough to not cause OOM or swapping since |
a2d550f08617
8196524: Align MaxRAMPercentage settings between open and closed
erikj
parents:
48677
diff
changeset
|
386 |
# we may end up with a lot of JVM's |
a2d550f08617
8196524: Align MaxRAMPercentage settings between open and closed
erikj
parents:
48677
diff
changeset
|
387 |
MAX_RAM_PERCENTAGE := $(shell expr 25 / $(CONCURRENCY)) |
a2d550f08617
8196524: Align MaxRAMPercentage settings between open and closed
erikj
parents:
48677
diff
changeset
|
388 |
JTREG_BASIC_OPTIONS += -vmoption:-XX:MaxRAMPercentage=$(MAX_RAM_PERCENTAGE) |
48677
62b6e9b1dfdc
8196197: Enable the make system to calculate concurrency for JDK tests
ctornqvi
parents:
47479
diff
changeset
|
389 |
|
42424 | 390 |
ifdef EXTRA_JTREG_OPTIONS |
391 |
JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS) |
|
392 |
endif |
|
393 |
||
394 |
# Default JTREG to run |
|
395 |
JTREG = $(JT_HOME)/bin/jtreg |
|
396 |
# run in agentvm/othervm mode |
|
397 |
JTREG_BASIC_OPTIONS += $(JTREG_VM_TYPE) |
|
398 |
# Only run automatic tests |
|
399 |
JTREG_BASIC_OPTIONS += -a |
|
400 |
# Always turn on assertions |
|
401 |
ifeq ($(USE_JTREG_ASSERT), true) |
|
402 |
JTREG_ASSERT_OPTION = -ea -esa |
|
403 |
endif |
|
404 |
JTREG_BASIC_OPTIONS += $(JTREG_ASSERT_OPTION) |
|
405 |
# jtreg verbosity setting |
|
406 |
# Default is to report details on all failed or error tests, times too |
|
407 |
JTREG_VERBOSE ?= fail,error,time |
|
408 |
JTREG_BASIC_OPTIONS += $(if $(JTREG_VERBOSE),-v:$(JTREG_VERBOSE)) |
|
409 |
# Retain all files for failing tests |
|
410 |
JTREG_BASIC_OPTIONS += -retain:fail,error |
|
411 |
# Ignore tests are not run and completely silent about it |
|
412 |
JTREG_IGNORE_OPTION = -ignore:quiet |
|
413 |
JTREG_BASIC_OPTIONS += $(JTREG_IGNORE_OPTION) |
|
414 |
# Multiply by 4 the timeout factor |
|
415 |
JTREG_TIMEOUT_OPTION = -timeoutFactor:4 |
|
416 |
JTREG_BASIC_OPTIONS += $(JTREG_TIMEOUT_OPTION) |
|
417 |
ifeq ($(LIMIT_JTREG_VM_MEMORY), true) |
|
418 |
# Set the max memory for jtreg control vm |
|
419 |
JTREG_MEMORY_OPTION = -J-Xmx512m |
|
420 |
JTREG_BASIC_OPTIONS += $(JTREG_MEMORY_OPTION) |
|
421 |
# Set the max memory for jtreg target test vms |
|
422 |
JTREG_TESTVM_MEMORY_OPTION = -vmoption:-Xmx512m |
|
423 |
JTREG_TEST_OPTIONS += $(JTREG_TESTVM_MEMORY_OPTION) |
|
424 |
endif |
|
47329 | 425 |
# Make it possible to specify the JIB_DATA_DIR for tests using the |
426 |
# JIB Artifact resolver |
|
427 |
JTREG_BASIC_OPTIONS += -e:JIB_DATA_DIR |
|
42424 | 428 |
# Give tests access to JT_JAVA, see JDK-8141609 |
429 |
JTREG_BASIC_OPTIONS += -e:JDK8_HOME=${JT_JAVA} |
|
46192 | 430 |
# Give aot tests access to Visual Studio installation |
431 |
ifneq ($(VS120COMNTOOLS), ) |
|
432 |
JTREG_BASIC_OPTIONS += -e:VS120COMNTOOLS=$(shell $(GETMIXEDPATH) "$(VS120COMNTOOLS)") |
|
433 |
endif |
|
42424 | 434 |
# Set other vm and test options |
46248
5a6c03b61979
8184772: Make it possible to pass arguments only to the Java running the tests when running jtreg through make
ctornqvi
parents:
46196
diff
changeset
|
435 |
JTREG_TEST_OPTIONS += $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_VM_ARGS:%=-vmoption:%) |
46196
822ca950ddaa
8175300: Enable artifact resolution for jtreg tests
ctornqvi
parents:
46193
diff
changeset
|
436 |
ifneq ($(JIB_JAR), ) |
822ca950ddaa
8175300: Enable artifact resolution for jtreg tests
ctornqvi
parents:
46193
diff
changeset
|
437 |
JTREG_BASIC_OPTIONS += -cpa:$(shell $(GETMIXEDPATH) "$(JIB_JAR)") |
822ca950ddaa
8175300: Enable artifact resolution for jtreg tests
ctornqvi
parents:
46193
diff
changeset
|
438 |
endif |
42424 | 439 |
ifeq ($(IGNORE_MARKED_TESTS), true) |
440 |
# Option to tell jtreg to not run tests marked with "ignore" |
|
441 |
ifeq ($(PLATFORM), windows) |
|
442 |
JTREG_KEY_OPTION = -k:!ignore |
|
443 |
else |
|
444 |
JTREG_KEY_OPTION = -k:\!ignore |
|
445 |
endif |
|
446 |
JTREG_BASIC_OPTIONS += $(JTREG_KEY_OPTION) |
|
447 |
endif |
|
448 |
||
449 |
# Make sure jtreg exists |
|
450 |
ifeq ($(USE_WINDOWS_EXISTENCE_CHECK), true) |
|
451 |
jtreg_exists: |
|
452 |
test -d $(shell $(GETMIXEDPATH) "$(JT_HOME)") |
|
453 |
test -f $(shell $(GETMIXEDPATH) "$(JTREG)") |
|
454 |
||
455 |
else |
|
456 |
jtreg_exists: $(JT_HOME) |
|
457 |
endif |
|
458 |
PHONY_LIST += jtreg_exists |
|
459 |
||
460 |
# Run jtreg |
|
48980
ab7784555b4c
8197906: Enable CDS mode execution of jtreg tests via make
mseledtsov
parents:
48693
diff
changeset
|
461 |
jtreg_tests: prep jtreg_exists $(PRODUCT_HOME) $(TEST_PREREQS) |
42424 | 462 |
( \ |
463 |
( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)"); \ |
|
464 |
export JT_HOME; \ |
|
465 |
$(shell $(GETMIXEDPATH) "$(JTREG)") \ |
|
466 |
$(JTREG_BASIC_OPTIONS) \ |
|
467 |
-r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport") \ |
|
468 |
-w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTwork") \ |
|
469 |
-jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \ |
|
470 |
$(JTREG_NATIVE_PATH) \ |
|
471 |
$(JTREG_FAILURE_HANDLER_OPTIONS) \ |
|
472 |
$(JTREG_EXCLUSIONS) \ |
|
473 |
$(JTREG_TEST_OPTIONS) \ |
|
474 |
$(TEST_SELECTION) \ |
|
475 |
) ; \ |
|
476 |
$(BUNDLE_UP_AND_EXIT) \ |
|
477 |
) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt ; $(TESTEXIT) |
|
478 |
||
479 |
PHONY_LIST += jtreg_tests |
|
480 |
||
47218 | 481 |
# Make it possible to call this with <component>_jtreg_tests |
482 |
%_jtreg_tests: jtreg_tests |
|
483 |
# Must have a fake recipe here to prevent make from matching any other rule |
|
484 |
||
42424 | 485 |
################################################################ |
486 |
||
487 |
# Phony targets (e.g. these are not filenames) |
|
488 |
.PHONY: all clean prep $(PHONY_LIST) |
|
489 |
||
490 |
################################################################ |