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 # Makefile to run various jdk tests
28 #
29
30 # Empty these to get rid of some default rules
31 .SUFFIXES:
32 .SUFFIXES: .java
33 CO=
34 GET=
35
36 # Utilities used
37 AWK = awk
38 CAT = cat
39 CD = cd
40 CHMOD = chmod
41 CP = cp
42 CUT = cut
43 DIRNAME = dirname
44 ECHO = echo
45 EGREP = egrep
46 EXPAND = expand
47 FIND = find
48 MKDIR = mkdir
49 PWD = pwd
50 SED = sed
51 SORT = sort
52 TEE = tee
53 UNAME = uname
54 UNIQ = uniq
55 WC = wc
56 ZIP = zip
57
58 # Get OS name from uname
59 UNAME_S := $(shell $(UNAME) -s)
60
61 # Commands to run on paths to make mixed paths for java on windows
62 GETMIXEDPATH=$(ECHO)
63
64 # Location of developer shared files
65 SLASH_JAVA = /java
66
67 # Platform specific settings
68 ifeq ($(UNAME_S), SunOS)
69 OS_NAME = solaris
70 OS_ARCH := $(shell $(UNAME) -p)
71 OS_VERSION := $(shell $(UNAME) -r)
72 endif
73 ifeq ($(UNAME_S), Linux)
74 OS_NAME = linux
75 OS_ARCH := $(shell $(UNAME) -m)
76 # Check for unknown arch, try uname -p if uname -m says unknown
77 ifeq ($(OS_ARCH),unknown)
78 OS_ARCH := $(shell $(UNAME) -p)
79 endif
80 OS_VERSION := $(shell $(UNAME) -r)
81 endif
82 ifeq ($(UNAME_S), Darwin)
83 OS_NAME = macosx
84 OS_ARCH := $(shell $(UNAME) -m)
85 # Check for unknown arch, try uname -p if uname -m says unknown
86 ifeq ($(OS_ARCH),unknown)
87 OS_ARCH := $(shell $(UNAME) -p)
88 endif
89 OS_VERSION := $(shell $(UNAME) -r)
90 endif
91 ifeq ($(OS_NAME),)
92 OS_NAME = windows
93 # GNU Make or MKS overrides $(PROCESSOR_ARCHITECTURE) to always
94 # return "x86". Use the first word of $(PROCESSOR_IDENTIFIER) instead.
95 ifeq ($(PROCESSOR_IDENTIFIER),)
96 PROC_ARCH:=$(shell $(UNAME) -m)
97 else
98 PROC_ARCH:=$(word 1, $(PROCESSOR_IDENTIFIER))
99 endif
100 OS_ARCH:=$(PROC_ARCH)
101 SLASH_JAVA = J:
102 EXESUFFIX = .exe
103 # These need to be different depending on MKS or CYGWIN
104 ifeq ($(findstring cygdrive,$(shell ($(CD) C:/ && $(PWD)))), )
105 GETMIXEDPATH = dosname -s
106 OS_VERSION := $(shell $(UNAME) -r)
107 else
108 GETMIXEDPATH = cygpath -m -s
109 OS_VERSION := $(shell $(UNAME) -s | $(CUT) -d'-' -f2)
110 endif
111 endif
112
113 # Only want major and minor numbers from os version
114 OS_VERSION := $(shell $(ECHO) "$(OS_VERSION)" | $(CUT) -d'.' -f1,2)
115
116 # Name to use for x86_64 arch (historically amd64, but should change someday)
117 OS_ARCH_X64_NAME:=amd64
118 #OS_ARCH_X64_NAME:=x64
119
120 # Alternate arch names (in case this arch is known by a second name)
121 # PROBLEM_LISTS may use either name.
122 OS_ARCH2-amd64:=x64
123 #OS_ARCH2-x64:=amd64
124
125 # Try and use the arch names consistently
126 OS_ARCH:=$(patsubst x64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
127 OS_ARCH:=$(patsubst X64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
128 OS_ARCH:=$(patsubst AMD64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
129 OS_ARCH:=$(patsubst amd64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
130 OS_ARCH:=$(patsubst x86_64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
131 OS_ARCH:=$(patsubst 8664,$(OS_ARCH_X64_NAME),$(OS_ARCH))
132 OS_ARCH:=$(patsubst EM64T,$(OS_ARCH_X64_NAME),$(OS_ARCH))
133 OS_ARCH:=$(patsubst em64t,$(OS_ARCH_X64_NAME),$(OS_ARCH))
134 OS_ARCH:=$(patsubst intel64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
135 OS_ARCH:=$(patsubst Intel64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
136 OS_ARCH:=$(patsubst INTEL64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
137 OS_ARCH:=$(patsubst IA64,ia64,$(OS_ARCH))
138 OS_ARCH:=$(patsubst X86,i586,$(OS_ARCH))
139 OS_ARCH:=$(patsubst x86,i586,$(OS_ARCH))
140 OS_ARCH:=$(patsubst i386,i586,$(OS_ARCH))
141 OS_ARCH:=$(patsubst i486,i586,$(OS_ARCH))
142 OS_ARCH:=$(patsubst i686,i586,$(OS_ARCH))
143 OS_ARCH:=$(patsubst 386,i586,$(OS_ARCH))
144 OS_ARCH:=$(patsubst 486,i586,$(OS_ARCH))
145 OS_ARCH:=$(patsubst 586,i586,$(OS_ARCH))
146 OS_ARCH:=$(patsubst 686,i586,$(OS_ARCH))
147
148 # Default ARCH_DATA_MODEL settings
149 ARCH_DATA_MODEL-i586 = 32
150 ARCH_DATA_MODEL-$(OS_ARCH_X64_NAME) = 64
151 ARCH_DATA_MODEL-ia64 = 64
152 ARCH_DATA_MODEL-sparc = 32
153 ARCH_DATA_MODEL-sparcv9 = 64
154
155 # If ARCH_DATA_MODEL is not defined, try and pick a reasonable default
156 ifndef ARCH_DATA_MODEL
157 ARCH_DATA_MODEL:=$(ARCH_DATA_MODEL-$(OS_ARCH))
158 endif
159 ifndef ARCH_DATA_MODEL
160 ARCH_DATA_MODEL=32
161 endif
162
163 # Platform directory name
164 PLATFORM_OS = $(OS_NAME)-$(OS_ARCH)
165
166 # Check ARCH_DATA_MODEL, adjust OS_ARCH accordingly on solaris
167 ARCH_DATA_MODEL_ERROR= \
168 ARCH_DATA_MODEL=$(ARCH_DATA_MODEL) cannot be used with $(PLATFORM_OS)
169 ifeq ($(ARCH_DATA_MODEL),64)
170 ifeq ($(PLATFORM_OS),solaris-i586)
171 OS_ARCH=$(OS_ARCH_X64_NAME)
172 endif
173 ifeq ($(PLATFORM_OS),solaris-sparc)
174 OS_ARCH=sparcv9
175 endif
176 ifeq ($(OS_ARCH),i586)
177 x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
178 endif
179 ifeq ($(OS_ARCH),sparc)
180 x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
181 endif
182 else
183 ifeq ($(ARCH_DATA_MODEL),32)
184 ifeq ($(OS_ARCH),$(OS_ARCH_X64_NAME))
185 x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
186 endif
187 ifeq ($(OS_ARCH),ia64)
188 x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
189 endif
190 ifeq ($(OS_ARCH),sparcv9)
191 x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
192 endif
193 else
194 x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
195 endif
196 endif
197
198 # Alternate OS_ARCH name (defaults to OS_ARCH)
199 OS_ARCH2:=$(OS_ARCH2-$(OS_ARCH))
200 ifeq ($(OS_ARCH2),)
201 OS_ARCH2:=$(OS_ARCH)
202 endif
203
204 # Root of this test area (important to use full paths in some places)
205 TEST_ROOT := $(shell $(PWD))
206
207 # Root of all test results
208 ifdef ALT_OUTPUTDIR
209 ABS_OUTPUTDIR = $(ALT_OUTPUTDIR)
210 else
211 ABS_OUTPUTDIR = $(TEST_ROOT)/../build/$(PLATFORM_OS)
212 endif
213 ABS_PLATFORM_BUILD_ROOT = $(ABS_OUTPUTDIR)
214 ABS_TEST_OUTPUT_DIR := $(ABS_PLATFORM_BUILD_ROOT)/testoutput/$(UNIQUE_DIR)
215
216 # Expect JPRT to set PRODUCT_HOME (the product or jdk in this case to test)
217 ifndef PRODUCT_HOME
218 # Try to use j2sdk-image if it exists
219 ABS_JDK_IMAGE = $(ABS_PLATFORM_BUILD_ROOT)/j2sdk-image
220 PRODUCT_HOME := \
221 $(shell \
222 if [ -d $(ABS_JDK_IMAGE) ] ; then \
223 $(ECHO) "$(ABS_JDK_IMAGE)"; \
224 else \
225 $(ECHO) "$(ABS_PLATFORM_BUILD_ROOT)"; \
226 fi)
227 PRODUCT_HOME := $(PRODUCT_HOME)
228 endif
229
230 # Expect JPRT to set JPRT_PRODUCT_ARGS (e.g. -server etc.)
231 # Should be passed into 'java' only.
232 # Could include: -d64 -server -client OR any java option
233 ifdef JPRT_PRODUCT_ARGS
234 JAVA_ARGS = $(JPRT_PRODUCT_ARGS)
235 endif
236
237 # Expect JPRT to set JPRT_PRODUCT_VM_ARGS (e.g. -Xcomp etc.)
238 # Should be passed into anything running the vm (java, javac, javadoc, ...).
239 ifdef JPRT_PRODUCT_VM_ARGS
240 JAVA_VM_ARGS = $(JPRT_PRODUCT_VM_ARGS)
241 endif
242
243 # Check JAVA_ARGS arguments based on ARCH_DATA_MODEL etc.
244 ifeq ($(OS_NAME),solaris)
245 D64_ERROR_MESSAGE=Mismatch between ARCH_DATA_MODEL=$(ARCH_DATA_MODEL) and use of -d64 in JAVA_ARGS=$(JAVA_ARGS)
246 ifeq ($(ARCH_DATA_MODEL),32)
247 ifneq ($(findstring -d64,$(JAVA_ARGS)),)
248 x:=$(warning "WARNING: $(D64_ERROR_MESSAGE)")
249 endif
250 endif
251 ifeq ($(ARCH_DATA_MODEL),64)
252 ifeq ($(findstring -d64,$(JAVA_ARGS)),)
253 x:=$(warning "WARNING: $(D64_ERROR_MESSAGE)")
254 endif
255 endif
256 endif
257
258 # Macro to run make and set the shared library permissions
259 define SharedLibraryPermissions
260 $(MAKE) SHARED_LIBRARY_DIR=$1 UNIQUE_DIR=$@ shared_library_permissions
261 endef
262
263 # Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results)
264 ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip
265 ifdef JPRT_ARCHIVE_BUNDLE
266 ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE)
267 endif
268
269 # How to create the test bundle (pass or fail, we want to create this)
270 # Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed.
271 ZIP_UP_RESULTS = ( $(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)` \
272 && $(CD) $(ABS_TEST_OUTPUT_DIR) \
273 && $(CHMOD) -R a+r . \
274 && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . )
275 SUMMARY_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport/text/summary.txt
276 STATS_TXT_NAME = Stats.txt
277 STATS_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/$(STATS_TXT_NAME)
278 RUNLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/runlist.txt
279 PASSLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/passlist.txt
280 FAILLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/faillist.txt
281 EXITCODE = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/exitcode.txt
282
283 TESTEXIT = \
284 if [ ! -s $(EXITCODE) ] ; then \
285 $(ECHO) "ERROR: EXITCODE file not filled in."; \
286 $(ECHO) "1" > $(EXITCODE); \
287 fi ; \
288 testExitCode=`$(CAT) $(EXITCODE)`; \
289 $(ECHO) "EXIT CODE: $${testExitCode}"; \
290 exit $${testExitCode}
291
292 BUNDLE_UP_AND_EXIT = \
293 ( \
294 jtregExitCode=$$? && \
295 _summary="$(SUMMARY_TXT)"; \
296 $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \
297 $(ECHO) "$${jtregExitCode}" > $(EXITCODE); \
298 if [ -r "$${_summary}" ] ; then \
299 $(ECHO) "Summary: $(UNIQUE_DIR)" > $(STATS_TXT); \
300 $(EXPAND) $${_summary} | $(EGREP) -v ' Not run\.' > $(RUNLIST); \
301 $(EGREP) ' Passed\.' $(RUNLIST) \
302 | $(EGREP) -v ' Error\.' \
303 | $(EGREP) -v ' Failed\.' > $(PASSLIST); \
304 ( $(EGREP) ' Failed\.' $(RUNLIST); \
305 $(EGREP) ' Error\.' $(RUNLIST); \
306 $(EGREP) -v ' Passed\.' $(RUNLIST) ) \
307 | $(SORT) | $(UNIQ) > $(FAILLIST); \
308 if [ $${jtregExitCode} != 0 -o -s $(FAILLIST) ] ; then \
309 $(EXPAND) $(FAILLIST) \
310 | $(CUT) -d' ' -f1 \
311 | $(SED) -e 's@^@FAILED: @' >> $(STATS_TXT); \
312 if [ $${jtregExitCode} = 0 ] ; then \
313 jtregExitCode=1; \
314 fi; \
315 fi; \
316 runc="`$(CAT) $(RUNLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
317 passc="`$(CAT) $(PASSLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
318 failc="`$(CAT) $(FAILLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
319 exclc="`$(CAT) $(EXCLUDELIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
320 $(ECHO) "TEST STATS: name=$(UNIQUE_DIR) run=$${runc} pass=$${passc} fail=$${failc} excluded=$${exclc}" \
321 >> $(STATS_TXT); \
322 else \
323 $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \
324 fi; \
325 if [ -f $(STATS_TXT) ] ; then \
326 $(CAT) $(STATS_TXT); \
327 fi; \
328 $(ZIP_UP_RESULTS) ; \
329 $(TESTEXIT) \
330 )
331
332 ################################################################
333
334 # Default make rule (runs default jdk tests)
335 all: jdk_default
336 @$(ECHO) "Testing completed successfully"
337
338 # Prep for output
339 prep:
340 @$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR)
341 @$(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)`
342
343 # Cleanup
344 clean:
345 @$(RM) -r $(ABS_TEST_OUTPUT_DIR)
346 @$(RM) $(ARCHIVE_BUNDLE)
347
348 ################################################################
349
350 # jtreg tests
351
352 # Expect JT_HOME to be set for jtreg tests. (home for jtreg)
353 ifndef JT_HOME
354 JT_HOME = $(SLASH_JAVA)/re/jtreg/4.1/promoted/latest/binaries/jtreg
355 ifdef JPRT_JTREG_HOME
356 JT_HOME = $(JPRT_JTREG_HOME)
357 endif
358 endif
359
360 # Expect JPRT to set TESTDIRS to the jtreg test dirs
361 ifndef TESTDIRS
362 TESTDIRS = demo
363 endif
364
365 # Some tests annoy me and fail frequently
366 PROBLEM_LIST=ProblemList.txt
367 PROBLEM_LISTS=$(PROBLEM_LIST) $(wildcard closed/$(PROBLEM_LIST))
368 EXCLUDELIST=$(ABS_TEST_OUTPUT_DIR)/excludelist.txt
369
370 # Create exclude list for this platform and arch
371 ifdef NO_EXCLUDES
372 $(EXCLUDELIST): $(PROBLEM_LISTS) $(TEST_DEPENDENCIES)
373 @$(ECHO) "NOTHING_EXCLUDED" > $@
374 else
375 $(EXCLUDELIST): $(PROBLEM_LISTS) $(TEST_DEPENDENCIES)
376 @$(RM) $@ $@.temp1 $@.temp2
377 @(($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-all' ) ;\
378 ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(PLATFORM_OS)' ) ;\
379 ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_ARCH2)' ) ;\
380 ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_VERSION)') ;\
381 ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-$(OS_ARCH)' ) ;\
382 ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-$(OS_ARCH2)' ) ;\
383 ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-all' ) ;\
384 ($(ECHO) "#") ;\
385 ) | $(SED) -e 's@^[\ ]*@@' \
386 | $(EGREP) -v '^#' > $@.temp1
387 @for tdir in $(TESTDIRS) SOLARIS_10_SH_BUG_NO_EMPTY_FORS ; do \
388 ( ( $(CAT) $@.temp1 | $(EGREP) "^$${tdir}" ) ; $(ECHO) "#" ) >> $@.temp2 ; \
389 done
390 @$(ECHO) "# at least one line" >> $@.temp2
391 @( $(EGREP) -v '^#' $@.temp2 ; true ) > $@
392 @$(ECHO) "Excluding list contains `$(EXPAND) $@ | $(WC) -l` items"
393 endif
394
395 # Select list of directories that exist
396 define TestDirs
397 $(foreach i,$1,$(wildcard ${i})) $(foreach i,$1,$(wildcard closed/${i}))
398 endef
399 # Running batches of tests with or without agentvm
400 define RunBatch
401 $(ECHO) "Running tests: $?"
402 $(MAKE) TEST_DEPENDENCIES="$?" TESTDIRS="$?" UNIQUE_DIR=$@ jtreg_tests
403 endef
404 define SummaryInfo
405 $(ECHO) "########################################################"
406 $(CAT) $(?:%=$(ABS_TEST_OUTPUT_DIR)/%/$(STATS_TXT_NAME))
407 $(ECHO) "########################################################"
408 endef
409
410 # ------------------------------------------------------------------
411
412 # Batches of tests (somewhat arbitrary assigments to jdk_* targets)
413 # NOTE: These *do not* run the same tests as make/jprt.properties
414 JDK_DEFAULT_TARGETS =
415 JDK_ALL_TARGETS =
416
417 JDK_ALL_TARGETS += jdk_awt
418 jdk_awt: $(call TestDirs, com/sun/awt java/awt sun/awt \
419 javax/imageio javax/print sun/pisces)
420 $(call RunBatch)
421
422 JDK_ALL_TARGETS += jdk_beans1
423 JDK_DEFAULT_TARGETS += jdk_beans1
424 jdk_beans1: $(call TestDirs, \
425 java/beans/beancontext java/beans/PropertyChangeSupport \
426 java/beans/Introspector java/beans/Performance \
427 java/beans/VetoableChangeSupport java/beans/Statement)
428 $(call RunBatch)
429
430 JDK_ALL_TARGETS += jdk_beans2
431 jdk_beans2: $(call TestDirs, \
432 java/beans/Beans java/beans/EventHandler java/beans/XMLDecoder \
433 java/beans/PropertyEditor)
434 $(call RunBatch)
435
436 JDK_ALL_TARGETS += jdk_beans3
437 jdk_beans3: $(call TestDirs, java/beans/XMLEncoder)
438 $(call RunBatch)
439
440 # All beans tests
441 jdk_beans: jdk_beans1 jdk_beans2 jdk_beans3
442 @$(SummaryInfo)
443
444 JDK_ALL_TARGETS += jdk_io
445 JDK_DEFAULT_TARGETS += jdk_io
446 jdk_io: $(call TestDirs, java/io)
447 $(call RunBatch)
448
449 JDK_ALL_TARGETS += jdk_lang
450 JDK_DEFAULT_TARGETS += jdk_lang
451 jdk_lang: $(call TestDirs, java/lang sun/invoke sun/misc sun/reflect vm)
452 $(call RunBatch)
453
454 JDK_ALL_TARGETS += jdk_jmx
455 jdk_jmx: $(call TestDirs, javax/management com/sun/jmx)
456 $(call RunBatch)
457
458 JDK_ALL_TARGETS += jdk_management
459 jdk_management: $(call TestDirs, com/sun/management sun/management)
460 $(call RunBatch)
461
462 JDK_ALL_TARGETS += jdk_math
463 JDK_DEFAULT_TARGETS += jdk_math
464 jdk_math: $(call TestDirs, java/math)
465 $(call RunBatch)
466
467 JDK_DEFAULT_TARGETS += jdk_time
468 jdk_time: $(call TestDirs, java/time)
469 $(call RunBatch)
470
471 JDK_ALL_TARGETS += jdk_other
472 JDK_DEFAULT_TARGETS += jdk_other
473 jdk_other: $(call TestDirs, \
474 demo/jvmti demo/zipfs sample \
475 javax/naming com/sun/jndi \
476 javax/script \
477 java/sql javax/sql \
478 javax/smartcardio \
479 javax/xml/jaxp \
480 javax/xml/soap \
481 javax/xml/ws com/sun/internal/ws com/sun/org/glassfish \
482 jdk/asm \
483 jdk/lambda \
484 com/sun/org/apache/xerces \
485 com/sun/corba \
486 com/sun/tracing \
487 sun/usagetracker \
488 misc)
489 $(call RunBatch)
490
491 JDK_ALL_TARGETS += jdk_net
492 JDK_DEFAULT_TARGETS += jdk_net
493 jdk_net: $(call TestDirs, com/sun/net java/net sun/net com/oracle/net)
494 $(call RunBatch)
495
496 jdk_nio: $(call TestDirs, java/nio sun/nio com/oracle/nio)
497 $(call SharedLibraryPermissions,java/nio/channels)
498 $(call RunBatch)
499
500 jdk_sctp: $(call TestDirs, com/sun/nio/sctp)
501 $(call RunBatch)
502
503 JDK_ALL_TARGETS += jdk_rmi
504 jdk_rmi: $(call TestDirs, java/rmi sun/rmi javax/rmi/ssl)
505 $(call RunBatch)
506
507 JDK_ALL_TARGETS += jdk_security1
508 JDK_DEFAULT_TARGETS += jdk_security1
509 jdk_security1: $(call TestDirs, java/security)
510 $(call RunBatch)
511
512 JDK_ALL_TARGETS += jdk_security2
513 jdk_security2: $(call TestDirs, javax/crypto javax/xml/crypto com/sun/crypto)
514 $(call RunBatch)
515
516 JDK_ALL_TARGETS += jdk_security3
517 jdk_security3: $(call TestDirs, com/sun/security lib/security javax/security \
518 sun/security com/sun/org/apache/xml/internal/security \
519 com/oracle/security)
520 $(call SharedLibraryPermissions,sun/security)
521 $(call RunBatch)
522
523 # All security tests
524 jdk_security: jdk_security1 jdk_security2 jdk_security3
525 @$(SummaryInfo)
526
527 JDK_ALL_TARGETS += jdk_sound
528 jdk_sound: $(call TestDirs, javax/sound)
529 $(call RunBatch)
530
531 JDK_ALL_TARGETS += jdk_swing
532 jdk_swing: $(call TestDirs, javax/swing sun/java2d \
533 demo/jfc com/sun/java/swing)
534 $(call RunBatch)
535
536 JDK_ALL_TARGETS += jdk_text
537 JDK_DEFAULT_TARGETS += jdk_text
538 jdk_text: $(call TestDirs, java/text sun/text)
539 $(call RunBatch)
540
541 JDK_ALL_TARGETS += jdk_jdi
542 jdk_jdi: $(call TestDirs, com/sun/jdi)
543 $(call RunBatch)
544
545 JDK_ALL_TARGETS += jdk_tools
546 jdk_tools: $(call TestDirs, com/sun/tools sun/jvmstat sun/tools tools)
547 $(call SharedLibraryPermissions,tools/launcher)
548 $(call RunBatch)
549
550 ifdef OPENJDK
551 jdk_jfr:
552 else
553 JDK_ALL_TARGETS += jdk_jfr
554 jdk_jfr: $(call TestDirs, com/oracle/jfr)
555 $(call RunBatch)
556 endif
557
558 JDK_ALL_TARGETS += jdk_util
559 JDK_DEFAULT_TARGETS += jdk_util
560 jdk_util: $(call TestDirs, java/util sun/util)
561 $(call RunBatch)
562
563 # ------------------------------------------------------------------
564
565 # Run default tests
566 # note that this *does not* have the same meaning as jprt.properties :: jprt.make.rule.default.test.targets
567 jdk_default: $(JDK_DEFAULT_TARGETS)
568 @$(SummaryInfo)
569
570 # Run core tests
571 # please keep this in sync with jdk/make/jprt.properties :: jprt.make.rule.core.test.targets
572 jdk_core: jdk_lang jdk_math jdk_util jdk_io jdk_net jdk_nio \
573 jdk_security1 jdk_security2 jdk_security3 jdk_rmi \
574 jdk_management jdk_jmx jdk_text jdk_tools jdk_jfr jdk_other
575 @$(SummaryInfo)
576
577 # Run all tests
578 # note that this *does not* have the same meaning as jprt.properties :: jprt.make.rule.all.test.targets
579 jdk_all: $(JDK_ALL_TARGETS)
580 @$(SummaryInfo)
581
582 # These are all phony targets
583 PHONY_LIST += $(JDK_ALL_TARGETS) jdk_default jdk_core jdk_all
584
585 # ------------------------------------------------------------------
586
587 ifdef CONCURRENCY
588 EXTRA_JTREG_OPTIONS += -concurrency:$(CONCURRENCY)
589 endif
590
591 # Default JTREG to run (win32 script works for everybody)
592 JTREG = $(JT_HOME)/win32/bin/jtreg
593 # run in agentvm mode
594 JTREG_BASIC_OPTIONS += -agentvm
595 # Only run automatic tests
596 JTREG_BASIC_OPTIONS += -a
597 # Always turn on assertions
598 JTREG_ASSERT_OPTION = -ea -esa
599 JTREG_BASIC_OPTIONS += $(JTREG_ASSERT_OPTION)
600 # Report details on all failed or error tests, times too
601 JTREG_BASIC_OPTIONS += -v:fail,error,time
602 # Retain all files for failing tests
603 JTREG_BASIC_OPTIONS += -retain:fail,error
608 JTREG_TIMEOUT_OPTION = -timeoutFactor:4
609 JTREG_BASIC_OPTIONS += $(JTREG_TIMEOUT_OPTION)
610 # Set the max memory for jtreg control vm
611 JTREG_MEMORY_OPTION = -J-Xmx512m
612 JTREG_BASIC_OPTIONS += $(JTREG_MEMORY_OPTION)
613 # Add any extra options
614 JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS)
615 # Set other vm and test options
616 JTREG_TEST_OPTIONS = $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_VM_ARGS:%=-vmoption:%)
617 # Set the GC options for test vms
618 #JTREG_GC_OPTION = -vmoption:-XX:+UseSerialGC
619 #JTREG_TEST_OPTIONS += $(JTREG_GC_OPTION)
620 # Set the max memory for jtreg target test vms
621 JTREG_TESTVM_MEMORY_OPTION = -vmoption:-Xmx512m
622 JTREG_TEST_OPTIONS += $(JTREG_TESTVM_MEMORY_OPTION)
623
624 # Make sure jtreg exists
625 $(JTREG): $(JT_HOME)
626
627 # Run jtreg
628 jtreg_tests: prep $(PRODUCT_HOME) $(JTREG) $(EXCLUDELIST)
629 @$(EXPAND) $(EXCLUDELIST) \
630 | $(CUT) -d' ' -f1 \
631 | $(SED) -e 's@^@Excluding: @'
632 ( \
633 ( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)"); \
634 export JT_HOME; \
635 $(shell $(GETMIXEDPATH) "$(JTREG)") \
636 $(JTREG_BASIC_OPTIONS) \
637 -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport \
638 -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork \
639 -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \
640 -exclude:$(shell $(GETMIXEDPATH) "$(EXCLUDELIST)") \
641 $(JTREG_TEST_OPTIONS) \
642 $(TESTDIRS) \
643 ) ; $(BUNDLE_UP_AND_EXIT) \
644 ) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt ; $(TESTEXIT)
645
646 # Rule that may change execute permissions on shared library files.
647 # Files in repositories should never have execute permissions, but there
648 # are some tests that have pre-built shared libraries, and these windows
649 # dll files must have execute permission. Adding execute permission
650 # may happen automatically on windows when using certain versions of mercurial
651 # but it cannot be guaranteed. And blindly adding execute permission might
652 # be seen as a mercurial 'change', so we avoid adding execute permission to
653 # repository files. But testing from a plain source tree needs the chmod a+rx.
654 # Used on select directories and applying the chmod to all shared libraries
655 # not just dll files. On windows, this may not work with MKS if the files
656 # were installed with CYGWIN unzip or untar (MKS chmod may not do anything).
657 # And with CYGWIN and sshd service, you may need CYGWIN=ntsec for this to work.
658 #
659 shared_library_permissions: $(SHARED_LIBRARY_DIR)
660 if [ ! -d $(TEST_ROOT)/../.hg ] ; then \
661 $(FIND) $< \( -name \*.dll -o -name \*.DLL -o -name \*.so \) \
662 -exec $(CHMOD) a+rx {} \; ; \
663 fi
664
665 PHONY_LIST += jtreg_tests shared_library_permissions
666
667 ################################################################
668
669 # Phony targets (e.g. these are not filenames)
670 .PHONY: all clean prep $(PHONY_LIST)
671
672 ################################################################
|
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 # Makefile to run various jdk tests
28 #
29
30 .DEFAULT : all
31
32 # Empty these to get rid of some default rules
33 .SUFFIXES:
34 .SUFFIXES: .java
35 CO=
36 GET=
37
38 # Utilities used
39 AWK = awk
40 CAT = cat
41 CD = cd
42 CHMOD = chmod
43 CP = cp
44 CUT = cut
45 DIRNAME = dirname
46 ECHO = echo
47 EGREP = egrep
48 EXPAND = expand
49 FIND = find
50 MKDIR = mkdir
51 PWD = pwd
52 SED = sed
53 SORT = sort
54 TEE = tee
55 UNAME = uname
56 UNIQ = uniq
57 WC = wc
58 ZIP = zip
59
60 # Get OS name from uname (Cygwin inexplicably adds _NT-5.1)
61 UNAME_S := $(shell $(UNAME) -s | $(CUT) -f1 -d_)
62
63 # Commands to run on paths to make mixed paths for java on windows
64 ifeq ($(UNAME_S), CYGWIN)
65 # Location of developer shared files
66 SLASH_JAVA = J:
67 GETMIXEDPATH = cygpath -m -s
68 else
69 # Location of developer shared files
70 SLASH_JAVA = /java
71
72 GETMIXEDPATH=$(ECHO)
73 endif
74
75 # Root of this test area (important to use full paths in some places)
76 TEST_ROOT := $(shell $(PWD))
77
78 # Root of all test results
79 ifdef ALT_OUTPUTDIR
80 ABS_OUTPUTDIR = $(shell $(CD) $(ALT_OUTPUTDIR) && $(PWD))
81 else
82 ABS_OUTPUTDIR = $(shell $(CD) $(TEST_ROOT)/.. && $(PWD))
83 endif
84
85 ABS_PLATFORM_BUILD_ROOT = $(ABS_OUTPUTDIR)
86 ABS_TEST_OUTPUT_DIR := $(ABS_PLATFORM_BUILD_ROOT)/testoutput/$(UNIQUE_DIR)
87
88 # Expect JPRT to set PRODUCT_HOME (the product or jdk in this case to test)
89 ifndef PRODUCT_HOME
90 # Try to use j2sdk-image if it exists
91 ABS_JDK_IMAGE = $(ABS_PLATFORM_BUILD_ROOT)/images/j2sdk-image
92 PRODUCT_HOME := \
93 $(shell \
94 if [ -d $(ABS_JDK_IMAGE) ] ; then \
95 $(ECHO) "$(ABS_JDK_IMAGE)"; \
96 else \
97 $(ECHO) "$(ABS_PLATFORM_BUILD_ROOT)"; \
98 fi)
99 PRODUCT_HOME := $(PRODUCT_HOME)
100 endif
101
102 # Expect JPRT to set JPRT_PRODUCT_ARGS (e.g. -server etc.)
103 # Should be passed into 'java' only.
104 # Could include: -d64 -server -client OR any java option
105 ifdef JPRT_PRODUCT_ARGS
106 JAVA_ARGS = $(JPRT_PRODUCT_ARGS)
107 endif
108
109 # Expect JPRT to set JPRT_PRODUCT_VM_ARGS (e.g. -Xcomp etc.)
110 # Should be passed into anything running the vm (java, javac, javadoc, ...).
111 ifdef JPRT_PRODUCT_VM_ARGS
112 JAVA_VM_ARGS = $(JPRT_PRODUCT_VM_ARGS)
113 endif
114
115 # Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results)
116 ifdef JPRT_ARCHIVE_BUNDLE
117 ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE)
118 else
119 ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip
120 endif
121
122 # How to create the test bundle (pass or fail, we want to create this)
123 # Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed.
124 ZIP_UP_RESULTS = ( $(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)` \
125 && $(CD) $(ABS_TEST_OUTPUT_DIR) \
126 && $(CHMOD) -R a+r . \
127 && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . )
128
129 # important results files
130 SUMMARY_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport/text/summary.txt")
131 STATS_TXT_NAME = Stats.txt
132 STATS_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/$(STATS_TXT_NAME)")
133 RUNLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/runlist.txt")
134 PASSLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/passlist.txt")
135 FAILLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/faillist.txt")
136 EXITCODE = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/exitcode.txt")
137
138 TESTEXIT = \
139 if [ ! -s $(EXITCODE) ] ; then \
140 $(ECHO) "ERROR: EXITCODE file not filled in."; \
141 $(ECHO) "1" > $(EXITCODE); \
142 fi ; \
143 testExitCode=`$(CAT) $(EXITCODE)`; \
144 $(ECHO) "EXIT CODE: $${testExitCode}"; \
145 exit $${testExitCode}
146
147 BUNDLE_UP_AND_EXIT = \
148 ( \
149 jtregExitCode=$$? && \
150 _summary="$(SUMMARY_TXT)"; \
151 $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \
152 $(ECHO) "$${jtregExitCode}" > $(EXITCODE); \
153 if [ -r "$${_summary}" ] ; then \
154 $(ECHO) "Summary: $(UNIQUE_DIR)" > $(STATS_TXT); \
155 $(EXPAND) $${_summary} | $(EGREP) -v ' Not run\.' > $(RUNLIST); \
156 $(EGREP) ' Passed\.' $(RUNLIST) \
157 | $(EGREP) -v ' Error\.' \
158 | $(EGREP) -v ' Failed\.' > $(PASSLIST); \
159 ( $(EGREP) ' Failed\.' $(RUNLIST); \
160 $(EGREP) ' Error\.' $(RUNLIST); \
161 $(EGREP) -v ' Passed\.' $(RUNLIST) ) \
162 | $(SORT) | $(UNIQ) > $(FAILLIST); \
163 if [ $${jtregExitCode} != 0 -o -s $(FAILLIST) ] ; then \
164 $(EXPAND) $(FAILLIST) \
165 | $(CUT) -d' ' -f1 \
166 | $(SED) -e 's@^@FAILED: @' >> $(STATS_TXT); \
167 if [ $${jtregExitCode} = 0 ] ; then \
168 jtregExitCode=1; \
169 fi; \
170 fi; \
171 runc="`$(CAT) $(RUNLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
172 passc="`$(CAT) $(PASSLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
173 failc="`$(CAT) $(FAILLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
174 exclc="FIXME CODETOOLS-7900176"; \
175 $(ECHO) "TEST STATS: name=$(UNIQUE_DIR) run=$${runc} pass=$${passc} fail=$${failc} excluded=$${exclc}" \
176 >> $(STATS_TXT); \
177 else \
178 $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \
179 fi; \
180 if [ -f $(STATS_TXT) ] ; then \
181 $(CAT) $(STATS_TXT); \
182 fi; \
183 $(ZIP_UP_RESULTS) ; \
184 $(TESTEXIT) \
185 )
186
187 ################################################################
188
189 # Default make rule (runs default jdk tests)
190 all: jdk_default
191 @$(ECHO) "Testing completed successfully"
192
193 # Prep for output
194 # Change execute permissions on shared library files.
195 # Files in repositories should never have execute permissions, but
196 # there are some tests that have pre-built shared libraries, and these
197 # windows dll files must have execute permission. Adding execute
198 # permission may happen automatically on windows when using certain
199 # versions of mercurial but it cannot be guaranteed. And blindly
200 # adding execute permission might be seen as a mercurial 'change', so
201 # we avoid adding execute permission to repository files. But testing
202 # from a plain source tree needs the chmod a+rx. Applying the chmod to
203 # all shared libraries not just dll files. And with CYGWIN and sshd
204 # service, you may need CYGWIN=ntsec for this to work.
205 prep:
206 @$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR)
207 @$(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)`
208 @if [ ! -d $(TEST_ROOT)/../.hg ] ; then \
209 $(FIND) $(TEST_ROOT) \( -name \*.dll -o -name \*.DLL -o -name \*.so \) \
210 -exec $(CHMOD) a+rx {} \; ; \
211 fi
212
213 # Cleanup
214 clean:
215 @$(RM) -r $(ABS_TEST_OUTPUT_DIR)
216 @$(RM) $(ARCHIVE_BUNDLE)
217
218 ################################################################
219
220 # jtreg tests
221
222 # Expect JT_HOME to be set for jtreg tests. (home for jtreg)
223 ifndef JT_HOME
224 JT_HOME = $(SLASH_JAVA)/re/jtreg/4.1/promoted/latest/binaries/jtreg
225 ifdef JPRT_JTREG_HOME
226 JT_HOME = $(JPRT_JTREG_HOME)
227 endif
228 endif
229
230 # Problematic tests to be excluded
231 PROBLEM_LISTS=$(call MixedDirs,$(wildcard ProblemList.txt closed/ProblemList.txt))
232
233 # Create exclude list for this platform and arch
234 ifdef NO_EXCLUDES
235 JTREG_EXCLUSIONS =
236 else
237 JTREG_EXCLUSIONS = $(PROBLEM_LISTS:%=-exclude:%)
238 endif
239
240 # convert list of directories to dos paths
241 define MixedDirs
242 $(foreach i,$1,$(shell $(GETMIXEDPATH) "${i}"))
243 endef
244
245 define SummaryInfo
246 $(ECHO) "########################################################"
247 $(CAT) $(?:%=$(ABS_TEST_OUTPUT_DIR)/%/$(STATS_TXT_NAME))
248 $(ECHO) "########################################################"
249 endef
250
251 # ------------------------------------------------------------------
252
253 jdk_%:
254 $(ECHO) "Running tests: $@"
255 for each in $@; do \
256 $(MAKE) -j 1 TEST_SELECTION=":$$each" UNIQUE_DIR=$$each jtreg_tests; \
257 done
258
259 # ------------------------------------------------------------------
260
261 ifdef CONCURRENCY
262 EXTRA_JTREG_OPTIONS += -concurrency:$(CONCURRENCY)
263 endif
264
265 # Default JTREG to run (win32 script works for everybody)
266 JTREG = $(JT_HOME)/win32/bin/jtreg
267 # run in agentvm mode
268 JTREG_BASIC_OPTIONS += -agentvm
269 # Only run automatic tests
270 JTREG_BASIC_OPTIONS += -a
271 # Always turn on assertions
272 JTREG_ASSERT_OPTION = -ea -esa
273 JTREG_BASIC_OPTIONS += $(JTREG_ASSERT_OPTION)
274 # Report details on all failed or error tests, times too
275 JTREG_BASIC_OPTIONS += -v:fail,error,time
276 # Retain all files for failing tests
277 JTREG_BASIC_OPTIONS += -retain:fail,error
282 JTREG_TIMEOUT_OPTION = -timeoutFactor:4
283 JTREG_BASIC_OPTIONS += $(JTREG_TIMEOUT_OPTION)
284 # Set the max memory for jtreg control vm
285 JTREG_MEMORY_OPTION = -J-Xmx512m
286 JTREG_BASIC_OPTIONS += $(JTREG_MEMORY_OPTION)
287 # Add any extra options
288 JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS)
289 # Set other vm and test options
290 JTREG_TEST_OPTIONS = $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_VM_ARGS:%=-vmoption:%)
291 # Set the GC options for test vms
292 #JTREG_GC_OPTION = -vmoption:-XX:+UseSerialGC
293 #JTREG_TEST_OPTIONS += $(JTREG_GC_OPTION)
294 # Set the max memory for jtreg target test vms
295 JTREG_TESTVM_MEMORY_OPTION = -vmoption:-Xmx512m
296 JTREG_TEST_OPTIONS += $(JTREG_TESTVM_MEMORY_OPTION)
297
298 # Make sure jtreg exists
299 $(JTREG): $(JT_HOME)
300
301 # Run jtreg
302 jtreg_tests: prep $(PRODUCT_HOME) $(JTREG)
303 ( \
304 ( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)"); \
305 export JT_HOME; \
306 $(shell $(GETMIXEDPATH) "$(JTREG)") \
307 $(JTREG_BASIC_OPTIONS) \
308 -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport") \
309 -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTwork") \
310 -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \
311 $(JTREG_EXCLUSIONS) \
312 $(JTREG_TEST_OPTIONS) \
313 $(TEST_SELECTION) \
314 ) ; \
315 $(BUNDLE_UP_AND_EXIT) \
316 ) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt ; $(TESTEXIT)
317
318 PHONY_LIST += jtreg_tests
319
320 ################################################################
321
322 # Phony targets (e.g. these are not filenames)
323 .PHONY: all clean prep $(PHONY_LIST)
324
325 ################################################################
|