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