duke@435: # mikael@6198: # Copyright (c) 1995, 2013, Oracle and/or its affiliates. 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: # trims@1907: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA trims@1907: # or visit www.oracle.com if you need additional information or have any trims@1907: # questions. ohair@763: # duke@435: # duke@435: duke@435: # ohair@763: # Makefile to run various jdk tests duke@435: # duke@435: mgerdin@3664: GETMIXEDPATH=echo mgerdin@3664: 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 never@3156: ifeq ($(OSNAME), Darwin) never@3156: PLATFORM = bsd never@3156: SLASH_JAVA = /java never@3156: ARCH = $(shell uname -m) never@3156: ifeq ($(ARCH), i386) never@3156: ARCH = i586 never@3156: endif never@3156: endif never@3156: ifeq ($(findstring BSD,$(OSNAME)), BSD) never@3156: PLATFORM = bsd never@3156: SLASH_JAVA = /java never@3156: ARCH = $(shell uname -m) never@3156: ifeq ($(ARCH), i386) never@3156: ARCH = i586 never@3156: endif never@3156: endif mgerdin@3664: ifeq ($(PLATFORM),) mgerdin@3664: # detect wether we're running in MKS or cygwin mgerdin@3664: ifeq ($(OSNAME), Windows_NT) # MKS mgerdin@3664: GETMIXEDPATH=dosname -s mgerdin@3664: endif mgerdin@3664: ifeq ($(findstring CYGWIN,$(OSNAME)), CYGWIN) mgerdin@3664: GETMIXEDPATH=cygpath -m -s mgerdin@3664: endif 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 twisti@2256: ifdef ALT_OUTPUTDIR twisti@2256: ABS_BUILD_ROOT = $(ALT_OUTPUTDIR)/$(PLATFORM)-$(ARCH) twisti@2256: else twisti@2256: ABS_BUILD_ROOT = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH) twisti@2256: endif 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: mikael@6916: # Support "hotspot_" prefixed test make targets too mikael@6916: # The hotspot_% targets are for example invoked by the top level Makefile mikael@6916: hotspot_%: mikael@6916: $(MAKE) $* mikael@6916: 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) twisti@4941: ifndef JT_HOME twisti@4941: JT_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg twisti@4941: endif 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) \ mgerdin@4476: -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport \ mgerdin@4476: -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork \ mgerdin@4476: -jdk:$(shell $(GETMIXEDPATH) "$(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/bin/client/classes.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: brutisso@3266: # internalvmtests (run internal unit tests inside the VM) brutisso@3266: brutisso@3266: internalvmtests: prep $(PRODUCT_HOME) brutisso@3266: $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -XX:+ExecuteInternalVMTests -version brutisso@3266: brutisso@3266: PHONY_LIST += internalvmtests brutisso@3266: brutisso@3266: ################################################################ brutisso@3266: mgerdin@3619: # wbapitest (make sure the whitebox testing api classes work mgerdin@3619: mgerdin@3619: wbapitest: prep $(JT_HOME) $(PRODUCT_HOME) $(JTREG) mgerdin@3619: $(JTREG) -a -v:fail,error \ mgerdin@3619: $(JTREG_KEY_OPTION) \ mgerdin@3619: $(EXTRA_JTREG_OPTIONS) \ mgerdin@3664: -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport \ mgerdin@3664: -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork \ mgerdin@3664: -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \ mgerdin@3619: $(JAVA_OPTIONS:%=-vmoption:%) \ mgerdin@3664: $(shell $(GETMIXEDPATH) "$(TEST_ROOT)")/sanity \ mgerdin@3619: || $(BUNDLE_UP_FAILED) mgerdin@3619: $(BUNDLE_UP) mgerdin@3619: mgerdin@3619: PHONY_LIST += wbapitest mgerdin@3619: mgerdin@3619: ################################################################ mgerdin@3619: 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: