annotate test/Makefile @ 328:68e0443dfd9c

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