annotate test/Makefile @ 560:b79faa366fbd

6799452: HotSpot tests Makefile should take care of ALT_SLASH_JAVA Summary: The HotSpot tests Makefile has a hardcoded SLASH_JAVA which makes it difficult to run the tests on non-Sun build machines which do not have a /java infrastructure. Reviewed-by: kamg
author twisti
date Tue, 03 Feb 2009 08:10:28 -0800
parents 68e0443dfd9c
children 0fbdb4381b99
rev   line source
duke@0 1 #
ohair@328 2 # Copyright 1995-2008 Sun Microsystems, Inc. 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 #
duke@0 19 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@0 20 # CA 95054 USA or visit www.sun.com if you need additional information or
duke@0 21 # have any 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
ohair@328 29 # Get OS/ARCH specifics
duke@0 30 OSNAME = $(shell uname -s)
duke@0 31 ifeq ($(OSNAME), SunOS)
duke@0 32 PLATFORM = solaris
twisti@560 33 SLASH_JAVA = /java
duke@0 34 ARCH = $(shell uname -p)
duke@0 35 ifeq ($(ARCH), i386)
duke@0 36 ARCH=i586
duke@0 37 endif
duke@0 38 endif
duke@0 39 ifeq ($(OSNAME), Linux)
duke@0 40 PLATFORM = linux
twisti@560 41 SLASH_JAVA = /java
duke@0 42 ARCH = $(shell uname -m)
duke@0 43 ifeq ($(ARCH), i386)
ohair@328 44 ARCH = i586
duke@0 45 endif
duke@0 46 endif
duke@0 47 ifeq ($(OSNAME), Windows_NT)
duke@0 48 PLATFORM = windows
ohair@328 49 SLASH_JAVA = J:
duke@0 50 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),ia64)
ohair@328 51 ARCH = ia64
duke@0 52 else
duke@0 53 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),AMD64)
ohair@328 54 ARCH = x64
duke@0 55 else
duke@0 56 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),EM64T)
ohair@328 57 ARCH = x64
duke@0 58 else
ohair@328 59 ARCH = i586
duke@0 60 endif
duke@0 61 endif
duke@0 62 endif
ohair@328 63 EXESUFFIX = .exe
duke@0 64 endif
duke@0 65
twisti@560 66 ifdef ALT_SLASH_JAVA
twisti@560 67 SLASH_JAVA = $(ALT_SLASH_JAVA)
twisti@560 68 endif
twisti@560 69
ohair@328 70 # Utilities used
ohair@328 71 CD = cd
ohair@328 72 CP = cp
ohair@328 73 ECHO = echo
ohair@328 74 MKDIR = mkdir
ohair@328 75 ZIP = zip
duke@0 76
ohair@328 77 # Root of this test area (important to use full paths in some places)
ohair@328 78 TEST_ROOT := $(shell pwd)
ohair@328 79
ohair@328 80 # Root of all test results
ohair@328 81 ABS_BUILD_ROOT = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)
ohair@328 82 ABS_TEST_OUTPUT_DIR = $(ABS_BUILD_ROOT)/testoutput
ohair@328 83
ohair@328 84 # Expect JPRT to set PRODUCT_HOME (the product or jdk in this case to test)
ohair@328 85 ifndef PRODUCT_HOME
ohair@328 86 # Try to use j2sdk-image if it exists
ohair@328 87 ABS_JDK_IMAGE = $(ABS_BUILD_ROOT)/j2sdk-image
ohair@328 88 PRODUCT_HOME := \
ohair@328 89 $(shell \
ohair@328 90 if [ -d $(ABS_JDK_IMAGE) ] ; then \
ohair@328 91 $(ECHO) "$(ABS_JDK_IMAGE)"; \
ohair@328 92 else \
ohair@328 93 $(ECHO) "$(ABS_BUILD_ROOT)" ; \
ohair@328 94 fi)
duke@0 95 endif
duke@0 96
ohair@328 97 # Expect JPRT to set JAVA_ARGS (e.g. -server etc.)
ohair@328 98 JAVA_OPTIONS =
ohair@328 99 ifdef JAVA_ARGS
ohair@328 100 JAVA_OPTIONS = $(JAVA_ARGS)
ohair@328 101 endif
duke@0 102
ohair@328 103 # Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results)
ohair@328 104 ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip
ohair@328 105 ifdef JPRT_ARCHIVE_BUNDLE
ohair@328 106 ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE)
ohair@328 107 endif
duke@0 108
ohair@328 109 # How to create the test bundle (pass or fail, we want to create this)
ohair@328 110 BUNDLE_UP = ( $(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)` \
ohair@328 111 && $(CD) $(ABS_TEST_OUTPUT_DIR) \
ohair@328 112 && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . )
ohair@328 113 BUNDLE_UP_FAILED = ( exitCode=$$? && $(BUNDLE_UP) && exit $${exitCode} )
duke@0 114
ohair@328 115 ################################################################
duke@0 116
ohair@328 117 # Default make rule (runs jtreg_tests)
ohair@328 118 all: jtreg_tests
ohair@328 119 @$(ECHO) "Testing completed successfully"
duke@0 120
ohair@328 121 # Prep for output
ohair@328 122 prep: clean
ohair@328 123 @$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR)
ohair@328 124 @$(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)`
duke@0 125
duke@0 126 # Cleanup
duke@0 127 clean:
ohair@328 128 $(RM) -r $(ABS_TEST_OUTPUT_DIR)
ohair@328 129 $(RM) $(ARCHIVE_BUNDLE)
duke@0 130
ohair@328 131 ################################################################
duke@0 132
ohair@328 133 # jtreg tests
ohair@328 134
ohair@328 135 # Expect JT_HOME to be set for jtreg tests. (home for jtreg)
ohair@328 136 JT_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg
ohair@328 137 ifdef JPRT_JTREG_HOME
ohair@328 138 JT_HOME = $(JPRT_JTREG_HOME)
ohair@328 139 endif
ohair@328 140
ohair@328 141 # Expect JPRT to set TESTDIRS to the jtreg test dirs
ohair@328 142 JTREG_TESTDIRS = demo/jvmti/gctest demo/jvmti/hprof
ohair@328 143 ifdef TESTDIRS
ohair@328 144 JTREG_TESTDIRS = $(TESTDIRS)
ohair@328 145 endif
ohair@328 146
ohair@328 147 # Default JTREG to run (win32 script works for everybody)
ohair@328 148 JTREG = $(JT_HOME)/win32/bin/jtreg
ohair@328 149
ohair@328 150 # Option to tell jtreg to not run tests marked with "ignore"
ohair@328 151 ifeq ($(PLATFORM), windows)
ohair@328 152 JTREG_KEY_OPTION = -k:!ignore
ohair@328 153 else
ohair@328 154 JTREG_KEY_OPTION = -k:\!ignore
ohair@328 155 endif
ohair@328 156
ohair@328 157 #EXTRA_JTREG_OPTIONS =
ohair@328 158
ohair@328 159 jtreg_tests: prep $(JT_HOME) $(PRODUCT_HOME) $(JTREG)
ohair@328 160 $(JTREG) -a -v:fail,error \
ohair@328 161 $(JTREG_KEY_OPTION) \
ohair@328 162 $(EXTRA_JTREG_OPTIONS) \
ohair@328 163 -r:$(ABS_TEST_OUTPUT_DIR)/JTreport \
ohair@328 164 -w:$(ABS_TEST_OUTPUT_DIR)/JTwork \
ohair@328 165 -jdk:$(PRODUCT_HOME) \
ohair@328 166 $(JAVA_OPTIONS:%=-vmoption:%) \
ohair@328 167 $(JTREG_TESTDIRS) \
ohair@328 168 || $(BUNDLE_UP_FAILED)
ohair@328 169 $(BUNDLE_UP)
ohair@328 170
ohair@328 171 PHONY_LIST += jtreg_tests
ohair@328 172
ohair@328 173 ################################################################
ohair@328 174
ohair@328 175 # packtest
ohair@328 176
ohair@328 177 # Expect JPRT to set JPRT_PACKTEST_HOME.
ohair@328 178 PACKTEST_HOME = /net/jprt-web.sfbay.sun.com/jprt/allproducts/packtest
ohair@328 179 ifdef JPRT_PACKTEST_HOME
ohair@328 180 PACKTEST_HOME = $(JPRT_PACKTEST_HOME)
ohair@328 181 endif
ohair@328 182
ohair@328 183 #EXTRA_PACKTEST_OPTIONS =
ohair@328 184
ohair@328 185 packtest: prep $(PACKTEST_HOME)/ptest $(PRODUCT_HOME)
ohair@328 186 ( $(CD) $(PACKTEST_HOME) && \
ohair@328 187 $(PACKTEST_HOME)/ptest \
ohair@328 188 -t "$(PRODUCT_HOME)" \
ohair@328 189 $(PACKTEST_STRESS_OPTION) \
ohair@328 190 $(EXTRA_PACKTEST_OPTIONS) \
ohair@328 191 -W $(ABS_TEST_OUTPUT_DIR) \
ohair@328 192 $(JAVA_OPTIONS:%=-J %) \
ohair@328 193 ) || $(BUNDLE_UP_FAILED)
ohair@328 194 $(BUNDLE_UP)
ohair@328 195
ohair@328 196 packtest_stress: PACKTEST_STRESS_OPTION=-s
ohair@328 197 packtest_stress: packtest
ohair@328 198
ohair@328 199 PHONY_LIST += packtest packtest_stress
ohair@328 200
ohair@328 201 ################################################################
ohair@328 202
ohair@328 203 # Phony targets (e.g. these are not filenames)
ohair@328 204 .PHONY: all clean prep $(PHONY_LIST)
ohair@328 205
ohair@328 206 ################################################################
ohair@328 207