annotate test/Makefile @ 3229:0e9e3cecdc81

7152791: wbapi tests fail on cygwin Summary: Detect cygwin prescence when setting up PLATFORM. Translate cygwin style paths before passing them on to jtreg. Reviewed-by: jcoomes, brutisso
author mgerdin
date Wed, 21 Mar 2012 08:34:23 +0100
parents 2d503de963b3
children bf8c2b2c8cfa
rev   line source
duke@0 1 #
mgerdin@3184 2 # Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
duke@0 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 #
duke@0 5 # This code is free software; you can redistribute it and/or modify it
duke@0 6 # under the terms of the GNU General Public License version 2 only, as
duke@0 7 # published by the Free Software Foundation.
duke@0 8 #
duke@0 9 # This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 12 # version 2 for more details (a copy is included in the LICENSE file that
duke@0 13 # accompanied this code).
duke@0 14 #
duke@0 15 # You should have received a copy of the GNU General Public License version
duke@0 16 # 2 along with this work; if not, write to the Free Software Foundation,
duke@0 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 18 #
trims@1472 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1472 20 # or visit www.oracle.com if you need additional information or have any
trims@1472 21 # questions.
ohair@328 22 #
duke@0 23 #
duke@0 24
duke@0 25 #
ohair@328 26 # Makefile to run various jdk tests
duke@0 27 #
duke@0 28
mgerdin@3229 29 GETMIXEDPATH=echo
mgerdin@3229 30
ohair@328 31 # Get OS/ARCH specifics
duke@0 32 OSNAME = $(shell uname -s)
duke@0 33 ifeq ($(OSNAME), SunOS)
duke@0 34 PLATFORM = solaris
twisti@560 35 SLASH_JAVA = /java
duke@0 36 ARCH = $(shell uname -p)
duke@0 37 ifeq ($(ARCH), i386)
duke@0 38 ARCH=i586
duke@0 39 endif
duke@0 40 endif
duke@0 41 ifeq ($(OSNAME), Linux)
duke@0 42 PLATFORM = linux
twisti@560 43 SLASH_JAVA = /java
duke@0 44 ARCH = $(shell uname -m)
duke@0 45 ifeq ($(ARCH), i386)
ohair@328 46 ARCH = i586
duke@0 47 endif
duke@0 48 endif
never@2721 49 ifeq ($(OSNAME), Darwin)
never@2721 50 PLATFORM = bsd
never@2721 51 SLASH_JAVA = /java
never@2721 52 ARCH = $(shell uname -m)
never@2721 53 ifeq ($(ARCH), i386)
never@2721 54 ARCH = i586
never@2721 55 endif
never@2721 56 endif
never@2721 57 ifeq ($(findstring BSD,$(OSNAME)), BSD)
never@2721 58 PLATFORM = bsd
never@2721 59 SLASH_JAVA = /java
never@2721 60 ARCH = $(shell uname -m)
never@2721 61 ifeq ($(ARCH), i386)
never@2721 62 ARCH = i586
never@2721 63 endif
never@2721 64 endif
mgerdin@3229 65 ifeq ($(PLATFORM),)
mgerdin@3229 66 # detect wether we're running in MKS or cygwin
mgerdin@3229 67 ifeq ($(OSNAME), Windows_NT) # MKS
mgerdin@3229 68 GETMIXEDPATH=dosname -s
mgerdin@3229 69 endif
mgerdin@3229 70 ifeq ($(findstring CYGWIN,$(OSNAME)), CYGWIN)
mgerdin@3229 71 GETMIXEDPATH=cygpath -m -s
mgerdin@3229 72 endif
duke@0 73 PLATFORM = windows
ohair@328 74 SLASH_JAVA = J:
duke@0 75 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),ia64)
ohair@328 76 ARCH = ia64
duke@0 77 else
duke@0 78 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),AMD64)
ohair@328 79 ARCH = x64
duke@0 80 else
duke@0 81 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),EM64T)
ohair@328 82 ARCH = x64
duke@0 83 else
ohair@328 84 ARCH = i586
duke@0 85 endif
duke@0 86 endif
duke@0 87 endif
ohair@328 88 EXESUFFIX = .exe
duke@0 89 endif
duke@0 90
twisti@560 91 ifdef ALT_SLASH_JAVA
twisti@560 92 SLASH_JAVA = $(ALT_SLASH_JAVA)
twisti@560 93 endif
twisti@560 94
ohair@328 95 # Utilities used
ohair@328 96 CD = cd
ohair@328 97 CP = cp
ohair@328 98 ECHO = echo
ohair@328 99 MKDIR = mkdir
ohair@328 100 ZIP = zip
duke@0 101
ohair@328 102 # Root of this test area (important to use full paths in some places)
ohair@328 103 TEST_ROOT := $(shell pwd)
ohair@328 104
ohair@328 105 # Root of all test results
twisti@1821 106 ifdef ALT_OUTPUTDIR
twisti@1821 107 ABS_BUILD_ROOT = $(ALT_OUTPUTDIR)/$(PLATFORM)-$(ARCH)
twisti@1821 108 else
twisti@1821 109 ABS_BUILD_ROOT = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)
twisti@1821 110 endif
ohair@328 111 ABS_TEST_OUTPUT_DIR = $(ABS_BUILD_ROOT)/testoutput
ohair@328 112
ohair@328 113 # Expect JPRT to set PRODUCT_HOME (the product or jdk in this case to test)
ohair@328 114 ifndef PRODUCT_HOME
ohair@328 115 # Try to use j2sdk-image if it exists
ohair@328 116 ABS_JDK_IMAGE = $(ABS_BUILD_ROOT)/j2sdk-image
ohair@328 117 PRODUCT_HOME := \
ohair@328 118 $(shell \
ohair@328 119 if [ -d $(ABS_JDK_IMAGE) ] ; then \
ohair@328 120 $(ECHO) "$(ABS_JDK_IMAGE)"; \
ohair@328 121 else \
ohair@328 122 $(ECHO) "$(ABS_BUILD_ROOT)" ; \
ohair@328 123 fi)
duke@0 124 endif
duke@0 125
ohair@328 126 # Expect JPRT to set JAVA_ARGS (e.g. -server etc.)
ohair@328 127 JAVA_OPTIONS =
ohair@328 128 ifdef JAVA_ARGS
ohair@328 129 JAVA_OPTIONS = $(JAVA_ARGS)
ohair@328 130 endif
duke@0 131
ohair@328 132 # Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results)
ohair@328 133 ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip
ohair@328 134 ifdef JPRT_ARCHIVE_BUNDLE
ohair@328 135 ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE)
ohair@328 136 endif
duke@0 137
ohair@328 138 # How to create the test bundle (pass or fail, we want to create this)
ohair@328 139 BUNDLE_UP = ( $(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)` \
ohair@328 140 && $(CD) $(ABS_TEST_OUTPUT_DIR) \
ohair@328 141 && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . )
ohair@328 142 BUNDLE_UP_FAILED = ( exitCode=$$? && $(BUNDLE_UP) && exit $${exitCode} )
duke@0 143
ohair@328 144 ################################################################
duke@0 145
ohair@328 146 # Default make rule (runs jtreg_tests)
ohair@328 147 all: jtreg_tests
ohair@328 148 @$(ECHO) "Testing completed successfully"
duke@0 149
ohair@328 150 # Prep for output
ohair@328 151 prep: clean
ohair@328 152 @$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR)
ohair@328 153 @$(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)`
duke@0 154
duke@0 155 # Cleanup
duke@0 156 clean:
ohair@328 157 $(RM) -r $(ABS_TEST_OUTPUT_DIR)
ohair@328 158 $(RM) $(ARCHIVE_BUNDLE)
duke@0 159
ohair@328 160 ################################################################
duke@0 161
ohair@328 162 # jtreg tests
ohair@328 163
ohair@328 164 # Expect JT_HOME to be set for jtreg tests. (home for jtreg)
ohair@328 165 JT_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg
ohair@328 166 ifdef JPRT_JTREG_HOME
ohair@328 167 JT_HOME = $(JPRT_JTREG_HOME)
ohair@328 168 endif
ohair@328 169
ohair@328 170 # Expect JPRT to set TESTDIRS to the jtreg test dirs
ohair@328 171 JTREG_TESTDIRS = demo/jvmti/gctest demo/jvmti/hprof
ohair@328 172 ifdef TESTDIRS
ohair@328 173 JTREG_TESTDIRS = $(TESTDIRS)
ohair@328 174 endif
ohair@328 175
ohair@328 176 # Default JTREG to run (win32 script works for everybody)
ohair@328 177 JTREG = $(JT_HOME)/win32/bin/jtreg
ohair@328 178
ohair@328 179 # Option to tell jtreg to not run tests marked with "ignore"
ohair@328 180 ifeq ($(PLATFORM), windows)
ohair@328 181 JTREG_KEY_OPTION = -k:!ignore
ohair@328 182 else
ohair@328 183 JTREG_KEY_OPTION = -k:\!ignore
ohair@328 184 endif
ohair@328 185
ohair@328 186 #EXTRA_JTREG_OPTIONS =
ohair@328 187
ohair@328 188 jtreg_tests: prep $(JT_HOME) $(PRODUCT_HOME) $(JTREG)
ohair@328 189 $(JTREG) -a -v:fail,error \
ohair@328 190 $(JTREG_KEY_OPTION) \
ohair@328 191 $(EXTRA_JTREG_OPTIONS) \
ohair@328 192 -r:$(ABS_TEST_OUTPUT_DIR)/JTreport \
ohair@328 193 -w:$(ABS_TEST_OUTPUT_DIR)/JTwork \
ohair@328 194 -jdk:$(PRODUCT_HOME) \
ohair@328 195 $(JAVA_OPTIONS:%=-vmoption:%) \
ohair@328 196 $(JTREG_TESTDIRS) \
ohair@328 197 || $(BUNDLE_UP_FAILED)
ohair@328 198 $(BUNDLE_UP)
ohair@328 199
ohair@328 200 PHONY_LIST += jtreg_tests
ohair@328 201
ohair@328 202 ################################################################
ohair@328 203
ohair@781 204 # clienttest (make sure various basic java client options work)
ohair@781 205
ohair@781 206 clienttest: prep $(PRODUCT_HOME)
ohair@781 207 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version
ohair@781 208 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help
ohair@781 209 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X
ohair@781 210 $(RM) $(PRODUCT_HOME)/jre/lib/*/client/classes.jsa
ohair@781 211 $(RM) $(PRODUCT_HOME)/jre/lib/*/client/classes_g.jsa
ohair@781 212 $(RM) $(PRODUCT_HOME)/jre/bin/client/classes.jsa
ohair@781 213 $(RM) $(PRODUCT_HOME)/jre/bin/client/classes_g.jsa
ohair@781 214 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -Xshare:dump
ohair@781 215
ohair@781 216 PHONY_LIST += clienttest
ohair@781 217
ohair@781 218 ################################################################
ohair@781 219
ohair@781 220 # servertest (make sure various basic java server options work)
ohair@781 221
ohair@781 222 servertest: prep $(PRODUCT_HOME)
ohair@781 223 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version
ohair@781 224 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help
ohair@781 225 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X
ohair@781 226
ohair@781 227 PHONY_LIST += servertest
ohair@781 228
ohair@781 229 ################################################################
ohair@781 230
brutisso@2831 231 # internalvmtests (run internal unit tests inside the VM)
brutisso@2831 232
brutisso@2831 233 internalvmtests: prep $(PRODUCT_HOME)
brutisso@2831 234 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -XX:+ExecuteInternalVMTests -version
brutisso@2831 235
brutisso@2831 236 PHONY_LIST += internalvmtests
brutisso@2831 237
brutisso@2831 238 ################################################################
brutisso@2831 239
mgerdin@3184 240 # wbapitest (make sure the whitebox testing api classes work
mgerdin@3184 241
mgerdin@3184 242 wbapitest: prep $(JT_HOME) $(PRODUCT_HOME) $(JTREG)
mgerdin@3184 243 $(JTREG) -a -v:fail,error \
mgerdin@3184 244 $(JTREG_KEY_OPTION) \
mgerdin@3184 245 $(EXTRA_JTREG_OPTIONS) \
mgerdin@3229 246 -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport \
mgerdin@3229 247 -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork \
mgerdin@3229 248 -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \
mgerdin@3184 249 $(JAVA_OPTIONS:%=-vmoption:%) \
mgerdin@3229 250 $(shell $(GETMIXEDPATH) "$(TEST_ROOT)")/sanity \
mgerdin@3184 251 || $(BUNDLE_UP_FAILED)
mgerdin@3184 252 $(BUNDLE_UP)
mgerdin@3184 253
mgerdin@3184 254 PHONY_LIST += wbapitest
mgerdin@3184 255
mgerdin@3184 256 ################################################################
mgerdin@3184 257
ohair@328 258 # packtest
ohair@328 259
ohair@328 260 # Expect JPRT to set JPRT_PACKTEST_HOME.
ohair@328 261 PACKTEST_HOME = /net/jprt-web.sfbay.sun.com/jprt/allproducts/packtest
ohair@328 262 ifdef JPRT_PACKTEST_HOME
ohair@328 263 PACKTEST_HOME = $(JPRT_PACKTEST_HOME)
ohair@328 264 endif
ohair@328 265
ohair@328 266 #EXTRA_PACKTEST_OPTIONS =
ohair@328 267
ohair@328 268 packtest: prep $(PACKTEST_HOME)/ptest $(PRODUCT_HOME)
ohair@328 269 ( $(CD) $(PACKTEST_HOME) && \
ohair@328 270 $(PACKTEST_HOME)/ptest \
ohair@328 271 -t "$(PRODUCT_HOME)" \
ohair@328 272 $(PACKTEST_STRESS_OPTION) \
ohair@328 273 $(EXTRA_PACKTEST_OPTIONS) \
ohair@328 274 -W $(ABS_TEST_OUTPUT_DIR) \
ohair@328 275 $(JAVA_OPTIONS:%=-J %) \
ohair@328 276 ) || $(BUNDLE_UP_FAILED)
ohair@328 277 $(BUNDLE_UP)
ohair@328 278
ohair@328 279 packtest_stress: PACKTEST_STRESS_OPTION=-s
ohair@328 280 packtest_stress: packtest
ohair@328 281
ohair@328 282 PHONY_LIST += packtest packtest_stress
ohair@328 283
ohair@328 284 ################################################################
ohair@328 285
ohair@328 286 # Phony targets (e.g. these are not filenames)
ohair@328 287 .PHONY: all clean prep $(PHONY_LIST)
ohair@328 288
ohair@328 289 ################################################################
ohair@328 290