forked from adoptium/TKG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.mk
321 lines (272 loc) · 10.1 KB
/
settings.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
##############################################################################
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##############################################################################
.PHONY: help rmResultFile resultsSummary
help:
@echo "This makefile is used to build and execute JVM tests. You should specify the following"
@echo "variables before using this script:"
@echo "required:"
@echo " TEST_JDK_HOME=<path to JDK home directory that you wish to test>"
@echo " BUILD_LIST=<comma separated projects to be compiled and executed> (default to all projects)"
@echo "optional:"
@echo " SPEC=[linux_x86-64|linux_x86-64_cmprssptrs|...] (platform on which to test, could be auto detected)"
@echo " JDK_VERSION=[8|9|10|11|12|Panama|Valhalla] (default to 8, could be auto detected)"
@echo " JDK_IMPL=[openj9|ibm|hotspot|sap] (default to openj9, could be auto detected)"
@echo " NATIVE_TEST_LIBS=<path to native test libraries> (default to native-test-libs folder at the same level as TEST_JDK_HOME)"
CD = cd
ECHO = echo
MKDIR = mkdir
MKTREE = mkdir -p
PWD = pwd
EXECUTABLE_SUFFIX =
RUN_SCRIPT = sh
RUN_SCRIPT_STRING = "sh -c"
SCRIPT_SUFFIX=.sh
Q="
SQ='
P=:
AND_IF_SUCCESS=&&
PROPS_DIR=props_unix
TOTALCOUNT := 0
-include $(TEST_ROOT)$(D)TKG$(D)autoGenEnv.mk
include $(TEST_ROOT)$(D)TKG$(D)envSettings.mk
-include $(TEST_ROOT)$(D)TKG$(D)utils.mk
include $(TEST_ROOT)$(D)TKG$(D)testEnv.mk
include $(TEST_ROOT)$(D)TKG$(D)featureSettings.mk
ifndef JDK_VERSION
export JDK_VERSION:=8
else
export JDK_VERSION:=$(JDK_VERSION)
endif
ifndef TEST_JDK_HOME
$(error Please provide TEST_JDK_HOME value.)
else
export TEST_JDK_HOME := $(subst \,/,$(TEST_JDK_HOME))
endif
ifndef SPEC
$(error Please provide SPEC that matches the current platform (e.g. SPEC=linux_x86-64))
else
export SPEC:=$(SPEC)
endif
# temporarily support both JAVA_IMPL and JDK_IMPL
ifndef JDK_IMPL
ifndef JAVA_IMPL
export JDK_IMPL:=openj9
else
export JDK_IMPL:=$(JAVA_IMPL)
endif
else
export JDK_IMPL:=$(JDK_IMPL)
endif
export JDK_VENDOR:=$(JDK_VENDOR)
ifndef JVM_VERSION
OPENJDK_VERSION = openjdk$(JDK_VERSION)
ifeq (hotspot, $(JDK_IMPL))
JVM_VERSION = $(OPENJDK_VERSION)
else
JVM_VERSION = $(OPENJDK_VERSION)-$(JDK_IMPL)
endif
export JVM_VERSION:=$(JVM_VERSION)
endif
ifneq (,$(findstring win,$(SPEC)))
P=;
D=\\
EXECUTABLE_SUFFIX=.exe
RUN_SCRIPT="cmd /c"
RUN_SCRIPT_STRING=$(RUN_SCRIPT)
SCRIPT_SUFFIX=.bat
PROPS_DIR=props_win
endif
# Environment variable OSTYPE is set to cygwin if running under cygwin.
ifndef CYGWIN
OSTYPE?=$(shell echo $$OSTYPE)
ifeq ($(OSTYPE),cygwin)
CYGWIN:=1
else
CYGWIN:=0
endif
endif
ifeq ($(CYGWIN),1)
TEST_ROOT := $(shell cygpath -w $(TEST_ROOT))
endif
TEST_ROOT := $(subst \,/,$(TEST_ROOT))
ifndef BUILD_ROOT
BUILD_ROOT := $(TEST_ROOT)$(D)..$(D)jvmtest
BUILD_ROOT := $(subst \,/,$(BUILD_ROOT))
endif
JVM_TEST_ROOT = $(BUILD_ROOT)
TEST_GROUP=level.*
#######################################
# Set OS, ARCH and BITS based on SPEC
#######################################
WORD_LIST:= $(subst _, ,$(SPEC))
OS:=os.$(word 1,$(WORD_LIST))
ARCH_INFO:=$(word 2,$(WORD_LIST))
BITS=bits.32
ARCH=arch.$(ARCH_INFO)
ifneq (,$(findstring 64,$(ARCH_INFO)))
BITS=bits.64
ifneq (,$(findstring -64,$(ARCH_INFO)))
ARCH:=arch.$(subst -64,,$(ARCH_INFO))
else
ARCH:=arch.$(subst 64,,$(ARCH_INFO))
endif
else
ifneq (,$(findstring 390,$(ARCH_INFO)))
BITS=bits.31
endif
endif
ifneq ($(DEBUG),)
$(info OS is set to $(OS), ARCH is set to $(ARCH) and BITS is set to $(BITS))
endif
DEFAULT_EXCLUDE=d.*.$(SPEC),d.*.$(ARCH),d.*.$(OS),d.*.$(BITS),d.*.generic-all
ifneq ($(DEBUG),)
$(info DEFAULT_EXCLUDE is set to $(DEFAULT_EXCLUDE))
endif
JAVA_COMMAND:=$(Q)$(TEST_JDK_HOME)$(D)bin$(D)java$(Q)
#######################################
# common dir and jars
#######################################
LIB_DIR=$(TEST_ROOT)$(D)TKG$(D)lib
TESTNG=$(LIB_DIR)$(D)testng.jar$(P)$(LIB_DIR)$(D)jcommander.jar
RESOURCES_DIR=$(JVM_TEST_ROOT)$(D)TestConfig$(D)resources
#######################################
# cmdlinetester jars
#######################################
CMDLINETESTER_JAR =$(Q)$(JVM_TEST_ROOT)$(D)functional$(D)cmdline_options_tester$(D)cmdlinetester.jar$(Q)
CMDLINETESTER_RESJAR=$(Q)$(JVM_TEST_ROOT)$(D)functional$(D)cmdline_options_testresources$(D)cmdlinetestresources.jar$(Q)
#######################################
# testng report dir
#######################################
ifndef UNIQUEID
GETID := $(TEST_ROOT)$(D)TKG$(D)scripts$(D)getUniqueId.pl
export UNIQUEID := $(shell perl $(GETID) -v)
endif
TESTOUTPUT := $(TEST_ROOT)$(D)TKG$(D)output_$(UNIQUEID)
ifeq ($(TEST_ITERATIONS), 1)
REPORTDIR_NQ = $(TESTOUTPUT)$(D)$@
else
REPORTDIR_NQ = $(TESTOUTPUT)$(D)$@_ITER_$$itercnt
endif
REPORTDIR = $(Q)$(REPORTDIR_NQ)$(Q)
#######################################
# TEST_STATUS
#######################################
RM_REPORTDIR=
KEEP_REPORTDIR?=true
ifeq ($(KEEP_REPORTDIR), false)
RM_REPORTDIR=$(RM) -r $(REPORTDIR);
endif
ifeq ($(TEST_ITERATIONS), 1)
TEST_STATUS=if [ $$? -eq 0 ] ; then $(ECHO) $(Q)$(Q); $(ECHO) $(Q)$@$(Q)$(Q)_PASSED$(Q); $(ECHO) $(Q)$(Q); $(CD) $(TEST_ROOT); $(RM_REPORTDIR) else $(ECHO) $(Q)$(Q); $(ECHO) $(Q)$@$(Q)$(Q)_FAILED$(Q); $(ECHO) $(Q)$(Q); fi
else
TEST_STATUS=if [ $$? -eq 0 ] ; then $(ECHO) $(Q)$(Q); $(ECHO) $(Q)$@$(Q)$(Q)_PASSED(ITER_$$itercnt)$(Q); $(ECHO) $(Q)$(Q); $(CD) $(TEST_ROOT); $(RM_REPORTDIR) if [ $$itercnt -eq $(TEST_ITERATIONS) ] ; then $(ECHO) $(Q)$(Q); $(ECHO) $(Q)$@$(Q)$(Q)_PASSED$(Q); $(ECHO) $(Q)$(Q); fi else $(ECHO) $(Q)$(Q); $(ECHO) $(Q)$@$(Q)$(Q)_FAILED(ITER_$$itercnt)$(Q); $(ECHO) $(Q)$(Q); $(ECHO) $(Q)$(Q); $(ECHO) $(Q)$@$(Q)$(Q)_FAILED$(Q); $(ECHO) $(Q)$(Q); exit 1; fi
endif
ifneq ($(DEBUG),)
$(info TEST_STATUS is $(TEST_STATUS))
endif
TEST_SKIP_STATUS=$@_SKIPPED
#######################################
# TEST_SETUP
#######################################
TEST_SETUP=@echo "Nothing to be done for setup."
ifeq ($(JDK_IMPL), $(filter $(JDK_IMPL),openj9 ibm))
TEST_SETUP=$(JAVA_COMMAND) -Xshareclasses:destroyAll; $(JAVA_COMMAND) -Xshareclasses:groupAccess,destroyAll; echo "cache cleanup done"
endif
#######################################
# TEST_TEARDOWN
#######################################
TEST_TEARDOWN=@echo "Nothing to be done for teardown."
ifeq ($(JDK_IMPL), $(filter $(JDK_IMPL),openj9 ibm))
TEST_TEARDOWN=$(JAVA_COMMAND) -Xshareclasses:destroyAll; $(JAVA_COMMAND) -Xshareclasses:groupAccess,destroyAll; echo "cache cleanup done"
endif
#######################################
# include configure makefile
#######################################
ifndef MACHINE_MK
-include $(JVM_TEST_ROOT)$(D)TKG$(D)machineConfigure.mk
else
-include $(MACHINE_MK)$(D)machineConfigure.mk
endif
#######################################
# include openj9 specific settings
#######################################
ifeq ($(JDK_IMPL), $(filter $(JDK_IMPL),openj9 ibm))
include $(TEST_ROOT)$(D)TKG$(D)openj9Settings.mk
endif
#######################################
# generic target
#######################################
_TESTTARGET = $(firstword $(MAKECMDGOALS))
TESTTARGET = $(patsubst _%,%,$(_TESTTARGET))
SUBDIRS_TESTTARGET = $(SUBDIRS:%=$(TESTTARGET)-%)
$(SUBDIRS_TESTTARGET):
@if [ -f $(Q)$(@:$(TESTTARGET)-%=%)/autoGen.mk$(Q) ]; then \
$(MAKE) -C $(@:$(TESTTARGET)-%=%) -f autoGen.mk $(TESTTARGET); \
fi
$(TESTTARGET): $(SUBDIRS_TESTTARGET)
_$(TESTTARGET): setup_$(TESTTARGET) rmResultFile $(TESTTARGET) resultsSummary teardown_$(TESTTARGET)
@$(ECHO) $@ done
.PHONY: _$(TESTTARGET) $(TESTTARGET) $(SUBDIRS) $(SUBDIRS_TESTTARGET)
.NOTPARALLEL: _$(TESTTARGET) $(TESTTARGET) $(SUBDIRS) $(SUBDIRS_TESTTARGET)
setup_%: testEnvSetup
@$(ECHO)
@$(ECHO) Running make $(MAKE_VERSION)
@$(ECHO) set TEST_ROOT to $(TEST_ROOT)
@$(ECHO) set JDK_VERSION to $(JDK_VERSION)
@$(ECHO) set JDK_IMPL to $(JDK_IMPL)
@$(ECHO) set JVM_VERSION to $(JVM_VERSION)
@$(ECHO) set JCL_VERSION to $(JCL_VERSION)
@if [ $(OLD_JAVA_HOME) ]; then \
$(ECHO) JAVA_HOME was originally set to $(OLD_JAVA_HOME); \
fi
@$(ECHO) set JAVA_HOME to $(JAVA_HOME)
@$(ECHO) set SPEC to $(SPEC)
@$(MKTREE) $(Q)$(TESTOUTPUT)$(Q)
@$(ECHO) Running $(TESTTARGET) ...
@if [ $(TOTALCOUNT) -ne 0 ]; then \
$(ECHO) There are $(TOTALCOUNT) test targets in $(TESTTARGET); \
else \
$(ECHO) There is no test for target $(TESTTARGET); \
fi
$(JAVA_COMMAND) -version
teardown_%: testEnvTeardown
@$(ECHO)
ifndef JCL_VERSION
export JCL_VERSION:=latest
else
export JCL_VERSION:=$(JCL_VERSION)
endif
# Define the EXCLUDE_FILE to be used for temporarily excluding failed tests.
# This macro is used in /test/Utils/src/org/openj9/test/util/IncludeExcludeTestAnnotationTransformer
ifndef EXCLUDE_FILE
export EXCLUDE_FILE:=$(TEST_ROOT)$(D)TestConfig$(D)resources$(D)excludes$(D)$(JCL_VERSION)_exclude_$(JDK_VERSION).txt
endif
#######################################
# failed target
#######################################
FAILEDTARGETS = $(TEST_ROOT)$(D)TKG$(D)failedtargets.mk
#######################################
# result Summary
#######################################
TEMPRESULTFILE=$(TESTOUTPUT)$(D)TestTargetResult
TAPRESULTFILE=$(TESTOUTPUT)$(D)TestTargetResult.tap
PLATFROMFILE=$(TEST_ROOT)$(D)TKG$(D)resources$(D)buildPlatformMap.properties
ifndef DIAGNOSTICLEVEL
export DIAGNOSTICLEVEL:=failure
endif
rmResultFile:
@$(RM) $(Q)$(TEMPRESULTFILE)$(Q)
resultsSummary:
$(CD) $(Q)$(TEST_ROOT)$(D)TKG$(D)scripts$(Q); \
perl $(Q)resultsSum.pl$(Q) --failuremk=$(Q)$(FAILEDTARGETS)$(Q) --resultFile=$(Q)$(TEMPRESULTFILE)$(Q) --tapFile=$(Q)$(TAPRESULTFILE)$(Q) --platFile=$(Q)$(PLATFROMFILE)$(Q) --diagnostic=$(DIAGNOSTICLEVEL) --jdkVersion=$(JDK_VERSION) --jdkImpl=$(JDK_IMPL) --jdkVendor=$(Q)$(JDK_VENDOR)$(Q) --spec=$(SPEC) --buildList=$(BUILD_LIST) --customTarget=$(CUSTOM_TARGET)