jdk/test/Makefile
Print this page
rev 8663 : 8020779: Improve detection and handling of jtreg executable path
8026988: Makefile is confused if JT_HOME is a different location than jtreg executable
Reviewed-by: duke
@@ -52,10 +52,11 @@
SED = sed
SORT = sort
TEE = tee
UNAME = uname
UNIQ = uniq
+WHICH = which
WC = wc
ZIP = zip
# Get OS name from uname (Cygwin inexplicably adds _NT-5.1)
UNAME_S := $(shell $(UNAME) -s | $(CUT) -f1 -d_)
@@ -83,11 +84,11 @@
endif
ABS_PLATFORM_BUILD_ROOT = $(ABS_OUTPUTDIR)
ABS_TEST_OUTPUT_DIR := $(ABS_PLATFORM_BUILD_ROOT)/testoutput/$(UNIQUE_DIR)
-# Expect JPRT to set PRODUCT_HOME (the product or jdk in this case to test)
+# locate the JDK to be tested.
ifndef PRODUCT_HOME
# Try to use j2sdk-image if it exists
ABS_JDK_IMAGE = $(ABS_PLATFORM_BUILD_ROOT)/images/j2sdk-image
PRODUCT_HOME := \
$(shell \
@@ -186,11 +187,11 @@
################################################################
# Default make rule (runs default jdk tests)
all: jdk_default
- @$(ECHO) "Testing completed successfully"
+ @$(ECHO) "Testing completed"
# Prep for output
# Change execute permissions on shared library files.
# Files in repositories should never have execute permissions, but
# there are some tests that have pre-built shared libraries, and these
@@ -217,15 +218,18 @@
################################################################
# jtreg tests
-# Expect JT_HOME to be set for jtreg tests. (home for jtreg)
-ifndef JT_HOME
- JT_HOME = $(SLASH_JAVA)/re/jtreg/4.1/promoted/latest/binaries/jtreg
- ifdef JPRT_JTREG_HOME
- JT_HOME = $(JPRT_JTREG_HOME)
+# Expect JTREG or JT_HOME to be set for jtreg tests.
+ifndef JTREG
+ ifdef JT_HOME
+ # windows executable works for everybody
+ JTREG = $(JT_HOME)/win32/bin/jtreg
+ else
+ # maybe it's on the path?
+ JTREG=$(shell $(WHICH) jtreg 2> /dev/null | $(GREP) -v '^no jtreg in')
endif
endif
# Problematic tests to be excluded
PROBLEM_LISTS=$(call MixedDirs,$(wildcard ProblemList.txt closed/ProblemList.txt))
@@ -260,12 +264,10 @@
ifdef CONCURRENCY
EXTRA_JTREG_OPTIONS += -concurrency:$(CONCURRENCY)
endif
-# Default JTREG to run (win32 script works for everybody)
-JTREG = $(JT_HOME)/win32/bin/jtreg
# run in agentvm mode
JTREG_BASIC_OPTIONS += -agentvm
# Only run automatic tests
JTREG_BASIC_OPTIONS += -a
# Always turn on assertions
@@ -294,18 +296,16 @@
# Set the max memory for jtreg target test vms
JTREG_TESTVM_MEMORY_OPTION = -vmoption:-Xmx512m
JTREG_TEST_OPTIONS += $(JTREG_TESTVM_MEMORY_OPTION)
# Make sure jtreg exists
-$(JTREG): $(JT_HOME)
+$(JTREG):
# Run jtreg
jtreg_tests: prep $(PRODUCT_HOME) $(JTREG)
( \
- ( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)"); \
- export JT_HOME; \
- $(shell $(GETMIXEDPATH) "$(JTREG)") \
+ ( "$(JTREG)" \
$(JTREG_BASIC_OPTIONS) \
-r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport") \
-w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTwork") \
-jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \
$(JTREG_EXCLUSIONS) \
@@ -313,13 +313,11 @@
$(TEST_SELECTION) \
) ; \
$(BUNDLE_UP_AND_EXIT) \
) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt ; $(TESTEXIT)
-PHONY_LIST += jtreg_tests
-
################################################################
# Phony targets (e.g. these are not filenames)
-.PHONY: all clean prep $(PHONY_LIST)
+.PHONY: all clean prep jtreg_tests
################################################################