Makefile revision 1949:0a8e0d4345b3
1130561Sobrien# 2130561Sobrien# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. 3130561Sobrien# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4130561Sobrien# 5130561Sobrien# This code is free software; you can redistribute it and/or modify it 6130561Sobrien# under the terms of the GNU General Public License version 2 only, as 7130561Sobrien# published by the Free Software Foundation. 8130561Sobrien# 9130561Sobrien# This code is distributed in the hope that it will be useful, but WITHOUT 10130561Sobrien# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11130561Sobrien# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12130561Sobrien# version 2 for more details (a copy is included in the LICENSE file that 13130561Sobrien# accompanied this code). 14130561Sobrien# 15130561Sobrien# You should have received a copy of the GNU General Public License version 16130561Sobrien# 2 along with this work; if not, write to the Free Software Foundation, 17130561Sobrien# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18130561Sobrien# 19130561Sobrien# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20130561Sobrien# or visit www.oracle.com if you need additional information or have any 21130561Sobrien# questions. 22130561Sobrien# 23130561Sobrien# 24130561Sobrien 25130561Sobrien# 26130561Sobrien# Makefile to run various jdk tests 27130561Sobrien# 28130561Sobrien 29130561Sobrien# Get OS/ARCH specifics 30130561SobrienOSNAME = $(shell uname -s) 31130561Sobrienifeq ($(OSNAME), SunOS) 32130561Sobrien PLATFORM = solaris 33130561Sobrien SLASH_JAVA = /java 34130561Sobrien ARCH = $(shell uname -p) 35130561Sobrien ifeq ($(ARCH), i386) 36130561Sobrien ARCH=i586 37130561Sobrien endif 38130561Sobrienendif 39130561Sobrienifeq ($(OSNAME), Linux) 40130561Sobrien PLATFORM = linux 41130561Sobrien SLASH_JAVA = /java 42130561Sobrien ARCH = $(shell uname -m) 43130561Sobrien ifeq ($(ARCH), i386) 44130561Sobrien ARCH = i586 45130561Sobrien endif 46130561Sobrienendif 47130561Sobrienifeq ($(OSNAME), Windows_NT) 48130561Sobrien PLATFORM = windows 49130561Sobrien SLASH_JAVA = J: 50130561Sobrien ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),ia64) 51130561Sobrien ARCH = ia64 52130561Sobrien else 53130561Sobrien ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),AMD64) 54130561Sobrien ARCH = x64 55130561Sobrien else 56130561Sobrien ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),EM64T) 57130561Sobrien ARCH = x64 58130561Sobrien else 59130561Sobrien ARCH = i586 60130561Sobrien endif 61130561Sobrien endif 62130561Sobrien endif 63130561Sobrien EXESUFFIX = .exe 64130561Sobrienendif 65130561Sobrien 66130561Sobrienifdef ALT_SLASH_JAVA 67130561Sobrien SLASH_JAVA = $(ALT_SLASH_JAVA) 68130561Sobrienendif 69130561Sobrien 70130561Sobrien# Utilities used 71130561SobrienCD = cd 72130561SobrienCP = cp 73130561SobrienECHO = echo 74130561SobrienMKDIR = mkdir 75130561SobrienZIP = zip 76130561Sobrien 77130561Sobrien# Root of this test area (important to use full paths in some places) 78130561SobrienTEST_ROOT := $(shell pwd) 79130561Sobrien 80130561Sobrien# Root of all test results 81130561Sobrienifdef ALT_OUTPUTDIR 82130561Sobrien ABS_BUILD_ROOT = $(ALT_OUTPUTDIR)/$(PLATFORM)-$(ARCH) 83130561Sobrienelse 84130561Sobrien ABS_BUILD_ROOT = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH) 85130561Sobrienendif 86130561SobrienABS_TEST_OUTPUT_DIR = $(ABS_BUILD_ROOT)/testoutput 87130561Sobrien 88130561Sobrien# Expect JPRT to set PRODUCT_HOME (the product or jdk in this case to test) 89130561Sobrienifndef PRODUCT_HOME 90130561Sobrien # Try to use j2sdk-image if it exists 91130561Sobrien ABS_JDK_IMAGE = $(ABS_BUILD_ROOT)/j2sdk-image 92130561Sobrien PRODUCT_HOME := \ 93130561Sobrien $(shell \ 94130561Sobrien if [ -d $(ABS_JDK_IMAGE) ] ; then \ 95130561Sobrien $(ECHO) "$(ABS_JDK_IMAGE)"; \ 96130561Sobrien else \ 97130561Sobrien $(ECHO) "$(ABS_BUILD_ROOT)" ; \ 98130561Sobrien fi) 99130561Sobrienendif 100130561Sobrien 101130561Sobrien# Expect JPRT to set JAVA_ARGS (e.g. -server etc.) 102130561SobrienJAVA_OPTIONS = 103130561Sobrienifdef JAVA_ARGS 104130561Sobrien JAVA_OPTIONS = $(JAVA_ARGS) 105130561Sobrienendif 106130561Sobrien 107130561Sobrien# Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results) 108130561SobrienARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip 109130561Sobrienifdef JPRT_ARCHIVE_BUNDLE 110130561Sobrien ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE) 111130561Sobrienendif 112130561Sobrien 113130561Sobrien# How to create the test bundle (pass or fail, we want to create this) 114130561SobrienBUNDLE_UP = ( $(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)` \ 115130561Sobrien && $(CD) $(ABS_TEST_OUTPUT_DIR) \ 116130561Sobrien && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . ) 117130561SobrienBUNDLE_UP_FAILED = ( exitCode=$$? && $(BUNDLE_UP) && exit $${exitCode} ) 118130561Sobrien 119130561Sobrien################################################################ 120130561Sobrien 121130561Sobrien# Default make rule (runs jtreg_tests) 122130561Sobrienall: jtreg_tests 123130561Sobrien @$(ECHO) "Testing completed successfully" 124130561Sobrien 125130561Sobrien# Prep for output 126130561Sobrienprep: clean 127130561Sobrien @$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR) 128130561Sobrien @$(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)` 129130561Sobrien 130130561Sobrien# Cleanup 131130561Sobrienclean: 132130561Sobrien $(RM) -r $(ABS_TEST_OUTPUT_DIR) 133130561Sobrien $(RM) $(ARCHIVE_BUNDLE) 134130561Sobrien 135130561Sobrien################################################################ 136130561Sobrien 137130561Sobrien# jtreg tests 138130561Sobrien 139130561Sobrien# Expect JT_HOME to be set for jtreg tests. (home for jtreg) 140130561SobrienJT_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg 141130561Sobrienifdef JPRT_JTREG_HOME 142130561Sobrien JT_HOME = $(JPRT_JTREG_HOME) 143130561Sobrienendif 144130561Sobrien 145130561Sobrien# Expect JPRT to set TESTDIRS to the jtreg test dirs 146130561SobrienJTREG_TESTDIRS = demo/jvmti/gctest demo/jvmti/hprof 147130561Sobrienifdef TESTDIRS 148130561Sobrien JTREG_TESTDIRS = $(TESTDIRS) 149130561Sobrienendif 150130561Sobrien 151130561Sobrien# Default JTREG to run (win32 script works for everybody) 152130561SobrienJTREG = $(JT_HOME)/win32/bin/jtreg 153130561Sobrien 154130561Sobrien# Option to tell jtreg to not run tests marked with "ignore" 155130561Sobrienifeq ($(PLATFORM), windows) 156130561Sobrien JTREG_KEY_OPTION = -k:!ignore 157130561Sobrienelse 158130561Sobrien JTREG_KEY_OPTION = -k:\!ignore 159130561Sobrienendif 160130561Sobrien 161130561Sobrien#EXTRA_JTREG_OPTIONS = 162130561Sobrien 163130561Sobrienjtreg_tests: prep $(JT_HOME) $(PRODUCT_HOME) $(JTREG) 164130561Sobrien $(JTREG) -a -v:fail,error \ 165130561Sobrien $(JTREG_KEY_OPTION) \ 166130561Sobrien $(EXTRA_JTREG_OPTIONS) \ 167130561Sobrien -r:$(ABS_TEST_OUTPUT_DIR)/JTreport \ 168130561Sobrien -w:$(ABS_TEST_OUTPUT_DIR)/JTwork \ 169130561Sobrien -jdk:$(PRODUCT_HOME) \ 170130561Sobrien $(JAVA_OPTIONS:%=-vmoption:%) \ 171130561Sobrien $(JTREG_TESTDIRS) \ 172130561Sobrien || $(BUNDLE_UP_FAILED) 173130561Sobrien $(BUNDLE_UP) 174130561Sobrien 175130561SobrienPHONY_LIST += jtreg_tests 176130561Sobrien 177130561Sobrien################################################################ 178130561Sobrien 179130561Sobrien# clienttest (make sure various basic java client options work) 180130561Sobrien 181130561Sobrienclienttest: prep $(PRODUCT_HOME) 182130561Sobrien $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version 183130561Sobrien $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help 184130561Sobrien $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X 185130561Sobrien $(RM) $(PRODUCT_HOME)/jre/lib/*/client/classes.jsa 186130561Sobrien $(RM) $(PRODUCT_HOME)/jre/lib/*/client/classes_g.jsa 187130561Sobrien $(RM) $(PRODUCT_HOME)/jre/bin/client/classes.jsa 188130561Sobrien $(RM) $(PRODUCT_HOME)/jre/bin/client/classes_g.jsa 189130561Sobrien $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -Xshare:dump 190130561Sobrien 191130561SobrienPHONY_LIST += clienttest 192130561Sobrien 193130561Sobrien################################################################ 194130561Sobrien 195130561Sobrien# servertest (make sure various basic java server options work) 196130561Sobrien 197130561Sobrienservertest: prep $(PRODUCT_HOME) 198130561Sobrien $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version 199130561Sobrien $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help 200130561Sobrien $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X 201130561Sobrien 202130561SobrienPHONY_LIST += servertest 203130561Sobrien 204130561Sobrien################################################################ 205130561Sobrien 206130561Sobrien# packtest 207130561Sobrien 208130561Sobrien# Expect JPRT to set JPRT_PACKTEST_HOME. 209130561SobrienPACKTEST_HOME = /net/jprt-web.sfbay.sun.com/jprt/allproducts/packtest 210130561Sobrienifdef JPRT_PACKTEST_HOME 211130561Sobrien PACKTEST_HOME = $(JPRT_PACKTEST_HOME) 212130561Sobrienendif 213130561Sobrien 214130561Sobrien#EXTRA_PACKTEST_OPTIONS = 215130561Sobrien 216130561Sobrienpacktest: prep $(PACKTEST_HOME)/ptest $(PRODUCT_HOME) 217130561Sobrien ( $(CD) $(PACKTEST_HOME) && \ 218130561Sobrien $(PACKTEST_HOME)/ptest \ 219130561Sobrien -t "$(PRODUCT_HOME)" \ 220130561Sobrien $(PACKTEST_STRESS_OPTION) \ 221130561Sobrien $(EXTRA_PACKTEST_OPTIONS) \ 222130561Sobrien -W $(ABS_TEST_OUTPUT_DIR) \ 223130561Sobrien $(JAVA_OPTIONS:%=-J %) \ 224130561Sobrien ) || $(BUNDLE_UP_FAILED) 225130561Sobrien $(BUNDLE_UP) 226130561Sobrien 227130561Sobrienpacktest_stress: PACKTEST_STRESS_OPTION=-s 228130561Sobrienpacktest_stress: packtest 229130561Sobrien 230130561SobrienPHONY_LIST += packtest packtest_stress 231130561Sobrien 232130561Sobrien################################################################ 233130561Sobrien 234130561Sobrien# Phony targets (e.g. these are not filenames) 235130561Sobrien.PHONY: all clean prep $(PHONY_LIST) 236130561Sobrien 237130561Sobrien################################################################ 238130561Sobrien 239130561Sobrien