author | mbaesken |
Fri, 08 Jun 2018 13:06:08 +0200 | |
changeset 50464 | 102ae98c917c |
parent 49147 | af37d9997bd6 |
child 52125 | 28375a1de254 |
child 56362 | 6230fcdd4fd8 |
permissions | -rw-r--r-- |
48078 | 1 |
# |
2 |
# Copyright (c) 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 |
################################################################################ |
|
27 |
# Initial bootstrapping, copied and stripped down from Makefile and Init.gmk |
|
28 |
################################################################################ |
|
29 |
||
30 |
# In Cygwin, the MAKE variable gets prepended with the current directory if the |
|
31 |
# make executable is called using a Windows mixed path (c:/cygwin/bin/make.exe). |
|
32 |
ifneq ($(findstring :, $(MAKE)), ) |
|
33 |
export MAKE := $(patsubst $(CURDIR)%, %, $(patsubst $(CURDIR)/%, %, $(MAKE))) |
|
34 |
endif |
|
35 |
||
36 |
# Locate this Makefile |
|
37 |
ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))),) |
|
38 |
makefile_path := $(CURDIR)/$(strip $(lastword $(MAKEFILE_LIST))) |
|
39 |
else |
|
40 |
makefile_path := $(lastword $(MAKEFILE_LIST)) |
|
41 |
endif |
|
42 |
TOPDIR := $(strip $(patsubst %/make/, %, $(dir $(makefile_path)))) |
|
43 |
||
44 |
################################################################################ |
|
45 |
# Functions |
|
46 |
################################################################################ |
|
47 |
||
48 |
# Setup a required or optional variable, and/or check that it is properly |
|
49 |
# given. |
|
50 |
# Note: No spaces are allowed around the arguments. |
|
51 |
# |
|
52 |
# $1: The name of the argument |
|
53 |
# $2: The default value, if any, or OPTIONAL (do not provide a default but |
|
54 |
# do not exit if it is missing) |
|
55 |
# $3: If NO_CHECK, disable checking for target file/directory existence |
|
56 |
define SetupVariable |
|
57 |
ifeq ($$($1), ) |
|
58 |
ifeq ($2, ) |
|
59 |
$$(info Error: Prebuilt variable $1 is missing, needed for run-tests-prebuilt) |
|
60 |
$$(error Cannot continue.) |
|
61 |
else ifeq ($2, OPTIONAL) |
|
62 |
ifneq ($$(findstring $$(LOG), info debug trace), ) |
|
63 |
$$(info Prebuilt variable $1 is not provided) |
|
64 |
endif |
|
65 |
else |
|
66 |
ifneq ($$(findstring $$(LOG), info debug trace), ) |
|
67 |
$$(info Prebuilt variable $1=$2 (default value)) |
|
68 |
endif |
|
69 |
$1:=$2 |
|
70 |
endif |
|
71 |
else |
|
72 |
ifneq ($$(findstring $$(LOG), info debug trace), ) |
|
73 |
$$(info Prebuilt variable $1=$$($1)) |
|
74 |
endif |
|
75 |
endif |
|
76 |
# If $1 has a value (is not optional), and $3 is not set (to NO_CHECK), |
|
77 |
# and if wildcard is empty, then complain that the file is missing. |
|
78 |
ifeq ($$(strip $$(if $$($1), , OPTIONAL) $$(wildcard $$($1)) $3), ) |
|
79 |
$$(info Error: Prebuilt variable $1 points to missing file/directory:) |
|
80 |
$$(info '$$($1)') |
|
81 |
$$(error Cannot continue.) |
|
82 |
endif |
|
83 |
endef |
|
84 |
||
85 |
# Create an ephemeral spec file |
|
86 |
# |
|
87 |
# $1: The output file name |
|
88 |
# $2..$N: The lines to output to the file |
|
89 |
define CreateNewSpec |
|
90 |
$(if $(strip $(26)), \ |
|
91 |
$(error Internal makefile error: \ |
|
92 |
Too many arguments to macro, please update CreateNewSpec in RunTestsPrebuilt.gmk) \ |
|
93 |
) \ |
|
94 |
$(shell $(RM) $1) \ |
|
95 |
$(foreach i, $(call sequence, 2, 25), \ |
|
96 |
$(if $(strip $($i)), \ |
|
97 |
$(call AppendFile, $(strip $($i)), $1) \ |
|
98 |
) \ |
|
99 |
) |
|
100 |
endef |
|
101 |
||
102 |
################################################################################ |
|
103 |
# Check input and setup basic buildsystem support |
|
104 |
################################################################################ |
|
105 |
||
106 |
# Verify that user has given correct additional input. |
|
107 |
||
108 |
# These variables are absolutely necessary |
|
109 |
$(eval $(call SetupVariable,OUTPUTDIR)) |
|
110 |
$(eval $(call SetupVariable,BOOT_JDK)) |
|
111 |
$(eval $(call SetupVariable,JT_HOME)) |
|
112 |
||
113 |
# These can have default values based on the ones above |
|
114 |
$(eval $(call SetupVariable,JDK_IMAGE_DIR,$(OUTPUTDIR)/images/jdk)) |
|
115 |
$(eval $(call SetupVariable,TEST_IMAGE_DIR,$(OUTPUTDIR)/images/test)) |
|
49147
af37d9997bd6
8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents:
48078
diff
changeset
|
116 |
$(eval $(call SetupVariable,SYMBOLS_IMAGE_DIR,$(OUTPUTDIR)/images/symbols)) |
48078 | 117 |
|
118 |
# Provide default values for tools that we need |
|
119 |
$(eval $(call SetupVariable,MAKE,make,NO_CHECK)) |
|
120 |
$(eval $(call SetupVariable,BASH,bash,NO_CHECK)) |
|
121 |
||
122 |
# Check optional variables |
|
123 |
$(eval $(call SetupVariable,JIB_JAR,OPTIONAL)) |
|
124 |
||
125 |
# Now that we have verified that we have the required variables available, we |
|
126 |
# can include the prebuilt spec file ourselves, without an ephemeral spec |
|
127 |
# wrapper. This is required so we can include MakeBase which is needed for |
|
128 |
# CreateNewSpec. |
|
129 |
HAS_SPEC := |
|
130 |
include $(TOPDIR)/make/InitSupport.gmk |
|
131 |
||
132 |
$(eval $(call CheckDeprecatedEnvironment)) |
|
133 |
$(eval $(call CheckInvalidMakeFlags)) |
|
134 |
$(eval $(call ParseLogLevel)) |
|
135 |
||
136 |
SPEC := $(TOPDIR)/make/RunTestsPrebuiltSpec.gmk |
|
137 |
include $(SPEC) |
|
138 |
include $(TOPDIR)/make/common/MakeBase.gmk |
|
139 |
||
140 |
################################################################################ |
|
141 |
# Determine what platform we're running on |
|
142 |
################################################################################ |
|
143 |
UNAME := uname |
|
144 |
||
145 |
# Get OS name from uname (Cygwin inexplicably adds _NT-x.x) |
|
146 |
UNAME_OS := $(shell $(UNAME) -s | $(CUT) -f1 -d_) |
|
147 |
||
148 |
ifeq ($(UNAME_OS), CYGWIN) |
|
149 |
OPENJDK_TARGET_OS := windows |
|
150 |
OPENJDK_TARGET_OS_TYPE := windows |
|
151 |
OPENJDK_TARGET_OS_ENV := windows.cygwin |
|
152 |
else |
|
153 |
OPENJDK_TARGET_OS_TYPE:=unix |
|
154 |
ifeq ($(UNAME_OS), Linux) |
|
155 |
OPENJDK_TARGET_OS := linux |
|
156 |
else ifeq ($(UNAME_OS), Darwin) |
|
157 |
OPENJDK_TARGET_OS := macosx |
|
158 |
else ifeq ($(UNAME_OS), SunOS) |
|
159 |
OPENJDK_TARGET_OS := solaris |
|
160 |
else |
|
161 |
OPENJDK_TARGET_OS := $(UNAME_OS) |
|
162 |
endif |
|
163 |
OPENJDK_TARGET_OS_ENV := $(OPENJDK_TARGET_OS) |
|
164 |
endif |
|
165 |
||
166 |
# Assume little endian unless otherwise specified |
|
167 |
OPENJDK_TARGET_CPU_ENDIAN := little |
|
168 |
||
169 |
ifeq ($(OPENJDK_TARGET_OS), solaris) |
|
170 |
# On solaris, use uname -p |
|
171 |
UNAME_CPU := $(shell $(UNAME) -p) |
|
172 |
# Assume 64-bit platform |
|
173 |
OPENJDK_TARGET_CPU_BITS := 64 |
|
174 |
ifeq ($(UNAME_CPU), i386) |
|
175 |
OPENJDK_TARGET_CPU := x86_64 |
|
176 |
else ifeq ($(UNAME_CPU), sparc) |
|
177 |
OPENJDK_TARGET_CPU := sparcv9 |
|
178 |
OPENJDK_TARGET_CPU_ENDIAN := big |
|
179 |
else |
|
180 |
OPENJDK_TARGET_CPU := $(UNAME_CPU) |
|
181 |
endif |
|
182 |
else |
|
183 |
# ... all others use uname -m |
|
184 |
UNAME_CPU := $(shell $(UNAME) -m) |
|
185 |
ifeq ($(UNAME_CPU), i686) |
|
186 |
OPENJDK_TARGET_CPU := x86 |
|
187 |
OPENJDK_TARGET_CPU_BITS := 32 |
|
188 |
else |
|
189 |
# Assume all others are 64-bit. We use the same CPU name as uname for |
|
190 |
# at least x86_64 and aarch64. |
|
191 |
OPENJDK_TARGET_CPU := $(UNAME_CPU) |
|
192 |
OPENJDK_TARGET_CPU_BITS := 64 |
|
193 |
endif |
|
194 |
endif |
|
195 |
||
196 |
OPENJDK_TARGET_CPU_ARCH := $(OPENJDK_TARGET_CPU) |
|
197 |
ifeq ($(OPENJDK_TARGET_CPU), x86_64) |
|
198 |
OPENJDK_TARGET_CPU_ARCH := x86 |
|
199 |
else ifeq ($(OPENJDK_TARGET_CPU), sparcv9) |
|
200 |
OPENJDK_TARGET_CPU_ARCH := sparc |
|
201 |
endif |
|
202 |
||
203 |
ifeq ($(OPENJDK_TARGET_OS), windows) |
|
204 |
ifeq ($(wildcard $(TEST_IMAGE_DIR)/bin/fixpath.exe), ) |
|
205 |
$$(info Error: fixpath is missing from test image '$(TEST_IMAGE_DIR)') |
|
206 |
$$(error Cannot continue.) |
|
207 |
endif |
|
208 |
FIXPATH := $(TEST_IMAGE_DIR)/bin/fixpath.exe -c |
|
209 |
PATH_SEP:=; |
|
210 |
else |
|
211 |
FIXPATH := |
|
212 |
PATH_SEP:=: |
|
213 |
endif |
|
214 |
||
215 |
# Check number of cores |
|
216 |
ifeq ($(OPENJDK_TARGET_OS), linux) |
|
217 |
NUM_CORES := $(shell $(CAT) /proc/cpuinfo | $(GREP) -c processor) |
|
218 |
else ifeq ($(OPENJDK_TARGET_OS), macosx) |
|
219 |
NUM_CORES := $(shell /usr/sbin/sysctl -n hw.ncpu) |
|
220 |
else ifeq ($(OPENJDK_TARGET_OS), solaris) |
|
221 |
NUM_CORES := $(shell LC_MESSAGES=C /usr/sbin/psrinfo -v | $(GREP) -c on-line) |
|
222 |
else ifeq ($(OPENJDK_TARGET_OS), windows) |
|
223 |
NUM_CORES := $(NUMBER_OF_PROCESSORS) |
|
224 |
else |
|
225 |
NUM_CORES := 1 |
|
226 |
endif |
|
227 |
||
228 |
################################################################################ |
|
229 |
# Generate the ephemeral spec file |
|
230 |
################################################################################ |
|
231 |
||
232 |
# Now we can include additional custom support. |
|
233 |
# This might define CUSTOM_NEW_SPEC_LINE |
|
234 |
ifneq ($(CUSTOM_MAKE_DIR), ) |
|
235 |
include $(CUSTOM_MAKE_DIR)/RunTestsPrebuilt.gmk |
|
236 |
endif |
|
237 |
||
238 |
NEW_SPEC := $(OUTPUTDIR)/run-test-spec.gmk |
|
239 |
||
240 |
$(call CreateNewSpec, $(NEW_SPEC), \ |
|
241 |
# Generated file -- do not edit!, \ |
|
242 |
SPEC := $(NEW_SPEC), \ |
|
243 |
TOPDIR := $(TOPDIR), \ |
|
244 |
OUTPUTDIR := $(OUTPUTDIR), \ |
|
245 |
BOOT_JDK := $(BOOT_JDK), \ |
|
246 |
JT_HOME := $(JT_HOME), \ |
|
247 |
JDK_IMAGE_DIR := $(JDK_IMAGE_DIR), \ |
|
248 |
TEST_IMAGE_DIR := $(TEST_IMAGE_DIR), \ |
|
49147
af37d9997bd6
8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents:
48078
diff
changeset
|
249 |
SYMBOLS_IMAGE_DIR := $(SYMBOLS_IMAGE_DIR), \ |
48078 | 250 |
MAKE := $(MAKE), \ |
251 |
BASH := $(BASH), \ |
|
252 |
JIB_JAR := $(JIB_JAR), \ |
|
253 |
FIXPATH := $(FIXPATH), \ |
|
254 |
PATH_SEP := $(PATH_SEP), \ |
|
255 |
OPENJDK_TARGET_OS := $(OPENJDK_TARGET_OS), \ |
|
256 |
OPENJDK_TARGET_OS_TYPE := $(OPENJDK_TARGET_OS_TYPE), \ |
|
257 |
OPENJDK_TARGET_OS_ENV := $(OPENJDK_TARGET_OS_ENV), \ |
|
258 |
OPENJDK_TARGET_CPU := $(OPENJDK_TARGET_CPU), \ |
|
259 |
OPENJDK_TARGET_CPU_ARCH := $(OPENJDK_TARGET_CPU_ARCH), \ |
|
260 |
OPENJDK_TARGET_CPU_BITS := $(OPENJDK_TARGET_CPU_BITS), \ |
|
261 |
OPENJDK_TARGET_CPU_ENDIAN := $(OPENJDK_TARGET_CPU_ENDIAN), \ |
|
262 |
NUM_CORES := $(NUM_CORES), \ |
|
263 |
include $(TOPDIR)/make/RunTestsPrebuiltSpec.gmk, \ |
|
264 |
$(CUSTOM_NEW_SPEC_LINE), \ |
|
265 |
) |
|
266 |
||
267 |
################################################################################ |
|
268 |
# The run-test-prebuilt target |
|
269 |
################################################################################ |
|
270 |
||
271 |
SPEC := $(NEW_SPEC) |
|
272 |
||
273 |
default: all |
|
274 |
||
275 |
run-test-prebuilt: |
|
276 |
@$(RM) -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error |
|
277 |
@cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -f make/RunTests.gmk run-test \ |
|
278 |
TEST="$(TEST)" |
|
279 |
@if test -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error ; then \ |
|
280 |
exit 1 ; \ |
|
281 |
fi |
|
282 |
||
283 |
all: run-test-prebuilt |
|
284 |
||
285 |
.PHONY: default all |