Wed, 03 Feb 2010 16:58:57 -0800
6921979: add test program to verify annotations are attached to nodes as expected
Reviewed-by: darcy
1 #
2 # Makefile to run jtreg and any other tests
3 #
5 # Get OS/ARCH specifics
6 OSNAME = $(shell uname -s)
7 ifeq ($(OSNAME), SunOS)
8 PLATFORM = solaris
9 JT_PLATFORM = solaris
10 ARCH = $(shell uname -p)
11 ifeq ($(ARCH), i386)
12 ARCH=i586
13 endif
14 endif
15 ifeq ($(OSNAME), Linux)
16 PLATFORM = linux
17 JT_PLATFORM = linux
18 ARCH = $(shell uname -m)
19 ifeq ($(ARCH), i386)
20 ARCH=i586
21 endif
22 endif
23 ifeq ($(OSNAME), Windows_NT)
24 PLATFORM = windows
25 JT_PLATFORM = win32
26 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),ia64)
27 ARCH=ia64
28 else
29 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),AMD64)
30 ARCH=x64
31 else
32 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),EM64T)
33 ARCH=x64
34 else
35 ARCH=i586
36 endif
37 endif
38 endif
39 endif
41 # Root of this test area (important to use full paths in some places)
42 TEST_ROOT := $(shell pwd)
44 # Default bundle of all test results (passed or not)
45 JPRT_ARCHIVE_BUNDLE=$(TEST_ROOT)/JPRT_ARCHIVE_BUNDLE.zip
47 ifeq ($(PLATFORM), windows)
48 SLASH_JAVA = J:
49 else
50 SLASH_JAVA = /java
51 endif
53 # Default JTREG to run
54 ifdef JPRT_JTREG_HOME
55 JTREG_HOME = $(JPRT_JTREG_HOME)
56 else
57 JTREG_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg
58 endif
59 JTREG = $(JTREG_HOME)/$(JT_PLATFORM)/bin/jtreg
61 # Default JDK for JTREG
62 ifdef JPRT_JAVA_HOME
63 JT_JAVA = $(JPRT_JAVA_HOME)
64 else
65 JT_JAVA = $(SLASH_JAVA)/re/jdk/1.6.0/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
66 endif
68 # Default JDK to test
69 ifdef JPRT_IMPORT_PRODUCT_HOME
70 TESTJAVA = $(JPRT_IMPORT_PRODUCT_HOME)
71 else
72 TESTJAVA = $(SLASH_JAVA)/re/jdk/1.7.0/promoted/latest/binaries/$(PLATFORM)-$(ARCH)
73 endif
75 TESTBOOTCLASSPATH = $(PRODUCT_HOME)/dist/lib/classes.jar
77 # The test directories to run
78 DEFAULT_TESTDIRS = .
79 TESTDIRS = $(DEFAULT_TESTDIRS)
81 # Root of all test results
82 TEST_OUTPUT_DIR = $(TEST_ROOT)/o_$(PLATFORM)-$(ARCH)
84 # Default make rule
85 all apt javac javadoc javah javap: clean check jtreg-tests $(JPRT_ARCHIVE_BUNDLE)
86 @echo "Testing completed successfully"
88 # for use with JPRT -testrule
89 all: TESTDIRS = .
90 apt: TESTDIRS = tools/apt
91 javac: TESTDIRS = tools/javac
92 javadoc: TESTDIRS = tools/javadoc com/sun/javadoc
93 javah: TESTDIRS = tools/javah
94 javap: TESTDIRS = tools/javap
96 # Check to make sure these directories exist
97 check: $(JT_HOME) $(PRODUCT_HOME) $(JTREG)
99 # Run the tests
100 jtreg-tests: FRC
101 @echo "Using export JAVA_TOOL_OPTIONS=$(JAVA_TOOL_OPTIONS)"
102 @rm -f -r $(TEST_OUTPUT_DIR)/JTwork $(TEST_OUTPUT_DIR)/JTreport
103 @mkdir -p $(TEST_OUTPUT_DIR)
104 JT_JAVA=$(JT_JAVA) $(JTREG) \
105 -a -samevm -k:\!ignore -v:fail,error,nopass \
106 -r:$(TEST_OUTPUT_DIR)/JTreport \
107 -w:$(TEST_OUTPUT_DIR)/JTwork \
108 -jdk:$(TESTJAVA) \
109 -Xbootclasspath/p:$(TESTBOOTCLASSPATH) \
110 $(JAVA_ARGS:%=-vmoption:%) \
111 $(TESTDIRS) \
112 || ( status=$$? ; \
113 echo ; echo "Summary of test failures" ; \
114 cat $(TEST_OUTPUT_DIR)/JTreport/text/summary.txt | \
115 grep -v 'Not run' | grep -v 'Passed' ; \
116 echo ; \
117 exit $$status )
119 # Bundle up the results
120 $(JPRT_ARCHIVE_BUNDLE): FRC
121 @rm -f $@
122 @mkdir -p $(@D)
123 ( cd $(TEST_OUTPUT_DIR) && zip -q -r $@ . )
125 # Cleanup
126 clean:
127 rm -f -r $(TEST_OUTPUT_DIR)
128 rm -f $(JPRT_ARCHIVE_BUNDLE)
130 # Used to force a target rules to run
131 FRC:
133 # Phony targets (e.g. these are not filenames)
134 .PHONY: all tests clean check