70 TESTJAVA = $(JPRT_IMPORT_PRODUCT_HOME) |
100 TESTJAVA = $(JPRT_IMPORT_PRODUCT_HOME) |
71 else |
101 else |
72 TESTJAVA = $(SLASH_JAVA)/re/jdk/1.7.0/promoted/latest/binaries/$(PLATFORM)-$(ARCH) |
102 TESTJAVA = $(SLASH_JAVA)/re/jdk/1.7.0/promoted/latest/binaries/$(PLATFORM)-$(ARCH) |
73 endif |
103 endif |
74 |
104 |
75 TESTBOOTCLASSPATH = $(PRODUCT_HOME)/dist/lib/classes.jar |
105 # PRODUCT_HOME is a JPRT variable pointing to a directory containing the output from |
|
106 # make/Makefile |
|
107 # For langtools, this is a directory containing build and dist |
|
108 # For a control build, this is build/$(PRODUCT)-$(ARCH)/j2sdk-image |
|
109 ifdef PRODUCT_HOME |
|
110 ifeq ($(shell [ -r $(PRODUCT_HOME)/dist/lib/classes.jar ]; echo $$?),0) |
|
111 TESTBOOTCLASSPATH = $(PRODUCT_HOME)/dist/lib/classes.jar |
|
112 endif |
|
113 ifeq ($(shell [ -r $(PRODUCT_HOME)/lib/tools.jar ]; echo $$?),0) |
|
114 TESTJAVA = $(PRODUCT_HOME) |
|
115 endif |
|
116 endif |
|
117 |
|
118 ifdef TESTBOOTCLASSPATH |
|
119 JTREG_OPTIONS += -Xbootclasspath/p:$(TESTBOOTCLASSPATH) |
|
120 ### In the following, -refvmoptions is an undocumented option |
|
121 ### The following does not work JCK 7 b30 2/6/2010. Awaiting b31. |
|
122 JCK_OPTIONS += \ |
|
123 -vmoptions:-Xbootclasspath/p:$(TESTBOOTCLASSPATH) \ |
|
124 -refvmoptions:-Xbootclasspath/p:$(TESTBOOTCLASSPATH) |
|
125 endif |
|
126 |
|
127 # Concurrency is the number of tests that can execute at once. |
|
128 # Supported for JCK, not supported for jtreg. |
|
129 # On an otherwise empty machine, suggest setting to (#cpus + 2) |
|
130 # If unset, the default is (#cpus) |
|
131 ### RFE: determine and use #cpus |
|
132 ifdef JCK_CONCURRENCY |
|
133 JCK_OPTIONS += -concurrency:$(JCK_CONCURRENCY) |
|
134 endif |
|
135 |
|
136 # JCK is executed using "Multi-JVM Group Mode", which is a hybrid |
|
137 # of otherVM and sameVM modes. New JVMs are created and reused for |
|
138 # a number of tests, then eventually discarded and a new one started. |
|
139 # This amortizes the JVM startup time. The "group size" defines |
|
140 # how many tests are run in a JVM before it is replaced. |
|
141 # If unset, the default is 100. |
|
142 JCK_GROUP_SIZE = 1000 |
|
143 ifdef JCK_GROUP_SIZE |
|
144 JCK_COMPILER_OPTIONS += \ |
|
145 -jtoptions:-Ejck.env.compiler.testCompile.groupMode.groupSize=$(JCK_GROUP_SIZE) \ |
|
146 -jtoptions:-Ejck.env.compiler.compRefExecute.groupMode.groupSize=$(JCK_GROUP_SIZE) |
|
147 ### The following is not supported. Awaiting RFE 6924287 |
|
148 ### 6924287: Jck4Jdk: Allow to configure test group size for group mode via simple command line option |
|
149 ### JCK_RUNTIME_OPTIONS += \ |
|
150 ### -jtoptions:-Ejck.env.runtime.testCompile.groupMode.groupSize=$(JCK_GROUP_SIZE) |
|
151 endif |
|
152 |
|
153 # Assertions: some tests show failures when assertions are enabled. |
|
154 # Since javac is typically loaded via the bootclassloader (either via TESTJAVA |
|
155 # or TESTBOOTCLASSPATH), you may need -esa to enable assertions in javac. |
|
156 JTREG_OPTIONS += $(ASSERTION_OPTIONS) |
|
157 JCK_OPTIONS += $(ASSERTION_OPTIONS:%=-vmoptions:%) |
|
158 |
|
159 # Include shared options |
|
160 JCK_COMPILER_OPTIONS += $(JCK_OPTIONS) |
|
161 JCK_RUNTIME_OPTIONS += $(JCK_OPTIONS) |
|
162 |
|
163 # Exit codes: |
|
164 # jtreg, jck: 0: OK, 1: tests failed, 2: tests error; 3+: SERIOUS |
|
165 FATAL_JTREG_EXIT = 3 |
|
166 FATAL_JCK_EXIT = 3 |
|
167 # jtdiff: 0: OK, 1: differences found; 2+: SERIOUS |
|
168 FATAL_JTDIFF_EXIT = 2 |
|
169 # |
|
170 # Exit -- used for final "normal" exit from "make". Redefine to "true" to avoid |
|
171 # having make exit with non-zero return code. |
|
172 EXIT = exit |
|
173 # Function to exit shell if exit code of preceding command is greater than or equal |
|
174 # to a given level. Redefine function or preceding FATAL_*_EXIT codes as needed. |
|
175 EXIT_IF_FATAL = status=$$?; if [ $$status -ge $(1) ]; then exit $$status ; fi |
76 |
176 |
77 # The test directories to run |
177 # The test directories to run |
78 DEFAULT_TESTDIRS = . |
178 DEFAULT_TESTDIRS = . |
79 TESTDIRS = $(DEFAULT_TESTDIRS) |
179 TESTDIRS = $(DEFAULT_TESTDIRS) |
80 |
180 |
81 # Root of all test results |
181 # Root of all test results |
82 TEST_OUTPUT_DIR = $(TEST_ROOT)/o_$(PLATFORM)-$(ARCH) |
182 TEST_OUTPUT_DIR = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools |
83 |
183 ABS_TEST_OUTPUT_DIR := \ |
84 # Default make rule |
184 $(shell mkdir -p $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools; \ |
85 all apt javac javadoc javah javap: clean check jtreg-tests $(JPRT_ARCHIVE_BUNDLE) |
185 cd $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools; \ |
|
186 pwd ) |
|
187 # Subdirectories for different test runs |
|
188 JTREG_OUTPUT_DIR = $(ABS_TEST_OUTPUT_DIR)/jtreg |
|
189 JCK_COMPILER_OUTPUT_DIR = $(ABS_TEST_OUTPUT_DIR)/jck-compiler |
|
190 JCK_RUNTIME_OUTPUT_DIR = $(ABS_TEST_OUTPUT_DIR)/jck-runtime-Xcompile |
|
191 |
|
192 # Default make rule -- warning, may take a while |
|
193 all: $(JPRT_CLEAN) jtreg-tests jck-compiler-tests jck-runtime-tests $(JPRT_ARCHIVE_BUNDLE) all-summary |
86 @echo "Testing completed successfully" |
194 @echo "Testing completed successfully" |
87 |
195 |
|
196 jtreg apt javac javadoc javah javap: $(JPRT_CLEAN) jtreg-tests $(JPRT_ARCHIVE_BUNDLE) jtreg-summary |
|
197 @echo "Testing completed successfully" |
|
198 |
|
199 jck-compiler: $(JPRT_CLEAN) jck-compiler-tests $(JPRT_ARCHIVE_BUNDLE) jck-compiler-summary |
|
200 @echo "Testing completed successfully" |
|
201 |
|
202 jck-runtime: $(JPRT_CLEAN) jck-runtime-tests $(JPRT_ARCHIVE_BUNDLE) jck-runtime-summary |
|
203 @echo "Testing completed successfully" |
|
204 |
88 # for use with JPRT -testrule |
205 # for use with JPRT -testrule |
89 all: TESTDIRS = . |
206 all: JTREG_TESTDIRS = . |
90 apt: TESTDIRS = tools/apt |
207 jtreg: JTREG_TESTDIRS = . |
91 javac: TESTDIRS = tools/javac |
208 apt: JTREG_TESTDIRS = tools/apt |
92 javadoc: TESTDIRS = tools/javadoc com/sun/javadoc |
209 javac: JTREG_TESTDIRS = tools/javac |
93 javah: TESTDIRS = tools/javah |
210 javadoc: JTREG_TESTDIRS = tools/javadoc com/sun/javadoc |
94 javap: TESTDIRS = tools/javap |
211 javah: JTREG_TESTDIRS = tools/javah |
|
212 javap: JTREG_TESTDIRS = tools/javap |
|
213 |
|
214 # Run jtreg tests |
|
215 # |
|
216 # JTREG_HOME |
|
217 # Installed location of jtreg |
|
218 # JT_JAVA |
|
219 # Version of java used to run jtreg. Should normally be the same as TESTJAVA |
|
220 # TESTJAVA |
|
221 # Version of java to be tested. |
|
222 # JTREG_OPTIONS |
|
223 # Additional options for jtreg |
|
224 # JTREG_TESTDIRS |
|
225 # Directories of tests to be run |
|
226 # JTREG_OUTPUT_DIR |
|
227 # Where to write the results |
|
228 # JTREG_REFERENCE |
|
229 # (Optional) reference results (e.g. work, report or summary.txt) |
|
230 # |
|
231 jtreg-tests: check-jtreg FRC |
|
232 @rm -f -r $(JTREG_OUTPUT_DIR)/JTwork $(JTREG_OUTPUT_DIR)/JTreport \ |
|
233 $(JTREG_OUTPUT_DIR)/diff.html $(JTREG_OUTPUT_DIR)/status.txt |
|
234 @mkdir -p $(JTREG_OUTPUT_DIR) |
|
235 JT_JAVA=$(JT_JAVA) $(JTREG) \ |
|
236 -J-Xmx512m \ |
|
237 -a -samevm -ignore:quiet -v:fail,error,nopass \ |
|
238 -r:$(JTREG_OUTPUT_DIR)/JTreport \ |
|
239 -w:$(JTREG_OUTPUT_DIR)/JTwork \ |
|
240 -jdk:$(TESTJAVA) \ |
|
241 $(JAVA_ARGS:%=-vmoption:%) \ |
|
242 $(JTREG_OPTIONS) \ |
|
243 $(JTREG_TESTDIRS) \ |
|
244 || ( $(call EXIT_IF_FATAL,$(FATAL_JTREG_EXIT)) ; \ |
|
245 echo $$status > $(JTREG_OUTPUT_DIR)/status.txt \ |
|
246 ) |
|
247 ifdef JTREG_REFERENCE |
|
248 JT_JAVA=$(JT_JAVA) $(JTDIFF) -o $(JTREG_OUTPUT_DIR)/diff.html \ |
|
249 $(JTREG_REFERENCE) $(JTREG_OUTPUT_DIR)/JTreport \ |
|
250 || ( $(call EXIT_IF_FATAL,$(FATAL_JTDIFF_EXIT)) ) |
|
251 endif |
|
252 |
|
253 jtreg-summary: FRC |
|
254 if [ -r $(JTREG_OUTPUT_DIR)/status.txt ]; then \ |
|
255 echo ; echo "Summary of jtreg test failures" ; \ |
|
256 cat $(JTREG_OUTPUT_DIR)/JTreport/text/summary.txt | \ |
|
257 grep -v 'Not run' | grep -v 'Passed' ; \ |
|
258 echo ; \ |
|
259 $(EXIT) `cat $(JTREG_OUTPUT_DIR)/status.txt` ; \ |
|
260 fi |
95 |
261 |
96 # Check to make sure these directories exist |
262 # Check to make sure these directories exist |
97 check: $(JT_HOME) $(PRODUCT_HOME) $(JTREG) |
263 check-jtreg: $(JT_HOME) $(PRODUCT_HOME) $(JTREG) |
98 |
264 |
99 # Run the tests |
265 |
100 jtreg-tests: FRC |
266 # Run JCK-compiler tests |
101 @echo "Using export JAVA_TOOL_OPTIONS=$(JAVA_TOOL_OPTIONS)" |
267 # |
102 @rm -f -r $(TEST_OUTPUT_DIR)/JTwork $(TEST_OUTPUT_DIR)/JTreport |
268 # JCK_HOME |
103 @mkdir -p $(TEST_OUTPUT_DIR) |
269 # Installed location of JCK: should include JCK-compiler, and JCK-extras |
104 JT_JAVA=$(JT_JAVA) $(JTREG) \ |
270 # JT_JAVA |
105 -a -samevm -k:\!ignore -v:fail,error,nopass \ |
271 # Version of java used to run JCK. Should normally be the same as TESTJAVA |
106 -r:$(TEST_OUTPUT_DIR)/JTreport \ |
272 # TESTJAVA |
107 -w:$(TEST_OUTPUT_DIR)/JTwork \ |
273 # Version of java to be tested. |
108 -jdk:$(TESTJAVA) \ |
274 # JCK_COMPILER_OPTIONS |
109 -Xbootclasspath/p:$(TESTBOOTCLASSPATH) \ |
275 # Additional options for JCK-compiler |
110 $(JAVA_ARGS:%=-vmoption:%) \ |
276 # JCK_COMPILER_TESTDIRS |
111 $(TESTDIRS) \ |
277 # Directories of tests to be run |
112 || ( status=$$? ; \ |
278 # JCK_COMPILER_OUTPUT_DIR |
113 echo ; echo "Summary of test failures" ; \ |
279 # Where to write the results |
114 cat $(TEST_OUTPUT_DIR)/JTreport/text/summary.txt | \ |
280 # JCK_COMPILER_REFERENCE |
115 grep -v 'Not run' | grep -v 'Passed' ; \ |
281 # (Optional) reference results (e.g. work, report or summary.txt) |
116 echo ; \ |
282 # |
117 exit $$status ) |
283 jck-compiler-tests: check-jck FRC |
|
284 @rm -f -r $(JCK_COMPILER_OUTPUT_DIR)/work $(JCK_COMPILER_OUTPUT_DIR)/report \ |
|
285 $(JCK_COMPILER_OUTPUT_DIR)/diff.html $(JCK_COMPILER_OUTPUT_DIR)/status.txt |
|
286 @mkdir -p $(JCK_COMPILER_OUTPUT_DIR) |
|
287 $(JT_JAVA)/bin/java -XX:MaxPermSize=256m -Xmx512m \ |
|
288 -jar $(JCK_HOME)/JCK-compiler-7/lib/jtjck.jar \ |
|
289 -v:non-pass \ |
|
290 -r:$(JCK_COMPILER_OUTPUT_DIR)/report \ |
|
291 -w:$(JCK_COMPILER_OUTPUT_DIR)/work \ |
|
292 -jdk:$(TESTJAVA) \ |
|
293 $(JCK_COMPILER_OPTIONS) \ |
|
294 $(JCK_COMPILER_TESTDIRS) \ |
|
295 || ( $(call EXIT_IF_FATAL,$(FATAL_JCK_EXIT)) ; \ |
|
296 echo $$status > $(JCK_COMPILER_OUTPUT_DIR)/status.txt \ |
|
297 ) |
|
298 ifdef JCK_COMPILER_REFERENCE |
|
299 JT_JAVA=$(JT_JAVA) $(JTDIFF) -o $(JCK_COMPILER_OUTPUT_DIR)/diff.html \ |
|
300 $(JCK_COMPILER_REFERENCE) $(JCK_COMPILER_OUTPUT_DIR)/report \ |
|
301 || ( $(call EXIT_IF_FATAL,$(FATAL_JTDIFF_EXIT)) ) |
|
302 endif |
|
303 |
|
304 jck-compiler-summary: FRC |
|
305 if [ -r $(JCK_COMPILER_OUTPUT_DIR)/status.txt ]; then \ |
|
306 echo ; echo "Summary of JCK-compiler test failures" ; \ |
|
307 cat $(JCK_COMPILER_OUTPUT_DIR)/report/text/summary.txt | \ |
|
308 grep -v 'Not run' | grep -v 'Passed' ; \ |
|
309 echo ; \ |
|
310 $(EXIT) `cat $(JCK_COMPILER_OUTPUT_DIR)/status.txt` ; \ |
|
311 fi |
|
312 |
|
313 # Run JCK-runtime tests in -Xcompile mode |
|
314 # This is a special mode to test javac by compiling the tests in the JCK-runtime test suite |
|
315 # Normal JCK-runtime invocation belongs in the jdk/ repository. |
|
316 # |
|
317 # JCK_HOME |
|
318 # Installed location of JCK: should include JCK-compiler, JCK-runtime and JCK-extras |
|
319 # JT_JAVA |
|
320 # Version of java used to run JCK. Should normally be the same as TESTJAVA |
|
321 # TESTJAVA |
|
322 # Version of java to be tested. |
|
323 # JCK_RUNTIME_OPTIONS |
|
324 # Additional options for JCK-runtime |
|
325 # JCK_RUNTIME_TESTDIRS |
|
326 # Directories of tests to be run |
|
327 # JCK_RUNTIME_OUTPUT_DIR |
|
328 # Where to write the results |
|
329 # JCK_RUNTIME_REFERENCE |
|
330 # (Optional) reference results (e.g. work, report or summary.txt) |
|
331 # |
|
332 jck-runtime-tests: check-jck FRC |
|
333 @rm -f -r $(JCK_RUNTIME_OUTPUT_DIR)/work $(JCK_RUNTIME_OUTPUT_DIR)/report \ |
|
334 $(JCK_RUNTIME_OUTPUT_DIR)/diff.html $(JCK_RUNTIME_OUTPUT_DIR)/status.txt |
|
335 @mkdir -p $(JCK_RUNTIME_OUTPUT_DIR) |
|
336 $(JT_JAVA)/bin/java -XX:MaxPermSize=256m -Xmx512m \ |
|
337 -jar $(JCK_HOME)/JCK-runtime-7/lib/jtjck.jar \ |
|
338 -v:non-pass \ |
|
339 -r:$(JCK_RUNTIME_OUTPUT_DIR)/report \ |
|
340 -w:$(JCK_RUNTIME_OUTPUT_DIR)/work \ |
|
341 -jdk:$(TESTJAVA) \ |
|
342 -Xcompile \ |
|
343 $(JCK_RUNTIME_OPTIONS) \ |
|
344 $(JCK_RUNTIME_TESTDIRS) \ |
|
345 || ( $(call EXIT_IF_FATAL,$(FATAL_JCK_EXIT)) ; \ |
|
346 echo $$status > $(JCK_RUNTIME_OUTPUT_DIR)/status.txt \ |
|
347 ) |
|
348 ifdef JCK_RUNTIME_REFERENCE |
|
349 JT_JAVA=$(JT_JAVA) $(JTDIFF) -o $(JCK_RUNTIME_OUTPUT_DIR)/diff.html \ |
|
350 $(JCK_RUNTIME_REFERENCE) $(JCK_RUNTIME_OUTPUT_DIR)/report \ |
|
351 || ( $(call EXIT_IF_FATAL,$(FATAL_JTDIFF_EXIT)) ) |
|
352 endif |
|
353 |
|
354 jck-runtime-summary: FRC |
|
355 if [ -r $(JCK_RUNTIME_OUTPUT_DIR)/status.txt ]; then \ |
|
356 echo ; echo "Summary of JCK-runtime test failures" ; \ |
|
357 cat $(JCK_RUNTIME_OUTPUT_DIR)/report/text/summary.txt | \ |
|
358 grep -v 'Not run' | grep -v 'Passed' ; \ |
|
359 echo ; \ |
|
360 $(EXIT) `cat $(JCK_RUNTIME_OUTPUT_DIR)/status.txt` ; \ |
|
361 fi |
|
362 |
|
363 # Check to make sure these directories exist |
|
364 check-jck: $(JT_HOME) $(JCK_HOME) $(PRODUCT_HOME) |
|
365 |
|
366 all-summary: FRC |
|
367 if [ -n "`find $(TEST_OUTPUT_DIR) -name status.txt`" ]; then |
|
368 echo ; echo "Summary of test failures" ; \ |
|
369 cat `find $(TEST_OUTPUT_DIR) -name summary.txt` | \ |
|
370 grep -v 'Not run' | grep -v 'Passed' ; \ |
|
371 echo ; \ |
|
372 $(EXIT) 1 |
|
373 fi |
118 |
374 |
119 # Bundle up the results |
375 # Bundle up the results |
120 $(JPRT_ARCHIVE_BUNDLE): FRC |
376 $(JPRT_ARCHIVE_BUNDLE): FRC |
121 @rm -f $@ |
377 @rm -f $@ |
122 @mkdir -p $(@D) |
378 @mkdir -p $(@D) |
123 ( cd $(TEST_OUTPUT_DIR) && zip -q -r $@ . ) |
379 ( cd $(TEST_OUTPUT_DIR) && zip -q -r $@ . ) |
124 |
380 |
125 # Cleanup |
381 # Cleanup |
126 clean: |
382 clean: |
127 rm -f -r $(TEST_OUTPUT_DIR) |
|
128 rm -f $(JPRT_ARCHIVE_BUNDLE) |
383 rm -f $(JPRT_ARCHIVE_BUNDLE) |
129 |
384 |
130 # Used to force a target rules to run |
385 # Used to force a target rules to run |
131 FRC: |
386 FRC: |
132 |
387 |
133 # Phony targets (e.g. these are not filenames) |
388 # Phony targets (e.g. these are not filenames) |
134 .PHONY: all tests clean check |
389 .PHONY: all clean \ |
135 |
390 jtreg javac javadoc javah javap jtreg-tests jtreg-summary check-jtreg \ |
|
391 jck-compiler jck-compiler-tests jck-compiler-summary \ |
|
392 jck-runtime jck-runtime-tests jck-runtime-summary check-jck |
|
393 |
|
394 # No use of suffix rules |
|
395 .SUFFIXES: |
|
396 |