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