duke@435: # xdono@1014: # Copyright 1995-2009 Sun Microsystems, Inc. All Rights Reserved. duke@435: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: # duke@435: # This code is free software; you can redistribute it and/or modify it duke@435: # under the terms of the GNU General Public License version 2 only, as duke@435: # published by the Free Software Foundation. duke@435: # duke@435: # This code is distributed in the hope that it will be useful, but WITHOUT duke@435: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: # version 2 for more details (a copy is included in the LICENSE file that duke@435: # accompanied this code). duke@435: # duke@435: # You should have received a copy of the GNU General Public License version duke@435: # 2 along with this work; if not, write to the Free Software Foundation, duke@435: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: # duke@435: # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, duke@435: # CA 95054 USA or visit www.sun.com if you need additional information or duke@435: # have any questions. ohair@763: # duke@435: # duke@435: duke@435: # ohair@763: # Makefile to run various jdk tests duke@435: # duke@435: ohair@763: # Get OS/ARCH specifics duke@435: OSNAME = $(shell uname -s) duke@435: ifeq ($(OSNAME), SunOS) duke@435: PLATFORM = solaris twisti@995: SLASH_JAVA = /java duke@435: ARCH = $(shell uname -p) duke@435: ifeq ($(ARCH), i386) duke@435: ARCH=i586 duke@435: endif duke@435: endif duke@435: ifeq ($(OSNAME), Linux) duke@435: PLATFORM = linux twisti@995: SLASH_JAVA = /java duke@435: ARCH = $(shell uname -m) duke@435: ifeq ($(ARCH), i386) ohair@763: ARCH = i586 duke@435: endif duke@435: endif duke@435: ifeq ($(OSNAME), Windows_NT) duke@435: PLATFORM = windows ohair@763: SLASH_JAVA = J: duke@435: ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),ia64) ohair@763: ARCH = ia64 duke@435: else duke@435: ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),AMD64) ohair@763: ARCH = x64 duke@435: else duke@435: ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),EM64T) ohair@763: ARCH = x64 duke@435: else ohair@763: ARCH = i586 duke@435: endif duke@435: endif duke@435: endif ohair@763: EXESUFFIX = .exe duke@435: endif duke@435: twisti@995: ifdef ALT_SLASH_JAVA twisti@995: SLASH_JAVA = $(ALT_SLASH_JAVA) twisti@995: endif twisti@995: ohair@763: # Utilities used ohair@763: CD = cd ohair@763: CP = cp ohair@763: ECHO = echo ohair@763: MKDIR = mkdir ohair@763: ZIP = zip duke@435: ohair@763: # Root of this test area (important to use full paths in some places) ohair@763: TEST_ROOT := $(shell pwd) ohair@763: ohair@763: # Root of all test results ohair@763: ABS_BUILD_ROOT = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH) ohair@763: ABS_TEST_OUTPUT_DIR = $(ABS_BUILD_ROOT)/testoutput ohair@763: ohair@763: # Expect JPRT to set PRODUCT_HOME (the product or jdk in this case to test) ohair@763: ifndef PRODUCT_HOME ohair@763: # Try to use j2sdk-image if it exists ohair@763: ABS_JDK_IMAGE = $(ABS_BUILD_ROOT)/j2sdk-image ohair@763: PRODUCT_HOME := \ ohair@763: $(shell \ ohair@763: if [ -d $(ABS_JDK_IMAGE) ] ; then \ ohair@763: $(ECHO) "$(ABS_JDK_IMAGE)"; \ ohair@763: else \ ohair@763: $(ECHO) "$(ABS_BUILD_ROOT)" ; \ ohair@763: fi) duke@435: endif duke@435: ohair@763: # Expect JPRT to set JAVA_ARGS (e.g. -server etc.) ohair@763: JAVA_OPTIONS = ohair@763: ifdef JAVA_ARGS ohair@763: JAVA_OPTIONS = $(JAVA_ARGS) ohair@763: endif duke@435: ohair@763: # Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results) ohair@763: ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip ohair@763: ifdef JPRT_ARCHIVE_BUNDLE ohair@763: ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE) ohair@763: endif duke@435: ohair@763: # How to create the test bundle (pass or fail, we want to create this) ohair@763: BUNDLE_UP = ( $(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)` \ ohair@763: && $(CD) $(ABS_TEST_OUTPUT_DIR) \ ohair@763: && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . ) ohair@763: BUNDLE_UP_FAILED = ( exitCode=$$? && $(BUNDLE_UP) && exit $${exitCode} ) duke@435: ohair@763: ################################################################ duke@435: ohair@763: # Default make rule (runs jtreg_tests) ohair@763: all: jtreg_tests ohair@763: @$(ECHO) "Testing completed successfully" duke@435: ohair@763: # Prep for output ohair@763: prep: clean ohair@763: @$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR) ohair@763: @$(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)` duke@435: duke@435: # Cleanup duke@435: clean: ohair@763: $(RM) -r $(ABS_TEST_OUTPUT_DIR) ohair@763: $(RM) $(ARCHIVE_BUNDLE) duke@435: ohair@763: ################################################################ duke@435: ohair@763: # jtreg tests ohair@763: ohair@763: # Expect JT_HOME to be set for jtreg tests. (home for jtreg) ohair@763: JT_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg ohair@763: ifdef JPRT_JTREG_HOME ohair@763: JT_HOME = $(JPRT_JTREG_HOME) ohair@763: endif ohair@763: ohair@763: # Expect JPRT to set TESTDIRS to the jtreg test dirs ohair@763: JTREG_TESTDIRS = demo/jvmti/gctest demo/jvmti/hprof ohair@763: ifdef TESTDIRS ohair@763: JTREG_TESTDIRS = $(TESTDIRS) ohair@763: endif ohair@763: ohair@763: # Default JTREG to run (win32 script works for everybody) ohair@763: JTREG = $(JT_HOME)/win32/bin/jtreg ohair@763: ohair@763: # Option to tell jtreg to not run tests marked with "ignore" ohair@763: ifeq ($(PLATFORM), windows) ohair@763: JTREG_KEY_OPTION = -k:!ignore ohair@763: else ohair@763: JTREG_KEY_OPTION = -k:\!ignore ohair@763: endif ohair@763: ohair@763: #EXTRA_JTREG_OPTIONS = ohair@763: ohair@763: jtreg_tests: prep $(JT_HOME) $(PRODUCT_HOME) $(JTREG) ohair@763: $(JTREG) -a -v:fail,error \ ohair@763: $(JTREG_KEY_OPTION) \ ohair@763: $(EXTRA_JTREG_OPTIONS) \ ohair@763: -r:$(ABS_TEST_OUTPUT_DIR)/JTreport \ ohair@763: -w:$(ABS_TEST_OUTPUT_DIR)/JTwork \ ohair@763: -jdk:$(PRODUCT_HOME) \ ohair@763: $(JAVA_OPTIONS:%=-vmoption:%) \ ohair@763: $(JTREG_TESTDIRS) \ ohair@763: || $(BUNDLE_UP_FAILED) ohair@763: $(BUNDLE_UP) ohair@763: ohair@763: PHONY_LIST += jtreg_tests ohair@763: ohair@763: ################################################################ ohair@763: ohair@1216: # clienttest (make sure various basic java client options work) ohair@1216: ohair@1216: clienttest: prep $(PRODUCT_HOME) ohair@1216: $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version ohair@1216: $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help ohair@1216: $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X ohair@1216: $(RM) $(PRODUCT_HOME)/jre/lib/*/client/classes.jsa ohair@1216: $(RM) $(PRODUCT_HOME)/jre/lib/*/client/classes_g.jsa ohair@1216: $(RM) $(PRODUCT_HOME)/jre/bin/client/classes.jsa ohair@1216: $(RM) $(PRODUCT_HOME)/jre/bin/client/classes_g.jsa ohair@1216: $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -Xshare:dump ohair@1216: ohair@1216: PHONY_LIST += clienttest ohair@1216: ohair@1216: ################################################################ ohair@1216: ohair@1216: # servertest (make sure various basic java server options work) ohair@1216: ohair@1216: servertest: prep $(PRODUCT_HOME) ohair@1216: $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version ohair@1216: $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help ohair@1216: $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X ohair@1216: ohair@1216: PHONY_LIST += servertest ohair@1216: ohair@1216: ################################################################ ohair@1216: ohair@763: # packtest ohair@763: ohair@763: # Expect JPRT to set JPRT_PACKTEST_HOME. ohair@763: PACKTEST_HOME = /net/jprt-web.sfbay.sun.com/jprt/allproducts/packtest ohair@763: ifdef JPRT_PACKTEST_HOME ohair@763: PACKTEST_HOME = $(JPRT_PACKTEST_HOME) ohair@763: endif ohair@763: ohair@763: #EXTRA_PACKTEST_OPTIONS = ohair@763: ohair@763: packtest: prep $(PACKTEST_HOME)/ptest $(PRODUCT_HOME) ohair@763: ( $(CD) $(PACKTEST_HOME) && \ ohair@763: $(PACKTEST_HOME)/ptest \ ohair@763: -t "$(PRODUCT_HOME)" \ ohair@763: $(PACKTEST_STRESS_OPTION) \ ohair@763: $(EXTRA_PACKTEST_OPTIONS) \ ohair@763: -W $(ABS_TEST_OUTPUT_DIR) \ ohair@763: $(JAVA_OPTIONS:%=-J %) \ ohair@763: ) || $(BUNDLE_UP_FAILED) ohair@763: $(BUNDLE_UP) ohair@763: ohair@763: packtest_stress: PACKTEST_STRESS_OPTION=-s ohair@763: packtest_stress: packtest ohair@763: ohair@763: PHONY_LIST += packtest packtest_stress ohair@763: ohair@763: ################################################################ ohair@763: ohair@763: # Phony targets (e.g. these are not filenames) ohair@763: .PHONY: all clean prep $(PHONY_LIST) ohair@763: ohair@763: ################################################################ ohair@763: