Thu, 11 Sep 2008 11:04:55 -0700
6745363: Add ability to run packtest to hotspot/test/makefile
Reviewed-by: ksrini
make/jprt.properties | file | annotate | diff | comparison | revisions | |
test/Makefile | file | annotate | diff | comparison | revisions |
1.1 --- a/make/jprt.properties Wed Sep 10 06:15:02 2008 -0700 1.2 +++ b/make/jprt.properties Thu Sep 11 11:04:55 2008 -0700 1.3 @@ -295,3 +295,9 @@ 1.4 ${jprt.my.windows.i586.test.targets}, \ 1.5 ${jprt.my.windows.x64.test.targets} 1.6 1.7 +# The default test/Makefile targets that should be run 1.8 + 1.9 +# Example: 1.10 +# jprt.make.rule.test.targets=*-*-*-packtest 1.11 +#jprt.make.rule.test.targets=*-product-*-packtest 1.12 +
2.1 --- a/test/Makefile Wed Sep 10 06:15:02 2008 -0700 2.2 +++ b/test/Makefile Thu Sep 11 11:04:55 2008 -0700 2.3 @@ -1,5 +1,5 @@ 2.4 # 2.5 -# Copyright 2006 Sun Microsystems, Inc. All Rights Reserved. 2.6 +# Copyright 1995-2008 Sun Microsystems, Inc. All Rights Reserved. 2.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 # 2.9 # This code is free software; you can redistribute it and/or modify it 2.10 @@ -19,17 +19,18 @@ 2.11 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 2.12 # CA 95054 USA or visit www.sun.com if you need additional information or 2.13 # have any questions. 2.14 -# 2.15 +# 2.16 # 2.17 2.18 # 2.19 -# Makefile to run jtreg 2.20 +# Makefile to run various jdk tests 2.21 # 2.22 2.23 +# Get OS/ARCH specifics 2.24 OSNAME = $(shell uname -s) 2.25 +SLASH_JAVA = /java 2.26 ifeq ($(OSNAME), SunOS) 2.27 PLATFORM = solaris 2.28 - JCT_PLATFORM = solaris 2.29 ARCH = $(shell uname -p) 2.30 ifeq ($(ARCH), i386) 2.31 ARCH=i586 2.32 @@ -37,203 +38,165 @@ 2.33 endif 2.34 ifeq ($(OSNAME), Linux) 2.35 PLATFORM = linux 2.36 - JCT_PLATFORM = linux 2.37 ARCH = $(shell uname -m) 2.38 ifeq ($(ARCH), i386) 2.39 - ARCH=i586 2.40 + ARCH = i586 2.41 endif 2.42 endif 2.43 ifeq ($(OSNAME), Windows_NT) 2.44 PLATFORM = windows 2.45 - JCT_PLATFORM = win32 2.46 + SLASH_JAVA = J: 2.47 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),ia64) 2.48 - ARCH=ia64 2.49 + ARCH = ia64 2.50 else 2.51 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),AMD64) 2.52 - ARCH=x64 2.53 + ARCH = x64 2.54 else 2.55 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),EM64T) 2.56 - ARCH=x64 2.57 + ARCH = x64 2.58 else 2.59 - ARCH=i586 2.60 + ARCH = i586 2.61 endif 2.62 endif 2.63 endif 2.64 + EXESUFFIX = .exe 2.65 endif 2.66 2.67 -# Default bundle of all test results (passed or not) 2.68 -JPRT_ARCHIVE_BUNDLE=$(TEST_ROOT)/JPRT_ARCHIVE_BUNDLE.zip 2.69 +# Utilities used 2.70 +CD = cd 2.71 +CP = cp 2.72 +ECHO = echo 2.73 +MKDIR = mkdir 2.74 +ZIP = zip 2.75 2.76 -# Default home for JTREG 2.77 -ifeq ($(PLATFORM), windows) 2.78 - JT_HOME = J:/svc/jct-tools3.2.2_01 2.79 -else 2.80 - JT_HOME = /java/svc/jct-tools3.2.2_01 2.81 +# Root of this test area (important to use full paths in some places) 2.82 +TEST_ROOT := $(shell pwd) 2.83 + 2.84 +# Root of all test results 2.85 +ABS_BUILD_ROOT = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH) 2.86 +ABS_TEST_OUTPUT_DIR = $(ABS_BUILD_ROOT)/testoutput 2.87 + 2.88 +# Expect JPRT to set PRODUCT_HOME (the product or jdk in this case to test) 2.89 +ifndef PRODUCT_HOME 2.90 + # Try to use j2sdk-image if it exists 2.91 + ABS_JDK_IMAGE = $(ABS_BUILD_ROOT)/j2sdk-image 2.92 + PRODUCT_HOME := \ 2.93 + $(shell \ 2.94 + if [ -d $(ABS_JDK_IMAGE) ] ; then \ 2.95 + $(ECHO) "$(ABS_JDK_IMAGE)"; \ 2.96 + else \ 2.97 + $(ECHO) "$(ABS_BUILD_ROOT)" ; \ 2.98 + fi) 2.99 endif 2.100 2.101 -# Default JTREG to run 2.102 -JTREG = $(JT_HOME)/$(JCT_PLATFORM)/bin/jtreg 2.103 +# Expect JPRT to set JAVA_ARGS (e.g. -server etc.) 2.104 +JAVA_OPTIONS = 2.105 +ifdef JAVA_ARGS 2.106 + JAVA_OPTIONS = $(JAVA_ARGS) 2.107 +endif 2.108 2.109 -# Root of this test area 2.110 -TEST_ROOT := $(shell pwd) 2.111 +# Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results) 2.112 +ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip 2.113 +ifdef JPRT_ARCHIVE_BUNDLE 2.114 + ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE) 2.115 +endif 2.116 2.117 -# Default JDK to test 2.118 -JAVA_HOME = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH) 2.119 +# How to create the test bundle (pass or fail, we want to create this) 2.120 +BUNDLE_UP = ( $(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)` \ 2.121 + && $(CD) $(ABS_TEST_OUTPUT_DIR) \ 2.122 + && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . ) 2.123 +BUNDLE_UP_FAILED = ( exitCode=$$? && $(BUNDLE_UP) && exit $${exitCode} ) 2.124 2.125 -# The test directories to run 2.126 -DEFAULT_TESTDIRS = serviceability 2.127 -TESTDIRS = $(DEFAULT_TESTDIRS) 2.128 +################################################################ 2.129 2.130 -# Files that hold total passed and failed counts (passed==0 is bad) 2.131 -JTREG_TOTALS_DIR = $(TEST_ROOT)/JTREG_TOTALS_$(PLATFORM)_$(ARCH) 2.132 -JTREG_FAILED = $(JTREG_TOTALS_DIR)/failed_count 2.133 -JTREG_PASSED = $(JTREG_TOTALS_DIR)/passed_count 2.134 +# Default make rule (runs jtreg_tests) 2.135 +all: jtreg_tests 2.136 + @$(ECHO) "Testing completed successfully" 2.137 2.138 -# Root of all test results 2.139 -JTREG_ALL_OUTPUT_DIRNAME = JTREG_OUTPUT_$(PLATFORM)_$(ARCH) 2.140 -JTREG_ALL_OUTPUT_DIR = $(TEST_ROOT)/$(JTREG_ALL_OUTPUT_DIRNAME) 2.141 - 2.142 -# Test results for one test directory 2.143 -JTREG_TEST_OUTPUT_DIR = $(JTREG_ALL_OUTPUT_DIR)/$@ 2.144 -JTREG_TEST_REPORT_DIR = $(JTREG_TEST_OUTPUT_DIR)/JTreport 2.145 -JTREG_TEST_WORK_DIR = $(JTREG_TEST_OUTPUT_DIR)/JTwork 2.146 -JTREG_TEST_SUMMARY = $(JTREG_TEST_REPORT_DIR)/summary.txt 2.147 - 2.148 -# Temp files used by this Makefile 2.149 -JTREG_TEST_TEMP_DIR = $(JTREG_ALL_OUTPUT_DIR)/$@/temp 2.150 -JTREG_TEMP_PASSED = $(JTREG_TEST_TEMP_DIR)/passed 2.151 -JTREG_TEMP_FAILED = $(JTREG_TEST_TEMP_DIR)/failed 2.152 -JTREG_TEMP_OUTPUT = $(JTREG_TEST_TEMP_DIR)/output 2.153 -JTREG_TEMP_RESULTS = $(JTREG_TEST_TEMP_DIR)/results 2.154 - 2.155 -# JTREG options (different for 2.1.6 and 3.2.2_01) 2.156 -JTREG_COMMON_OPTIONS = -r:$(JTREG_TEST_REPORT_DIR) \ 2.157 - -w:$(JTREG_TEST_WORK_DIR) \ 2.158 - -testjdk:$(JAVA_HOME) \ 2.159 - -automatic \ 2.160 - -verbose:all 2.161 -JTREG_216_OPTIONS = $(JTREG_COMMON_OPTIONS) $@ $(JAVA_ARGS) 2.162 -JTREG_322_OPTIONS = $(JTREG_COMMON_OPTIONS) $(JAVA_ARGS:%=-vmoption:%) $@ 2.163 - 2.164 -# Default make rule 2.165 -all: clean check tests 2.166 - 2.167 -# Chaeck to make sure these directories exist 2.168 -check: $(JT_HOME) $(JAVA_HOME) $(JTREG) 2.169 - 2.170 -# Prime the test run 2.171 -primecounts: FRC 2.172 - @rm -f -r $(JTREG_TOTALS_DIR) 2.173 - @mkdir -p $(JTREG_TOTALS_DIR) 2.174 - @echo "0" > $(JTREG_FAILED) 2.175 - @echo "0" > $(JTREG_PASSED) 2.176 - 2.177 -# Run the tests and determine the 'make' command exit status 2.178 -# Ultimately we determine the make exit code based on the passed/failed count 2.179 -tests: primecounts $(TESTDIRS) 2.180 - @echo "JTREG TOTAL: passed=`cat $(JTREG_PASSED)` failed=`cat $(JTREG_FAILED)`" 2.181 - zip -q -r $(JPRT_ARCHIVE_BUNDLE) $(JTREG_ALL_OUTPUT_DIRNAME) 2.182 - @if [ `cat $(JTREG_FAILED)` -ne 0 -o \ 2.183 - `cat $(JTREG_PASSED)` -le 0 ] ; then \ 2.184 - echo "JTREG FAILED"; \ 2.185 - exit 1; \ 2.186 - else \ 2.187 - echo "JTREG PASSED"; \ 2.188 - exit 0; \ 2.189 - fi 2.190 - 2.191 -# Just make sure these directires exist 2.192 -$(JT_HOME) $(JAVA_HOME): FRC 2.193 - @if [ ! -d $@ ] ; then \ 2.194 - echo "ERROR: Directory $@ does not exist"; \ 2.195 - exit 1; \ 2.196 - fi 2.197 - 2.198 -# Make sure this file exists 2.199 -$(JTREG): FRC 2.200 - @if [ ! -f $@ ] ; then \ 2.201 - echo "ERROR: File $@ does not exist"; \ 2.202 - exit 1; \ 2.203 - fi 2.204 - 2.205 -# Process each test directory one by one, this rule always completes. 2.206 -# Note that the use of 'tee' tosses the jtreg process exit status, this 2.207 -# is as expected because even if jtreg fails, we need to save the 2.208 -# output. So we update the JTREG_PASSED and JTREG_FAILED count files. 2.209 -# Note that missing the 'results:' line in the last few lines of output 2.210 -# will indicate a failure (or a bump by one of the JTREG_FAILED file. 2.211 -# Note that passed: 0 or no passed: indication means a failure. 2.212 -# Note that any indication of the word 'failed' indicates failure. 2.213 -# Ultimately if the contents of JTREG_FAILED is not 0, we have failed 2.214 -# tests, and if the contents of JTREG_PASSED is 0, we consider that a 2.215 -# failure. 2.216 -$(TESTDIRS): FRC 2.217 - @if [ ! -d $@ ] ; then \ 2.218 - echo "ERROR: Directory $@ does not exist"; \ 2.219 - exit 1; \ 2.220 - fi 2.221 - @echo "---------------------------------------------------" 2.222 - @rm -f -r $(JTREG_TEST_OUTPUT_DIR) 2.223 - @mkdir -p $(JTREG_TEST_OUTPUT_DIR) 2.224 - @mkdir -p $(JTREG_TEST_WORK_DIR) 2.225 - @mkdir -p $(JTREG_TEST_WORK_DIR)/scratch 2.226 - @mkdir -p $(JTREG_TEST_REPORT_DIR) 2.227 - @mkdir -p $(JTREG_TEST_TEMP_DIR) 2.228 - @echo "Testing $@" 2.229 - @echo "Using JAVA_HOME=$(JAVA_HOME)" 2.230 - @echo "Using JAVA_ARGS=$(JAVA_ARGS)" 2.231 - @if [ "`$(JTREG) -help 2>&1 | fgrep -- -vmoption`" != "" ] ; then \ 2.232 - echo "Assume we are using jtreg 3.2.2_01 or newer"; \ 2.233 - echo "$(JTREG) $(JTREG_322_OPTIONS)"; \ 2.234 - $(JTREG) $(JTREG_322_OPTIONS) 2>&1 | tee $(JTREG_TEMP_OUTPUT) ; \ 2.235 - else \ 2.236 - echo "Assume we are using jtreg 2.1.6"; \ 2.237 - echo "$(JTREG) $(JTREG_216_OPTIONS)"; \ 2.238 - $(JTREG) $(JTREG_216_OPTIONS) 2>&1 | tee $(JTREG_TEMP_OUTPUT) ; \ 2.239 - fi 2.240 - @echo "---------------------------------------------------" 2.241 - @echo "Extracting passed and failed counts from jtreg output" 2.242 - @tail -10 $(JTREG_TEMP_OUTPUT) | fgrep -i 'results:' | \ 2.243 - tail -1 | tee $(JTREG_TEMP_RESULTS) 2.244 - @sed -e 's@.*\ passed:\ \([1-9][0-9]*\).*@\1@' $(JTREG_TEMP_RESULTS) \ 2.245 - > $(JTREG_TEMP_PASSED) 2.246 - @if [ "`cat $(JTREG_TEMP_PASSED)`" = "" ] ; then \ 2.247 - echo "ERROR: No passed indication in results"; \ 2.248 - expr `cat $(JTREG_FAILED)` '+' 1 > $(JTREG_FAILED); \ 2.249 - elif [ `cat $(JTREG_TEMP_PASSED)` -le 0 ] ; then \ 2.250 - echo "ERROR: Passed count appears to be 0"; \ 2.251 - expr `cat $(JTREG_FAILED)` '+' 1 > $(JTREG_FAILED); \ 2.252 - elif [ "`fgrep -i failed $(JTREG_TEMP_RESULTS)`" = "" ] ; then \ 2.253 - echo "No indication anything failed"; \ 2.254 - expr `cat $(JTREG_PASSED)` '+' `cat $(JTREG_TEMP_PASSED)` \ 2.255 - > $(JTREG_PASSED); \ 2.256 - else \ 2.257 - sed -e 's@.*\ failed:\ \([1-9][0-9]*\).*@\1@' $(JTREG_TEMP_FAILED) \ 2.258 - > $(JTREG_TEMP_FAILED); \ 2.259 - if [ "`cat $(JTREG_TEMP_FAILED)`" = "" ] ; then \ 2.260 - echo "ERROR: Failed pattern but no failed count in results"; \ 2.261 - expr `cat $(JTREG_FAILED)` '+' 1 > $(JTREG_FAILED); \ 2.262 - elif [ `cat $(JTREG_TEMP_FAILED)` -le 0 ] ; then \ 2.263 - echo "ERROR: Failed count is 0, did something failed or not?"; \ 2.264 - expr `cat $(JTREG_FAILED)` '+' 1 > $(JTREG_FAILED); \ 2.265 - else \ 2.266 - expr `cat $(JTREG_FAILED)` '+' `cat $(JTREG_TEMP_FAILED)` \ 2.267 - > $(JTREG_FAILED); \ 2.268 - fi; \ 2.269 - fi 2.270 - @echo "---------------------------------------------------" 2.271 - @echo "Summary: " 2.272 - @if [ -f $(JTREG_TEST_SUMMARY) ] ; then \ 2.273 - cat $(JTREG_TEST_SUMMARY) ; \ 2.274 - else \ 2.275 - echo "ERROR: Missing $(JTREG_TEST_SUMMARY)"; \ 2.276 - fi 2.277 - @echo "---------------------------------------------------" 2.278 +# Prep for output 2.279 +prep: clean 2.280 + @$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR) 2.281 + @$(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)` 2.282 2.283 # Cleanup 2.284 clean: 2.285 - rm -f -r $(JTREG_ALL_OUTPUT_DIR) 2.286 - rm -f $(JPRT_ARCHIVE_BUNDLE) 2.287 + $(RM) -r $(ABS_TEST_OUTPUT_DIR) 2.288 + $(RM) $(ARCHIVE_BUNDLE) 2.289 2.290 -FRC: 2.291 +################################################################ 2.292 2.293 +# jtreg tests 2.294 + 2.295 +# Expect JT_HOME to be set for jtreg tests. (home for jtreg) 2.296 +JT_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg 2.297 +ifdef JPRT_JTREG_HOME 2.298 + JT_HOME = $(JPRT_JTREG_HOME) 2.299 +endif 2.300 + 2.301 +# Expect JPRT to set TESTDIRS to the jtreg test dirs 2.302 +JTREG_TESTDIRS = demo/jvmti/gctest demo/jvmti/hprof 2.303 +ifdef TESTDIRS 2.304 + JTREG_TESTDIRS = $(TESTDIRS) 2.305 +endif 2.306 + 2.307 +# Default JTREG to run (win32 script works for everybody) 2.308 +JTREG = $(JT_HOME)/win32/bin/jtreg 2.309 + 2.310 +# Option to tell jtreg to not run tests marked with "ignore" 2.311 +ifeq ($(PLATFORM), windows) 2.312 + JTREG_KEY_OPTION = -k:!ignore 2.313 +else 2.314 + JTREG_KEY_OPTION = -k:\!ignore 2.315 +endif 2.316 + 2.317 +#EXTRA_JTREG_OPTIONS = 2.318 + 2.319 +jtreg_tests: prep $(JT_HOME) $(PRODUCT_HOME) $(JTREG) 2.320 + $(JTREG) -a -v:fail,error \ 2.321 + $(JTREG_KEY_OPTION) \ 2.322 + $(EXTRA_JTREG_OPTIONS) \ 2.323 + -r:$(ABS_TEST_OUTPUT_DIR)/JTreport \ 2.324 + -w:$(ABS_TEST_OUTPUT_DIR)/JTwork \ 2.325 + -jdk:$(PRODUCT_HOME) \ 2.326 + $(JAVA_OPTIONS:%=-vmoption:%) \ 2.327 + $(JTREG_TESTDIRS) \ 2.328 + || $(BUNDLE_UP_FAILED) 2.329 + $(BUNDLE_UP) 2.330 + 2.331 +PHONY_LIST += jtreg_tests 2.332 + 2.333 +################################################################ 2.334 + 2.335 +# packtest 2.336 + 2.337 +# Expect JPRT to set JPRT_PACKTEST_HOME. 2.338 +PACKTEST_HOME = /net/jprt-web.sfbay.sun.com/jprt/allproducts/packtest 2.339 +ifdef JPRT_PACKTEST_HOME 2.340 + PACKTEST_HOME = $(JPRT_PACKTEST_HOME) 2.341 +endif 2.342 + 2.343 +#EXTRA_PACKTEST_OPTIONS = 2.344 + 2.345 +packtest: prep $(PACKTEST_HOME)/ptest $(PRODUCT_HOME) 2.346 + ( $(CD) $(PACKTEST_HOME) && \ 2.347 + $(PACKTEST_HOME)/ptest \ 2.348 + -t "$(PRODUCT_HOME)" \ 2.349 + $(PACKTEST_STRESS_OPTION) \ 2.350 + $(EXTRA_PACKTEST_OPTIONS) \ 2.351 + -W $(ABS_TEST_OUTPUT_DIR) \ 2.352 + $(JAVA_OPTIONS:%=-J %) \ 2.353 + ) || $(BUNDLE_UP_FAILED) 2.354 + $(BUNDLE_UP) 2.355 + 2.356 +packtest_stress: PACKTEST_STRESS_OPTION=-s 2.357 +packtest_stress: packtest 2.358 + 2.359 +PHONY_LIST += packtest packtest_stress 2.360 + 2.361 +################################################################ 2.362 + 2.363 +# Phony targets (e.g. these are not filenames) 2.364 +.PHONY: all clean prep $(PHONY_LIST) 2.365 + 2.366 +################################################################ 2.367 +