0N/A#
525N/A# Makefile to run jtreg and other tests
525N/A#
525N/A
525N/A# Product builds and langtools builds
525N/A#
525N/A# A full product build (or "control" build) creates a complete JDK image.
525N/A# To test a product build, set TESTJAVA to the path for the image.
0N/A#
525N/A# A langtools build just builds the langtools components of a JDK.
525N/A# To test a langtools build, set TESTJAVA to the path for a recent JDK
525N/A# build, and set TESTBOOTCLASSPATH to the compiled langtools classes --
525N/A# for example build/classes or dist/lib/classes.jar.
525N/A
525N/A# JPRT
525N/A# JPRT may invoke this Makefile directly, as part of a langtools build,
525N/A# or indirectly, via FOREST/test/Makefile, as part of a control build.
0N/A
0N/A# Get OS/ARCH specifics
0N/AOSNAME = $(shell uname -s)
0N/Aifeq ($(OSNAME), SunOS)
0N/A PLATFORM = solaris
0N/A JT_PLATFORM = solaris
0N/A ARCH = $(shell uname -p)
0N/A ifeq ($(ARCH), i386)
0N/A ARCH=i586
0N/A endif
0N/Aendif
0N/Aifeq ($(OSNAME), Linux)
0N/A PLATFORM = linux
0N/A JT_PLATFORM = linux
0N/A ARCH = $(shell uname -m)
0N/A ifeq ($(ARCH), i386)
0N/A ARCH=i586
0N/A endif
0N/Aendif
1147N/Aifeq ($(OSNAME), Darwin)
1147N/A PLATFORM = bsd
1147N/A JT_PLATFORM = linux
1147N/A ARCH = $(shell uname -m)
1147N/A ifeq ($(ARCH), i386)
1147N/A ARCH=i586
1147N/A endif
1147N/Aendif
0N/Aifeq ($(OSNAME), Windows_NT)
0N/A PLATFORM = windows
0N/A JT_PLATFORM = win32
0N/A ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),ia64)
0N/A ARCH=ia64
0N/A else
0N/A ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),AMD64)
0N/A ARCH=x64
0N/A else
0N/A ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),EM64T)
0N/A ARCH=x64
0N/A else
0N/A ARCH=i586
0N/A endif
0N/A endif
0N/A endif
564N/A EXE_SUFFIX=.exe
0N/Aendif
0N/A
0N/A# Root of this test area (important to use full paths in some places)
0N/ATEST_ROOT := $(shell pwd)
0N/A
525N/A# Default bundle of all test results (passed or not) (JPRT only)
525N/Aifdef JPRT_JOB_ID
525N/A JPRT_CLEAN = clean
525N/A JPRT_ARCHIVE_BUNDLE = $(TEST_ROOT)/JPRT_ARCHIVE_BUNDLE.zip
525N/Aendif
0N/A
0N/Aifeq ($(PLATFORM), windows)
0N/A SLASH_JAVA = J:
0N/Aelse
0N/A SLASH_JAVA = /java
0N/Aendif
0N/A
0N/A# Default JTREG to run
396N/Aifdef JPRT_JTREG_HOME
396N/A JTREG_HOME = $(JPRT_JTREG_HOME)
396N/Aelse
396N/A JTREG_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg
396N/Aendif
396N/AJTREG = $(JTREG_HOME)/$(JT_PLATFORM)/bin/jtreg
525N/AJTDIFF = $(JTREG_HOME)/$(JT_PLATFORM)/bin/jtdiff
0N/A
525N/A# Default JCK to run
525N/Aifdef JPRT_JCK_HOME
525N/A JCK_HOME = $(JPRT_JCK_HOME)
525N/Aelse
525N/A JCK_HOME = $(SLASH_JAVA)/re/jck/7/promoted/latest/binaries
525N/Aendif
525N/A
525N/A# Default JDK for JTREG and JCK
525N/A#
525N/A# JT_JAVA is the version of java used to run jtreg/JCK. Since it is now
525N/A# standard to execute tests in sameVM mode, it should normally be set the
525N/A# same as TESTJAVA (although not necessarily so.)
525N/A#
0N/Aifdef JPRT_JAVA_HOME
0N/A JT_JAVA = $(JPRT_JAVA_HOME)
0N/Aelse
0N/A JT_JAVA = $(SLASH_JAVA)/re/jdk/1.6.0/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
0N/Aendif
0N/A
0N/A# Default JDK to test
396N/Aifdef JPRT_IMPORT_PRODUCT_HOME
396N/A TESTJAVA = $(JPRT_IMPORT_PRODUCT_HOME)
396N/Aelse
396N/A TESTJAVA = $(SLASH_JAVA)/re/jdk/1.7.0/promoted/latest/binaries/$(PLATFORM)-$(ARCH)
396N/Aendif
396N/A
525N/A# PRODUCT_HOME is a JPRT variable pointing to a directory containing the output from
525N/A# make/Makefile
525N/A# For langtools, this is a directory containing build and dist
564N/A# For a control build, this is build/$(PRODUCT)-$(ARCH)/XYZ-image
564N/A# (i.e, j2sdk-image or jdk-module-image)
525N/Aifdef PRODUCT_HOME
525N/A ifeq ($(shell [ -r $(PRODUCT_HOME)/dist/lib/classes.jar ]; echo $$?),0)
525N/A TESTBOOTCLASSPATH = $(PRODUCT_HOME)/dist/lib/classes.jar
525N/A endif
564N/A ifeq ($(shell [ -r $(PRODUCT_HOME)/bin/javac$(EXE_SUFFIX) ]; echo $$?),0)
525N/A TESTJAVA = $(PRODUCT_HOME)
525N/A endif
525N/Aendif
525N/A
525N/Aifdef TESTBOOTCLASSPATH
525N/A JTREG_OPTIONS += -Xbootclasspath/p:$(TESTBOOTCLASSPATH)
525N/A### In the following, -refvmoptions is an undocumented option
525N/A### The following does not work JCK 7 b30 2/6/2010. Awaiting b31.
525N/A JCK_OPTIONS += \
525N/A -vmoptions:-Xbootclasspath/p:$(TESTBOOTCLASSPATH) \
525N/A -refvmoptions:-Xbootclasspath/p:$(TESTBOOTCLASSPATH)
525N/Aendif
525N/A
525N/A# Concurrency is the number of tests that can execute at once.
525N/A# Supported for JCK, not supported for jtreg.
525N/A# On an otherwise empty machine, suggest setting to (#cpus + 2)
525N/A# If unset, the default is (#cpus)
525N/A### RFE: determine and use #cpus
525N/Aifdef JCK_CONCURRENCY
525N/A JCK_OPTIONS += -concurrency:$(JCK_CONCURRENCY)
525N/Aendif
525N/A
525N/A# JCK is executed using "Multi-JVM Group Mode", which is a hybrid
525N/A# of otherVM and sameVM modes. New JVMs are created and reused for
525N/A# a number of tests, then eventually discarded and a new one started.
525N/A# This amortizes the JVM startup time. The "group size" defines
525N/A# how many tests are run in a JVM before it is replaced.
525N/A# If unset, the default is 100.
525N/AJCK_GROUP_SIZE = 1000
525N/Aifdef JCK_GROUP_SIZE
525N/A JCK_COMPILER_OPTIONS += \
525N/A -jtoptions:-Ejck.env.compiler.testCompile.groupMode.groupSize=$(JCK_GROUP_SIZE) \
525N/A -jtoptions:-Ejck.env.compiler.compRefExecute.groupMode.groupSize=$(JCK_GROUP_SIZE)
525N/A### The following is not supported. Awaiting RFE 6924287
525N/A### 6924287: Jck4Jdk: Allow to configure test group size for group mode via simple command line option
525N/A### JCK_RUNTIME_OPTIONS += \
525N/A### -jtoptions:-Ejck.env.runtime.testCompile.groupMode.groupSize=$(JCK_GROUP_SIZE)
525N/Aendif
525N/A
559N/A# Timeouts -- by default, increase test timeouts when running on JPRT
559N/Aifdef JPRT_JOB_ID
559N/A ifndef JTREG_TIMEOUT_FACTOR
559N/A JTREG_TIMEOUT_FACTOR = 3
559N/A endif
559N/Aendif
559N/Aifdef JTREG_TIMEOUT_FACTOR
559N/A JTREG_OPTIONS += -timeoutFactor:$(JTREG_TIMEOUT_FACTOR)
559N/Aendif
559N/A
525N/A# Assertions: some tests show failures when assertions are enabled.
525N/A# Since javac is typically loaded via the bootclassloader (either via TESTJAVA
525N/A# or TESTBOOTCLASSPATH), you may need -esa to enable assertions in javac.
525N/AJTREG_OPTIONS += $(ASSERTION_OPTIONS)
525N/AJCK_OPTIONS += $(ASSERTION_OPTIONS:%=-vmoptions:%)
525N/A
525N/A# Include shared options
525N/AJCK_COMPILER_OPTIONS += $(JCK_OPTIONS)
525N/AJCK_RUNTIME_OPTIONS += $(JCK_OPTIONS)
525N/A
525N/A# Exit codes:
525N/A# jtreg, jck: 0: OK, 1: tests failed, 2: tests error; 3+: SERIOUS
525N/AFATAL_JTREG_EXIT = 3
525N/AFATAL_JCK_EXIT = 3
525N/A# jtdiff: 0: OK, 1: differences found; 2+: SERIOUS
525N/AFATAL_JTDIFF_EXIT = 2
525N/A#
525N/A# Exit -- used for final "normal" exit from "make". Redefine to "true" to avoid
525N/A# having make exit with non-zero return code.
525N/AEXIT = exit
525N/A# Function to exit shell if exit code of preceding command is greater than or equal
525N/A# to a given level. Redefine function or preceding FATAL_*_EXIT codes as needed.
525N/AEXIT_IF_FATAL = status=$$?; if [ $$status -ge $(1) ]; then exit $$status ; fi
0N/A
0N/A# The test directories to run
0N/ADEFAULT_TESTDIRS = .
0N/ATESTDIRS = $(DEFAULT_TESTDIRS)
0N/A
0N/A# Root of all test results
525N/ATEST_OUTPUT_DIR = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools
525N/AABS_TEST_OUTPUT_DIR := \
525N/A $(shell mkdir -p $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools; \
525N/A cd $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools; \
525N/A pwd )
525N/A# Subdirectories for different test runs
525N/AJTREG_OUTPUT_DIR = $(ABS_TEST_OUTPUT_DIR)/jtreg
525N/AJCK_COMPILER_OUTPUT_DIR = $(ABS_TEST_OUTPUT_DIR)/jck-compiler
525N/AJCK_RUNTIME_OUTPUT_DIR = $(ABS_TEST_OUTPUT_DIR)/jck-runtime-Xcompile
0N/A
525N/A# Default make rule -- warning, may take a while
525N/Aall: $(JPRT_CLEAN) jtreg-tests jck-compiler-tests jck-runtime-tests $(JPRT_ARCHIVE_BUNDLE) all-summary
525N/A @echo "Testing completed successfully"
525N/A
525N/Ajtreg apt javac javadoc javah javap: $(JPRT_CLEAN) jtreg-tests $(JPRT_ARCHIVE_BUNDLE) jtreg-summary
525N/A @echo "Testing completed successfully"
525N/A
525N/Ajck-compiler: $(JPRT_CLEAN) jck-compiler-tests $(JPRT_ARCHIVE_BUNDLE) jck-compiler-summary
525N/A @echo "Testing completed successfully"
525N/A
525N/Ajck-runtime: $(JPRT_CLEAN) jck-runtime-tests $(JPRT_ARCHIVE_BUNDLE) jck-runtime-summary
0N/A @echo "Testing completed successfully"
0N/A
0N/A# for use with JPRT -testrule
525N/Aall: JTREG_TESTDIRS = .
525N/Ajtreg: JTREG_TESTDIRS = .
525N/Aapt: JTREG_TESTDIRS = tools/apt
525N/Ajavac: JTREG_TESTDIRS = tools/javac
525N/Ajavadoc: JTREG_TESTDIRS = tools/javadoc com/sun/javadoc
525N/Ajavah: JTREG_TESTDIRS = tools/javah
525N/Ajavap: JTREG_TESTDIRS = tools/javap
525N/A
525N/A# Run jtreg tests
525N/A#
525N/A# JTREG_HOME
525N/A# Installed location of jtreg
525N/A# JT_JAVA
525N/A# Version of java used to run jtreg. Should normally be the same as TESTJAVA
525N/A# TESTJAVA
525N/A# Version of java to be tested.
525N/A# JTREG_OPTIONS
525N/A# Additional options for jtreg
525N/A# JTREG_TESTDIRS
525N/A# Directories of tests to be run
525N/A# JTREG_OUTPUT_DIR
525N/A# Where to write the results
525N/A# JTREG_REFERENCE
525N/A# (Optional) reference results (e.g. work, report or summary.txt)
525N/A#
1147N/Ajtreg_tests: jtreg-tests
525N/Ajtreg-tests: check-jtreg FRC
525N/A @rm -f -r $(JTREG_OUTPUT_DIR)/JTwork $(JTREG_OUTPUT_DIR)/JTreport \
525N/A $(JTREG_OUTPUT_DIR)/diff.html $(JTREG_OUTPUT_DIR)/status.txt
525N/A @mkdir -p $(JTREG_OUTPUT_DIR)
525N/A JT_JAVA=$(JT_JAVA) $(JTREG) \
525N/A -J-Xmx512m \
525N/A -a -samevm -ignore:quiet -v:fail,error,nopass \
525N/A -r:$(JTREG_OUTPUT_DIR)/JTreport \
525N/A -w:$(JTREG_OUTPUT_DIR)/JTwork \
525N/A -jdk:$(TESTJAVA) \
525N/A $(JAVA_ARGS:%=-vmoption:%) \
525N/A $(JTREG_OPTIONS) \
525N/A $(JTREG_TESTDIRS) \
525N/A || ( $(call EXIT_IF_FATAL,$(FATAL_JTREG_EXIT)) ; \
525N/A echo $$status > $(JTREG_OUTPUT_DIR)/status.txt \
525N/A )
525N/Aifdef JTREG_REFERENCE
525N/A JT_JAVA=$(JT_JAVA) $(JTDIFF) -o $(JTREG_OUTPUT_DIR)/diff.html \
525N/A $(JTREG_REFERENCE) $(JTREG_OUTPUT_DIR)/JTreport \
525N/A || ( $(call EXIT_IF_FATAL,$(FATAL_JTDIFF_EXIT)) )
525N/Aendif
525N/A
525N/Ajtreg-summary: FRC
525N/A if [ -r $(JTREG_OUTPUT_DIR)/status.txt ]; then \
525N/A echo ; echo "Summary of jtreg test failures" ; \
525N/A cat $(JTREG_OUTPUT_DIR)/JTreport/text/summary.txt | \
525N/A grep -v 'Not run' | grep -v 'Passed' ; \
525N/A echo ; \
525N/A $(EXIT) `cat $(JTREG_OUTPUT_DIR)/status.txt` ; \
525N/A fi
0N/A
0N/A# Check to make sure these directories exist
525N/Acheck-jtreg: $(JT_HOME) $(PRODUCT_HOME) $(JTREG)
525N/A
525N/A
525N/A# Run JCK-compiler tests
525N/A#
525N/A# JCK_HOME
525N/A# Installed location of JCK: should include JCK-compiler, and JCK-extras
525N/A# JT_JAVA
525N/A# Version of java used to run JCK. Should normally be the same as TESTJAVA
525N/A# TESTJAVA
525N/A# Version of java to be tested.
525N/A# JCK_COMPILER_OPTIONS
525N/A# Additional options for JCK-compiler
525N/A# JCK_COMPILER_TESTDIRS
525N/A# Directories of tests to be run
525N/A# JCK_COMPILER_OUTPUT_DIR
525N/A# Where to write the results
525N/A# JCK_COMPILER_REFERENCE
525N/A# (Optional) reference results (e.g. work, report or summary.txt)
525N/A#
525N/Ajck-compiler-tests: check-jck FRC
525N/A @rm -f -r $(JCK_COMPILER_OUTPUT_DIR)/work $(JCK_COMPILER_OUTPUT_DIR)/report \
525N/A $(JCK_COMPILER_OUTPUT_DIR)/diff.html $(JCK_COMPILER_OUTPUT_DIR)/status.txt
525N/A @mkdir -p $(JCK_COMPILER_OUTPUT_DIR)
525N/A $(JT_JAVA)/bin/java -XX:MaxPermSize=256m -Xmx512m \
525N/A -jar $(JCK_HOME)/JCK-compiler-7/lib/jtjck.jar \
525N/A -v:non-pass \
525N/A -r:$(JCK_COMPILER_OUTPUT_DIR)/report \
525N/A -w:$(JCK_COMPILER_OUTPUT_DIR)/work \
525N/A -jdk:$(TESTJAVA) \
525N/A $(JCK_COMPILER_OPTIONS) \
525N/A $(JCK_COMPILER_TESTDIRS) \
525N/A || ( $(call EXIT_IF_FATAL,$(FATAL_JCK_EXIT)) ; \
525N/A echo $$status > $(JCK_COMPILER_OUTPUT_DIR)/status.txt \
525N/A )
525N/Aifdef JCK_COMPILER_REFERENCE
525N/A JT_JAVA=$(JT_JAVA) $(JTDIFF) -o $(JCK_COMPILER_OUTPUT_DIR)/diff.html \
525N/A $(JCK_COMPILER_REFERENCE) $(JCK_COMPILER_OUTPUT_DIR)/report \
525N/A || ( $(call EXIT_IF_FATAL,$(FATAL_JTDIFF_EXIT)) )
525N/Aendif
525N/A
525N/Ajck-compiler-summary: FRC
525N/A if [ -r $(JCK_COMPILER_OUTPUT_DIR)/status.txt ]; then \
525N/A echo ; echo "Summary of JCK-compiler test failures" ; \
525N/A cat $(JCK_COMPILER_OUTPUT_DIR)/report/text/summary.txt | \
525N/A grep -v 'Not run' | grep -v 'Passed' ; \
525N/A echo ; \
525N/A $(EXIT) `cat $(JCK_COMPILER_OUTPUT_DIR)/status.txt` ; \
525N/A fi
0N/A
525N/A# Run JCK-runtime tests in -Xcompile mode
525N/A# This is a special mode to test javac by compiling the tests in the JCK-runtime test suite
525N/A# Normal JCK-runtime invocation belongs in the jdk/ repository.
525N/A#
525N/A# JCK_HOME
525N/A# Installed location of JCK: should include JCK-compiler, JCK-runtime and JCK-extras
525N/A# JT_JAVA
525N/A# Version of java used to run JCK. Should normally be the same as TESTJAVA
525N/A# TESTJAVA
525N/A# Version of java to be tested.
525N/A# JCK_RUNTIME_OPTIONS
525N/A# Additional options for JCK-runtime
525N/A# JCK_RUNTIME_TESTDIRS
525N/A# Directories of tests to be run
525N/A# JCK_RUNTIME_OUTPUT_DIR
525N/A# Where to write the results
525N/A# JCK_RUNTIME_REFERENCE
525N/A# (Optional) reference results (e.g. work, report or summary.txt)
525N/A#
525N/Ajck-runtime-tests: check-jck FRC
525N/A @rm -f -r $(JCK_RUNTIME_OUTPUT_DIR)/work $(JCK_RUNTIME_OUTPUT_DIR)/report \
525N/A $(JCK_RUNTIME_OUTPUT_DIR)/diff.html $(JCK_RUNTIME_OUTPUT_DIR)/status.txt
525N/A @mkdir -p $(JCK_RUNTIME_OUTPUT_DIR)
525N/A $(JT_JAVA)/bin/java -XX:MaxPermSize=256m -Xmx512m \
525N/A -jar $(JCK_HOME)/JCK-runtime-7/lib/jtjck.jar \
525N/A -v:non-pass \
525N/A -r:$(JCK_RUNTIME_OUTPUT_DIR)/report \
525N/A -w:$(JCK_RUNTIME_OUTPUT_DIR)/work \
525N/A -jdk:$(TESTJAVA) \
525N/A -Xcompile \
525N/A $(JCK_RUNTIME_OPTIONS) \
525N/A $(JCK_RUNTIME_TESTDIRS) \
525N/A || ( $(call EXIT_IF_FATAL,$(FATAL_JCK_EXIT)) ; \
525N/A echo $$status > $(JCK_RUNTIME_OUTPUT_DIR)/status.txt \
525N/A )
525N/Aifdef JCK_RUNTIME_REFERENCE
525N/A JT_JAVA=$(JT_JAVA) $(JTDIFF) -o $(JCK_RUNTIME_OUTPUT_DIR)/diff.html \
525N/A $(JCK_RUNTIME_REFERENCE) $(JCK_RUNTIME_OUTPUT_DIR)/report \
525N/A || ( $(call EXIT_IF_FATAL,$(FATAL_JTDIFF_EXIT)) )
525N/Aendif
525N/A
525N/Ajck-runtime-summary: FRC
525N/A if [ -r $(JCK_RUNTIME_OUTPUT_DIR)/status.txt ]; then \
525N/A echo ; echo "Summary of JCK-runtime test failures" ; \
525N/A cat $(JCK_RUNTIME_OUTPUT_DIR)/report/text/summary.txt | \
525N/A grep -v 'Not run' | grep -v 'Passed' ; \
525N/A echo ; \
525N/A $(EXIT) `cat $(JCK_RUNTIME_OUTPUT_DIR)/status.txt` ; \
525N/A fi
525N/A
525N/A# Check to make sure these directories exist
525N/Acheck-jck: $(JT_HOME) $(JCK_HOME) $(PRODUCT_HOME)
525N/A
525N/Aall-summary: FRC
525N/A if [ -n "`find $(TEST_OUTPUT_DIR) -name status.txt`" ]; then
525N/A echo ; echo "Summary of test failures" ; \
525N/A cat `find $(TEST_OUTPUT_DIR) -name summary.txt` | \
525N/A grep -v 'Not run' | grep -v 'Passed' ; \
525N/A echo ; \
525N/A $(EXIT) 1
525N/A fi
0N/A
0N/A# Bundle up the results
0N/A$(JPRT_ARCHIVE_BUNDLE): FRC
0N/A @rm -f $@
0N/A @mkdir -p $(@D)
0N/A ( cd $(TEST_OUTPUT_DIR) && zip -q -r $@ . )
0N/A
0N/A# Cleanup
0N/Aclean:
0N/A rm -f $(JPRT_ARCHIVE_BUNDLE)
0N/A
0N/A# Used to force a target rules to run
0N/AFRC:
0N/A
0N/A# Phony targets (e.g. these are not filenames)
525N/A.PHONY: all clean \
525N/A jtreg javac javadoc javah javap jtreg-tests jtreg-summary check-jtreg \
525N/A jck-compiler jck-compiler-tests jck-compiler-summary \
525N/A jck-runtime jck-runtime-tests jck-runtime-summary check-jck
0N/A
525N/A# No use of suffix rules
525N/A.SUFFIXES:
525N/A