1 # 2 # Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 # 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 7 # published by the Free Software Foundation. 8 # 9 # This code is distributed in the hope that it will be useful, but WITHOUT 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 # version 2 for more details (a copy is included in the LICENSE file that 13 # accompanied this code). 14 # 15 # You should have received a copy of the GNU General Public License version 16 # 2 along with this work; if not, write to the Free Software Foundation, 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 # 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 # or visit www.oracle.com if you need additional information or have any 21 # questions. 22 # 23 # 24 25 # 26 # Makefile to run various jdk tests 27 # 28 29 # Get OS/ARCH specifics 30 OSNAME = $(shell uname -s) 31 ifeq ($(OSNAME), SunOS) 32 PLATFORM = solaris 33 SLASH_JAVA = /java 34 ARCH = $(shell uname -p) 35 ifeq ($(ARCH), i386) 36 ARCH=i586 37 endif 38 endif 39 ifeq ($(OSNAME), Linux) 40 PLATFORM = linux 41 SLASH_JAVA = /java 42 ARCH = $(shell uname -m) 43 ifeq ($(ARCH), i386) 44 ARCH = i586 45 endif 46 endif 47 ifeq ($(OSNAME), Windows_NT) 48 PLATFORM = windows 49 SLASH_JAVA = J: 50 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),ia64) 51 ARCH = ia64 52 else 53 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),AMD64) 54 ARCH = x64 55 else 56 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),EM64T) 57 ARCH = x64 58 else 59 ARCH = i586 60 endif 61 endif 62 endif 63 EXESUFFIX = .exe 64 endif 65 66 ifdef ALT_SLASH_JAVA 67 SLASH_JAVA = $(ALT_SLASH_JAVA) 68 endif 69 70 # Utilities used 71 CD = cd 72 CP = cp 73 ECHO = echo 74 MKDIR = mkdir 75 ZIP = zip 76 77 # Root of this test area (important to use full paths in some places) 78 TEST_ROOT := $(shell pwd) 79 80 # Root of all test results 81 ifdef ALT_OUTPUTDIR 82 ABS_BUILD_ROOT = $(ALT_OUTPUTDIR)/$(PLATFORM)-$(ARCH) 83 else 84 ABS_BUILD_ROOT = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH) 85 endif 86 ABS_TEST_OUTPUT_DIR = $(ABS_BUILD_ROOT)/testoutput 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_BUILD_ROOT)/j2sdk-image 92 PRODUCT_HOME := \ 93 $(shell \ 94 if [ -d $(ABS_JDK_IMAGE) ] ; then \ 95 $(ECHO) "$(ABS_JDK_IMAGE)"; \ 96 else \ 97 $(ECHO) "$(ABS_BUILD_ROOT)" ; \ 98 fi) 99 endif 100 101 # Expect JPRT to set JAVA_ARGS (e.g. -server etc.) 102 JAVA_OPTIONS = 103 ifdef JAVA_ARGS 104 JAVA_OPTIONS = $(JAVA_ARGS) 105 endif 106 107 # Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results) 108 ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip 109 ifdef JPRT_ARCHIVE_BUNDLE 110 ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE) 111 endif 112 113 # How to create the test bundle (pass or fail, we want to create this) 114 BUNDLE_UP = ( $(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)` \ 115 && $(CD) $(ABS_TEST_OUTPUT_DIR) \ 116 && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . ) 117 BUNDLE_UP_FAILED = ( exitCode=$$? && $(BUNDLE_UP) && exit $${exitCode} ) 118 119 ################################################################ 120 121 # Default make rule (runs jtreg_tests) 122 all: jtreg_tests 123 @$(ECHO) "Testing completed successfully" 124 125 # Prep for output 126 prep: clean 127 @$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR) 128 @$(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)` 129 130 # Cleanup 131 clean: 132 $(RM) -r $(ABS_TEST_OUTPUT_DIR) 133 $(RM) $(ARCHIVE_BUNDLE) 134 135 ################################################################ 136 137 # jtreg tests 138 139 # Expect JT_HOME to be set for jtreg tests. (home for jtreg) 140 JT_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg 141 ifdef JPRT_JTREG_HOME 142 JT_HOME = $(JPRT_JTREG_HOME) 143 endif 144 145 # Expect JPRT to set TESTDIRS to the jtreg test dirs 146 JTREG_TESTDIRS = demo/jvmti/gctest demo/jvmti/hprof 147 ifdef TESTDIRS 148 JTREG_TESTDIRS = $(TESTDIRS) 149 endif 150 151 # Default JTREG to run (win32 script works for everybody) 152 JTREG = $(JT_HOME)/win32/bin/jtreg 153 154 # Option to tell jtreg to not run tests marked with "ignore" 155 ifeq ($(PLATFORM), windows) 156 JTREG_KEY_OPTION = -k:!ignore 157 else 158 JTREG_KEY_OPTION = -k:\!ignore 159 endif 160 161 #EXTRA_JTREG_OPTIONS = 162 163 jtreg_tests: prep $(JT_HOME) $(PRODUCT_HOME) $(JTREG) 164 $(JTREG) -a -v:fail,error \ 165 $(JTREG_KEY_OPTION) \ 166 $(EXTRA_JTREG_OPTIONS) \ 167 -r:$(ABS_TEST_OUTPUT_DIR)/JTreport \ 168 -w:$(ABS_TEST_OUTPUT_DIR)/JTwork \ 169 -jdk:$(PRODUCT_HOME) \ 170 $(JAVA_OPTIONS:%=-vmoption:%) \ 171 $(JTREG_TESTDIRS) \ 172 || $(BUNDLE_UP_FAILED) 173 $(BUNDLE_UP) 174 175 PHONY_LIST += jtreg_tests 176 177 ################################################################ 178 179 # clienttest (make sure various basic java client options work) 180 181 clienttest: prep $(PRODUCT_HOME) 182 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version 183 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help 184 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X 185 $(RM) $(PRODUCT_HOME)/jre/lib/*/client/classes.jsa 186 $(RM) $(PRODUCT_HOME)/jre/lib/*/client/classes_g.jsa 187 $(RM) $(PRODUCT_HOME)/jre/bin/client/classes.jsa 188 $(RM) $(PRODUCT_HOME)/jre/bin/client/classes_g.jsa 189 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -Xshare:dump 190 191 PHONY_LIST += clienttest 192 193 ################################################################ 194 195 # servertest (make sure various basic java server options work) 196 197 servertest: prep $(PRODUCT_HOME) 198 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version 199 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help 200 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X 201 202 PHONY_LIST += servertest 203 204 ################################################################ 205 206 # packtest 207 208 # Expect JPRT to set JPRT_PACKTEST_HOME. 209 PACKTEST_HOME = /net/jprt-web.sfbay.sun.com/jprt/allproducts/packtest 210 ifdef JPRT_PACKTEST_HOME 211 PACKTEST_HOME = $(JPRT_PACKTEST_HOME) 212 endif 213 214 #EXTRA_PACKTEST_OPTIONS = 215 216 packtest: prep $(PACKTEST_HOME)/ptest $(PRODUCT_HOME) 217 ( $(CD) $(PACKTEST_HOME) && \ 218 $(PACKTEST_HOME)/ptest \ 219 -t "$(PRODUCT_HOME)" \ 220 $(PACKTEST_STRESS_OPTION) \ 221 $(EXTRA_PACKTEST_OPTIONS) \ 222 -W $(ABS_TEST_OUTPUT_DIR) \ 223 $(JAVA_OPTIONS:%=-J %) \ 224 ) || $(BUNDLE_UP_FAILED) 225 $(BUNDLE_UP) 226 227 packtest_stress: PACKTEST_STRESS_OPTION=-s 228 packtest_stress: packtest 229 230 PHONY_LIST += packtest packtest_stress 231 232 ################################################################ 233 234 # Phony targets (e.g. these are not filenames) 235 .PHONY: all clean prep $(PHONY_LIST) 236 237 ################################################################ 238