Mercurial > hg > graal-compiler
comparison test/Makefile @ 363:032ddb9432ad
Merge
author | apetrusenko |
---|---|
date | Wed, 17 Sep 2008 19:59:35 +0400 |
parents | 68e0443dfd9c |
children | b79faa366fbd |
comparison
equal
deleted
inserted
replaced
362:f8199438385b | 363:032ddb9432ad |
---|---|
1 # | 1 # |
2 # Copyright 2006 Sun Microsystems, Inc. All Rights Reserved. | 2 # Copyright 1995-2008 Sun Microsystems, Inc. All Rights Reserved. |
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 # | 4 # |
5 # This code is free software; you can redistribute it and/or modify it | 5 # This code is free software; you can redistribute it and/or modify it |
6 # under the terms of the GNU General Public License version 2 only, as | 6 # under the terms of the GNU General Public License version 2 only, as |
7 # published by the Free Software Foundation. | 7 # published by the Free Software Foundation. |
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
18 # | 18 # |
19 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | 19 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
20 # CA 95054 USA or visit www.sun.com if you need additional information or | 20 # CA 95054 USA or visit www.sun.com if you need additional information or |
21 # have any questions. | 21 # have any questions. |
22 # | 22 # |
23 # | 23 # |
24 | 24 |
25 # | 25 # |
26 # Makefile to run jtreg | 26 # Makefile to run various jdk tests |
27 # | 27 # |
28 | 28 |
29 # Get OS/ARCH specifics | |
29 OSNAME = $(shell uname -s) | 30 OSNAME = $(shell uname -s) |
31 SLASH_JAVA = /java | |
30 ifeq ($(OSNAME), SunOS) | 32 ifeq ($(OSNAME), SunOS) |
31 PLATFORM = solaris | 33 PLATFORM = solaris |
32 JCT_PLATFORM = solaris | |
33 ARCH = $(shell uname -p) | 34 ARCH = $(shell uname -p) |
34 ifeq ($(ARCH), i386) | 35 ifeq ($(ARCH), i386) |
35 ARCH=i586 | 36 ARCH=i586 |
36 endif | 37 endif |
37 endif | 38 endif |
38 ifeq ($(OSNAME), Linux) | 39 ifeq ($(OSNAME), Linux) |
39 PLATFORM = linux | 40 PLATFORM = linux |
40 JCT_PLATFORM = linux | |
41 ARCH = $(shell uname -m) | 41 ARCH = $(shell uname -m) |
42 ifeq ($(ARCH), i386) | 42 ifeq ($(ARCH), i386) |
43 ARCH=i586 | 43 ARCH = i586 |
44 endif | 44 endif |
45 endif | 45 endif |
46 ifeq ($(OSNAME), Windows_NT) | 46 ifeq ($(OSNAME), Windows_NT) |
47 PLATFORM = windows | 47 PLATFORM = windows |
48 JCT_PLATFORM = win32 | 48 SLASH_JAVA = J: |
49 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),ia64) | 49 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),ia64) |
50 ARCH=ia64 | 50 ARCH = ia64 |
51 else | 51 else |
52 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),AMD64) | 52 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),AMD64) |
53 ARCH=x64 | 53 ARCH = x64 |
54 else | 54 else |
55 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),EM64T) | 55 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),EM64T) |
56 ARCH=x64 | 56 ARCH = x64 |
57 else | 57 else |
58 ARCH=i586 | 58 ARCH = i586 |
59 endif | 59 endif |
60 endif | 60 endif |
61 endif | 61 endif |
62 endif | 62 EXESUFFIX = .exe |
63 | 63 endif |
64 # Default bundle of all test results (passed or not) | 64 |
65 JPRT_ARCHIVE_BUNDLE=$(TEST_ROOT)/JPRT_ARCHIVE_BUNDLE.zip | 65 # Utilities used |
66 | 66 CD = cd |
67 # Default home for JTREG | 67 CP = cp |
68 ifeq ($(PLATFORM), windows) | 68 ECHO = echo |
69 JT_HOME = J:/svc/jct-tools3.2.2_01 | 69 MKDIR = mkdir |
70 else | 70 ZIP = zip |
71 JT_HOME = /java/svc/jct-tools3.2.2_01 | 71 |
72 endif | 72 # Root of this test area (important to use full paths in some places) |
73 | |
74 # Default JTREG to run | |
75 JTREG = $(JT_HOME)/$(JCT_PLATFORM)/bin/jtreg | |
76 | |
77 # Root of this test area | |
78 TEST_ROOT := $(shell pwd) | 73 TEST_ROOT := $(shell pwd) |
79 | 74 |
80 # Default JDK to test | |
81 JAVA_HOME = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH) | |
82 | |
83 # The test directories to run | |
84 DEFAULT_TESTDIRS = serviceability | |
85 TESTDIRS = $(DEFAULT_TESTDIRS) | |
86 | |
87 # Files that hold total passed and failed counts (passed==0 is bad) | |
88 JTREG_TOTALS_DIR = $(TEST_ROOT)/JTREG_TOTALS_$(PLATFORM)_$(ARCH) | |
89 JTREG_FAILED = $(JTREG_TOTALS_DIR)/failed_count | |
90 JTREG_PASSED = $(JTREG_TOTALS_DIR)/passed_count | |
91 | |
92 # Root of all test results | 75 # Root of all test results |
93 JTREG_ALL_OUTPUT_DIRNAME = JTREG_OUTPUT_$(PLATFORM)_$(ARCH) | 76 ABS_BUILD_ROOT = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH) |
94 JTREG_ALL_OUTPUT_DIR = $(TEST_ROOT)/$(JTREG_ALL_OUTPUT_DIRNAME) | 77 ABS_TEST_OUTPUT_DIR = $(ABS_BUILD_ROOT)/testoutput |
95 | 78 |
96 # Test results for one test directory | 79 # Expect JPRT to set PRODUCT_HOME (the product or jdk in this case to test) |
97 JTREG_TEST_OUTPUT_DIR = $(JTREG_ALL_OUTPUT_DIR)/$@ | 80 ifndef PRODUCT_HOME |
98 JTREG_TEST_REPORT_DIR = $(JTREG_TEST_OUTPUT_DIR)/JTreport | 81 # Try to use j2sdk-image if it exists |
99 JTREG_TEST_WORK_DIR = $(JTREG_TEST_OUTPUT_DIR)/JTwork | 82 ABS_JDK_IMAGE = $(ABS_BUILD_ROOT)/j2sdk-image |
100 JTREG_TEST_SUMMARY = $(JTREG_TEST_REPORT_DIR)/summary.txt | 83 PRODUCT_HOME := \ |
101 | 84 $(shell \ |
102 # Temp files used by this Makefile | 85 if [ -d $(ABS_JDK_IMAGE) ] ; then \ |
103 JTREG_TEST_TEMP_DIR = $(JTREG_ALL_OUTPUT_DIR)/$@/temp | 86 $(ECHO) "$(ABS_JDK_IMAGE)"; \ |
104 JTREG_TEMP_PASSED = $(JTREG_TEST_TEMP_DIR)/passed | 87 else \ |
105 JTREG_TEMP_FAILED = $(JTREG_TEST_TEMP_DIR)/failed | 88 $(ECHO) "$(ABS_BUILD_ROOT)" ; \ |
106 JTREG_TEMP_OUTPUT = $(JTREG_TEST_TEMP_DIR)/output | 89 fi) |
107 JTREG_TEMP_RESULTS = $(JTREG_TEST_TEMP_DIR)/results | 90 endif |
108 | 91 |
109 # JTREG options (different for 2.1.6 and 3.2.2_01) | 92 # Expect JPRT to set JAVA_ARGS (e.g. -server etc.) |
110 JTREG_COMMON_OPTIONS = -r:$(JTREG_TEST_REPORT_DIR) \ | 93 JAVA_OPTIONS = |
111 -w:$(JTREG_TEST_WORK_DIR) \ | 94 ifdef JAVA_ARGS |
112 -testjdk:$(JAVA_HOME) \ | 95 JAVA_OPTIONS = $(JAVA_ARGS) |
113 -automatic \ | 96 endif |
114 -verbose:all | 97 |
115 JTREG_216_OPTIONS = $(JTREG_COMMON_OPTIONS) $@ $(JAVA_ARGS) | 98 # Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results) |
116 JTREG_322_OPTIONS = $(JTREG_COMMON_OPTIONS) $(JAVA_ARGS:%=-vmoption:%) $@ | 99 ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip |
117 | 100 ifdef JPRT_ARCHIVE_BUNDLE |
118 # Default make rule | 101 ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE) |
119 all: clean check tests | 102 endif |
120 | 103 |
121 # Chaeck to make sure these directories exist | 104 # How to create the test bundle (pass or fail, we want to create this) |
122 check: $(JT_HOME) $(JAVA_HOME) $(JTREG) | 105 BUNDLE_UP = ( $(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)` \ |
123 | 106 && $(CD) $(ABS_TEST_OUTPUT_DIR) \ |
124 # Prime the test run | 107 && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . ) |
125 primecounts: FRC | 108 BUNDLE_UP_FAILED = ( exitCode=$$? && $(BUNDLE_UP) && exit $${exitCode} ) |
126 @rm -f -r $(JTREG_TOTALS_DIR) | 109 |
127 @mkdir -p $(JTREG_TOTALS_DIR) | 110 ################################################################ |
128 @echo "0" > $(JTREG_FAILED) | 111 |
129 @echo "0" > $(JTREG_PASSED) | 112 # Default make rule (runs jtreg_tests) |
130 | 113 all: jtreg_tests |
131 # Run the tests and determine the 'make' command exit status | 114 @$(ECHO) "Testing completed successfully" |
132 # Ultimately we determine the make exit code based on the passed/failed count | 115 |
133 tests: primecounts $(TESTDIRS) | 116 # Prep for output |
134 @echo "JTREG TOTAL: passed=`cat $(JTREG_PASSED)` failed=`cat $(JTREG_FAILED)`" | 117 prep: clean |
135 zip -q -r $(JPRT_ARCHIVE_BUNDLE) $(JTREG_ALL_OUTPUT_DIRNAME) | 118 @$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR) |
136 @if [ `cat $(JTREG_FAILED)` -ne 0 -o \ | 119 @$(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)` |
137 `cat $(JTREG_PASSED)` -le 0 ] ; then \ | |
138 echo "JTREG FAILED"; \ | |
139 exit 1; \ | |
140 else \ | |
141 echo "JTREG PASSED"; \ | |
142 exit 0; \ | |
143 fi | |
144 | |
145 # Just make sure these directires exist | |
146 $(JT_HOME) $(JAVA_HOME): FRC | |
147 @if [ ! -d $@ ] ; then \ | |
148 echo "ERROR: Directory $@ does not exist"; \ | |
149 exit 1; \ | |
150 fi | |
151 | |
152 # Make sure this file exists | |
153 $(JTREG): FRC | |
154 @if [ ! -f $@ ] ; then \ | |
155 echo "ERROR: File $@ does not exist"; \ | |
156 exit 1; \ | |
157 fi | |
158 | |
159 # Process each test directory one by one, this rule always completes. | |
160 # Note that the use of 'tee' tosses the jtreg process exit status, this | |
161 # is as expected because even if jtreg fails, we need to save the | |
162 # output. So we update the JTREG_PASSED and JTREG_FAILED count files. | |
163 # Note that missing the 'results:' line in the last few lines of output | |
164 # will indicate a failure (or a bump by one of the JTREG_FAILED file. | |
165 # Note that passed: 0 or no passed: indication means a failure. | |
166 # Note that any indication of the word 'failed' indicates failure. | |
167 # Ultimately if the contents of JTREG_FAILED is not 0, we have failed | |
168 # tests, and if the contents of JTREG_PASSED is 0, we consider that a | |
169 # failure. | |
170 $(TESTDIRS): FRC | |
171 @if [ ! -d $@ ] ; then \ | |
172 echo "ERROR: Directory $@ does not exist"; \ | |
173 exit 1; \ | |
174 fi | |
175 @echo "---------------------------------------------------" | |
176 @rm -f -r $(JTREG_TEST_OUTPUT_DIR) | |
177 @mkdir -p $(JTREG_TEST_OUTPUT_DIR) | |
178 @mkdir -p $(JTREG_TEST_WORK_DIR) | |
179 @mkdir -p $(JTREG_TEST_WORK_DIR)/scratch | |
180 @mkdir -p $(JTREG_TEST_REPORT_DIR) | |
181 @mkdir -p $(JTREG_TEST_TEMP_DIR) | |
182 @echo "Testing $@" | |
183 @echo "Using JAVA_HOME=$(JAVA_HOME)" | |
184 @echo "Using JAVA_ARGS=$(JAVA_ARGS)" | |
185 @if [ "`$(JTREG) -help 2>&1 | fgrep -- -vmoption`" != "" ] ; then \ | |
186 echo "Assume we are using jtreg 3.2.2_01 or newer"; \ | |
187 echo "$(JTREG) $(JTREG_322_OPTIONS)"; \ | |
188 $(JTREG) $(JTREG_322_OPTIONS) 2>&1 | tee $(JTREG_TEMP_OUTPUT) ; \ | |
189 else \ | |
190 echo "Assume we are using jtreg 2.1.6"; \ | |
191 echo "$(JTREG) $(JTREG_216_OPTIONS)"; \ | |
192 $(JTREG) $(JTREG_216_OPTIONS) 2>&1 | tee $(JTREG_TEMP_OUTPUT) ; \ | |
193 fi | |
194 @echo "---------------------------------------------------" | |
195 @echo "Extracting passed and failed counts from jtreg output" | |
196 @tail -10 $(JTREG_TEMP_OUTPUT) | fgrep -i 'results:' | \ | |
197 tail -1 | tee $(JTREG_TEMP_RESULTS) | |
198 @sed -e 's@.*\ passed:\ \([1-9][0-9]*\).*@\1@' $(JTREG_TEMP_RESULTS) \ | |
199 > $(JTREG_TEMP_PASSED) | |
200 @if [ "`cat $(JTREG_TEMP_PASSED)`" = "" ] ; then \ | |
201 echo "ERROR: No passed indication in results"; \ | |
202 expr `cat $(JTREG_FAILED)` '+' 1 > $(JTREG_FAILED); \ | |
203 elif [ `cat $(JTREG_TEMP_PASSED)` -le 0 ] ; then \ | |
204 echo "ERROR: Passed count appears to be 0"; \ | |
205 expr `cat $(JTREG_FAILED)` '+' 1 > $(JTREG_FAILED); \ | |
206 elif [ "`fgrep -i failed $(JTREG_TEMP_RESULTS)`" = "" ] ; then \ | |
207 echo "No indication anything failed"; \ | |
208 expr `cat $(JTREG_PASSED)` '+' `cat $(JTREG_TEMP_PASSED)` \ | |
209 > $(JTREG_PASSED); \ | |
210 else \ | |
211 sed -e 's@.*\ failed:\ \([1-9][0-9]*\).*@\1@' $(JTREG_TEMP_FAILED) \ | |
212 > $(JTREG_TEMP_FAILED); \ | |
213 if [ "`cat $(JTREG_TEMP_FAILED)`" = "" ] ; then \ | |
214 echo "ERROR: Failed pattern but no failed count in results"; \ | |
215 expr `cat $(JTREG_FAILED)` '+' 1 > $(JTREG_FAILED); \ | |
216 elif [ `cat $(JTREG_TEMP_FAILED)` -le 0 ] ; then \ | |
217 echo "ERROR: Failed count is 0, did something failed or not?"; \ | |
218 expr `cat $(JTREG_FAILED)` '+' 1 > $(JTREG_FAILED); \ | |
219 else \ | |
220 expr `cat $(JTREG_FAILED)` '+' `cat $(JTREG_TEMP_FAILED)` \ | |
221 > $(JTREG_FAILED); \ | |
222 fi; \ | |
223 fi | |
224 @echo "---------------------------------------------------" | |
225 @echo "Summary: " | |
226 @if [ -f $(JTREG_TEST_SUMMARY) ] ; then \ | |
227 cat $(JTREG_TEST_SUMMARY) ; \ | |
228 else \ | |
229 echo "ERROR: Missing $(JTREG_TEST_SUMMARY)"; \ | |
230 fi | |
231 @echo "---------------------------------------------------" | |
232 | 120 |
233 # Cleanup | 121 # Cleanup |
234 clean: | 122 clean: |
235 rm -f -r $(JTREG_ALL_OUTPUT_DIR) | 123 $(RM) -r $(ABS_TEST_OUTPUT_DIR) |
236 rm -f $(JPRT_ARCHIVE_BUNDLE) | 124 $(RM) $(ARCHIVE_BUNDLE) |
237 | 125 |
238 FRC: | 126 ################################################################ |
239 | 127 |
128 # jtreg tests | |
129 | |
130 # Expect JT_HOME to be set for jtreg tests. (home for jtreg) | |
131 JT_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg | |
132 ifdef JPRT_JTREG_HOME | |
133 JT_HOME = $(JPRT_JTREG_HOME) | |
134 endif | |
135 | |
136 # Expect JPRT to set TESTDIRS to the jtreg test dirs | |
137 JTREG_TESTDIRS = demo/jvmti/gctest demo/jvmti/hprof | |
138 ifdef TESTDIRS | |
139 JTREG_TESTDIRS = $(TESTDIRS) | |
140 endif | |
141 | |
142 # Default JTREG to run (win32 script works for everybody) | |
143 JTREG = $(JT_HOME)/win32/bin/jtreg | |
144 | |
145 # Option to tell jtreg to not run tests marked with "ignore" | |
146 ifeq ($(PLATFORM), windows) | |
147 JTREG_KEY_OPTION = -k:!ignore | |
148 else | |
149 JTREG_KEY_OPTION = -k:\!ignore | |
150 endif | |
151 | |
152 #EXTRA_JTREG_OPTIONS = | |
153 | |
154 jtreg_tests: prep $(JT_HOME) $(PRODUCT_HOME) $(JTREG) | |
155 $(JTREG) -a -v:fail,error \ | |
156 $(JTREG_KEY_OPTION) \ | |
157 $(EXTRA_JTREG_OPTIONS) \ | |
158 -r:$(ABS_TEST_OUTPUT_DIR)/JTreport \ | |
159 -w:$(ABS_TEST_OUTPUT_DIR)/JTwork \ | |
160 -jdk:$(PRODUCT_HOME) \ | |
161 $(JAVA_OPTIONS:%=-vmoption:%) \ | |
162 $(JTREG_TESTDIRS) \ | |
163 || $(BUNDLE_UP_FAILED) | |
164 $(BUNDLE_UP) | |
165 | |
166 PHONY_LIST += jtreg_tests | |
167 | |
168 ################################################################ | |
169 | |
170 # packtest | |
171 | |
172 # Expect JPRT to set JPRT_PACKTEST_HOME. | |
173 PACKTEST_HOME = /net/jprt-web.sfbay.sun.com/jprt/allproducts/packtest | |
174 ifdef JPRT_PACKTEST_HOME | |
175 PACKTEST_HOME = $(JPRT_PACKTEST_HOME) | |
176 endif | |
177 | |
178 #EXTRA_PACKTEST_OPTIONS = | |
179 | |
180 packtest: prep $(PACKTEST_HOME)/ptest $(PRODUCT_HOME) | |
181 ( $(CD) $(PACKTEST_HOME) && \ | |
182 $(PACKTEST_HOME)/ptest \ | |
183 -t "$(PRODUCT_HOME)" \ | |
184 $(PACKTEST_STRESS_OPTION) \ | |
185 $(EXTRA_PACKTEST_OPTIONS) \ | |
186 -W $(ABS_TEST_OUTPUT_DIR) \ | |
187 $(JAVA_OPTIONS:%=-J %) \ | |
188 ) || $(BUNDLE_UP_FAILED) | |
189 $(BUNDLE_UP) | |
190 | |
191 packtest_stress: PACKTEST_STRESS_OPTION=-s | |
192 packtest_stress: packtest | |
193 | |
194 PHONY_LIST += packtest packtest_stress | |
195 | |
196 ################################################################ | |
197 | |
198 # Phony targets (e.g. these are not filenames) | |
199 .PHONY: all clean prep $(PHONY_LIST) | |
200 | |
201 ################################################################ | |
202 |