Wed, 21 Apr 2010 12:24:56 +0100
6730476: invalid "unchecked generic array" warning
Summary: Reifiable-ness of varargs element type should be checked after JLS3 15.12.2.8
Reviewed-by: jjg
1 #
2 # Makefile to run jtreg and other tests
3 #
5 # Product builds and langtools builds
6 #
7 # A full product build (or "control" build) creates a complete JDK image.
8 # To test a product build, set TESTJAVA to the path for the image.
9 #
10 # A langtools build just builds the langtools components of a JDK.
11 # To test a langtools build, set TESTJAVA to the path for a recent JDK
12 # build, and set TESTBOOTCLASSPATH to the compiled langtools classes --
13 # for example build/classes or dist/lib/classes.jar.
15 # JPRT
16 # JPRT may invoke this Makefile directly, as part of a langtools build,
17 # or indirectly, via FOREST/test/Makefile, as part of a control build.
19 # Get OS/ARCH specifics
20 OSNAME = $(shell uname -s)
21 ifeq ($(OSNAME), SunOS)
22 PLATFORM = solaris
23 JT_PLATFORM = solaris
24 ARCH = $(shell uname -p)
25 ifeq ($(ARCH), i386)
26 ARCH=i586
27 endif
28 endif
29 ifeq ($(OSNAME), Linux)
30 PLATFORM = linux
31 JT_PLATFORM = linux
32 ARCH = $(shell uname -m)
33 ifeq ($(ARCH), i386)
34 ARCH=i586
35 endif
36 endif
37 ifeq ($(OSNAME), Windows_NT)
38 PLATFORM = windows
39 JT_PLATFORM = win32
40 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),ia64)
41 ARCH=ia64
42 else
43 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),AMD64)
44 ARCH=x64
45 else
46 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),EM64T)
47 ARCH=x64
48 else
49 ARCH=i586
50 endif
51 endif
52 endif
53 endif
55 # Root of this test area (important to use full paths in some places)
56 TEST_ROOT := $(shell pwd)
58 # Default bundle of all test results (passed or not) (JPRT only)
59 ifdef JPRT_JOB_ID
60 JPRT_CLEAN = clean
61 JPRT_ARCHIVE_BUNDLE = $(TEST_ROOT)/JPRT_ARCHIVE_BUNDLE.zip
62 endif
64 ifeq ($(PLATFORM), windows)
65 SLASH_JAVA = J:
66 else
67 SLASH_JAVA = /java
68 endif
70 # Default JTREG to run
71 ifdef JPRT_JTREG_HOME
72 JTREG_HOME = $(JPRT_JTREG_HOME)
73 else
74 JTREG_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg
75 endif
76 JTREG = $(JTREG_HOME)/$(JT_PLATFORM)/bin/jtreg
77 JTDIFF = $(JTREG_HOME)/$(JT_PLATFORM)/bin/jtdiff
79 # Default JCK to run
80 ifdef JPRT_JCK_HOME
81 JCK_HOME = $(JPRT_JCK_HOME)
82 else
83 JCK_HOME = $(SLASH_JAVA)/re/jck/7/promoted/latest/binaries
84 endif
86 # Default JDK for JTREG and JCK
87 #
88 # JT_JAVA is the version of java used to run jtreg/JCK. Since it is now
89 # standard to execute tests in sameVM mode, it should normally be set the
90 # same as TESTJAVA (although not necessarily so.)
91 #
92 ifdef JPRT_JAVA_HOME
93 JT_JAVA = $(JPRT_JAVA_HOME)
94 else
95 JT_JAVA = $(SLASH_JAVA)/re/jdk/1.6.0/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
96 endif
98 # Default JDK to test
99 ifdef JPRT_IMPORT_PRODUCT_HOME
100 TESTJAVA = $(JPRT_IMPORT_PRODUCT_HOME)
101 else
102 TESTJAVA = $(SLASH_JAVA)/re/jdk/1.7.0/promoted/latest/binaries/$(PLATFORM)-$(ARCH)
103 endif
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
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
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
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
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:%)
159 # Include shared options
160 JCK_COMPILER_OPTIONS += $(JCK_OPTIONS)
161 JCK_RUNTIME_OPTIONS += $(JCK_OPTIONS)
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
177 # The test directories to run
178 DEFAULT_TESTDIRS = .
179 TESTDIRS = $(DEFAULT_TESTDIRS)
181 # Root of all test results
182 TEST_OUTPUT_DIR = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools
183 ABS_TEST_OUTPUT_DIR := \
184 $(shell mkdir -p $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools; \
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
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
194 @echo "Testing completed successfully"
196 jtreg apt javac javadoc javah javap: $(JPRT_CLEAN) jtreg-tests $(JPRT_ARCHIVE_BUNDLE) jtreg-summary
197 @echo "Testing completed successfully"
199 jck-compiler: $(JPRT_CLEAN) jck-compiler-tests $(JPRT_ARCHIVE_BUNDLE) jck-compiler-summary
200 @echo "Testing completed successfully"
202 jck-runtime: $(JPRT_CLEAN) jck-runtime-tests $(JPRT_ARCHIVE_BUNDLE) jck-runtime-summary
203 @echo "Testing completed successfully"
205 # for use with JPRT -testrule
206 all: JTREG_TESTDIRS = .
207 jtreg: JTREG_TESTDIRS = .
208 apt: JTREG_TESTDIRS = tools/apt
209 javac: JTREG_TESTDIRS = tools/javac
210 javadoc: JTREG_TESTDIRS = tools/javadoc com/sun/javadoc
211 javah: JTREG_TESTDIRS = tools/javah
212 javap: JTREG_TESTDIRS = tools/javap
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
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
262 # Check to make sure these directories exist
263 check-jtreg: $(JT_HOME) $(PRODUCT_HOME) $(JTREG)
266 # Run JCK-compiler tests
267 #
268 # JCK_HOME
269 # Installed location of JCK: should include JCK-compiler, and JCK-extras
270 # JT_JAVA
271 # Version of java used to run JCK. Should normally be the same as TESTJAVA
272 # TESTJAVA
273 # Version of java to be tested.
274 # JCK_COMPILER_OPTIONS
275 # Additional options for JCK-compiler
276 # JCK_COMPILER_TESTDIRS
277 # Directories of tests to be run
278 # JCK_COMPILER_OUTPUT_DIR
279 # Where to write the results
280 # JCK_COMPILER_REFERENCE
281 # (Optional) reference results (e.g. work, report or summary.txt)
282 #
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
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
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
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
363 # Check to make sure these directories exist
364 check-jck: $(JT_HOME) $(JCK_HOME) $(PRODUCT_HOME)
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
375 # Bundle up the results
376 $(JPRT_ARCHIVE_BUNDLE): FRC
377 @rm -f $@
378 @mkdir -p $(@D)
379 ( cd $(TEST_OUTPUT_DIR) && zip -q -r $@ . )
381 # Cleanup
382 clean:
383 rm -f $(JPRT_ARCHIVE_BUNDLE)
385 # Used to force a target rules to run
386 FRC:
388 # Phony targets (e.g. these are not filenames)
389 .PHONY: all clean \
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
394 # No use of suffix rules
395 .SUFFIXES: