8187445: Forest Consolidation: Make tests work

Reviewed-by: darcy, ihse
This commit is contained in:
Erik Joelsson 2017-09-12 19:03:59 +02:00
parent 72c4ec5462
commit 467119a352
13 changed files with 158 additions and 70 deletions

View File

@ -32,6 +32,9 @@ include FindTests.gmk
# We will always run multiple tests serially
.NOTPARALLEL:
# Directories to find jtreg tests relative to
JTREG_TEST_TOPDIRS := $(TOPDIR) $(JTREG_TESTROOTS)
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, , RunTests.gmk))
@ -120,8 +123,8 @@ endef
#
# It is a Jtreg test if it optionally begins with jtreg:, and then is either
# an unspecified group name (possibly prefixed by :), or a group in a
# specified <component>/test directory, or a path to a test or test directory,
# either absolute or relative to TOPDIR.
# specified test/<component> directory, or a path to a test or test directory,
# either absolute or relative to any of the JTREG_TEST_TOPDIRS.
define ParseJtregTestSelection
$(eval TEST_NAME := $(strip $(patsubst jtreg:%, %, $1))) \
$(if $(or $(findstring :, $(TEST_NAME)), $(findstring /, $(TEST_NAME))), , \
@ -129,18 +132,19 @@ define ParseJtregTestSelection
) \
$(if $(findstring :, $(TEST_NAME)), \
$(if $(filter :%, $(TEST_NAME)), \
$(foreach component, $(JTREG_COMPONENTS), \
$(foreach root, $(JTREG_TESTROOTS), \
$(if $(filter $(patsubst :%, %, $(TEST_NAME)), \
$($(component)_JTREG_TEST_GROUPS)), \
jtreg:$(component)/test:$(patsubst :%,%,$(TEST_NAME)) \
$($(root)_JTREG_TEST_GROUPS)), \
jtreg:$(root):$(patsubst :%,%,$(TEST_NAME)) \
) \
) \
, \
$(eval COMPONENT := $(word 1, $(subst /, $(SPACE), $(TEST_NAME)))) \
$(eval ROOT_PART := $(word 1, $(subst :, $(SPACE), $(TEST_NAME)))) \
$(eval ROOT := $(filter $(addprefix %, $(ROOT_PART)), $(JTREG_TESTROOTS))) \
$(eval GROUP := $(word 2, $(subst :, $(SPACE), $(TEST_NAME)))) \
$(if $(filter $(COMPONENT), $(JTREG_COMPONENTS)), \
$(if $(filter $(GROUP), $($(COMPONENT)_JTREG_TEST_GROUPS)), \
jtreg:$(TEST_NAME) \
$(foreach root, $(ROOT), \
$(if $(filter $(GROUP), $($(root)_JTREG_TEST_GROUPS)), \
jtreg:$(root):$(GROUP) \
) \
) \
) \
@ -150,9 +154,7 @@ define ParseJtregTestSelection
jtreg:$(TEST_NAME) \
) \
, \
$(if $(wildcard $(TOPDIR)/$(TEST_NAME)), \
jtreg:$(TEST_NAME) \
) \
$(addprefix jtreg:, $(wildcard $(addsuffix /$(TEST_NAME), $(JTREG_TEST_TOPDIRS)))) \
) \
)
endef
@ -297,7 +299,8 @@ define SetupRunJtregTestBody
$1_TEST_SUPPORT_DIR := $$(TEST_SUPPORT_DIR)/$1
$1_TEST_NAME := $$(strip $$(patsubst jtreg:%, %, $$($1_TEST)))
$1_COMPONENT := $$(firstword $$(subst /, $$(SPACE), $$($1_TEST_NAME)))
$1_COMPONENT := $$(firstword $$(subst /, $$(SPACE), \
$$(patsubst test/%, %, $$($1_TEST_NAME))))
ifeq ($$(JT_HOME), )
$$(info Error: jtreg framework is not found.)

View File

@ -29,13 +29,13 @@ _FIND_TESTS_GMK := 1
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, , common/FindTests.gmk))
# JTREG_COMPONENTS might have been set by a custom extension
JTREG_COMPONENTS += hotspot jdk langtools nashorn jaxp
# JTREG_TESTROOTS might have been set by a custom extension
JTREG_TESTROOTS += $(addprefix $(TOPDIR)/test/, hotspot/jtreg jdk langtools nashorn jaxp)
################################################################################
# Find the Jtreg test groups for the given component.
#
# Parameter 1 is the name of the component. This name is used as variable prefix.
# Parameter 1 is the jtreg root dir. This name is used as variable prefix.
#
# After this macro has been evaluated, the following variables are defined for
# the component:
@ -45,12 +45,10 @@ JTREG_COMPONENTS += hotspot jdk langtools nashorn jaxp
#
FindJtregGroups = $(NamedParamsMacroTemplate)
define FindJtregGroupsBody
$1_JTREG_TESTROOT := $$(TOPDIR)/$1/test
ifneq ($$(wildcard $$($1_JTREG_TESTROOT)), )
ifneq ($$(wildcard $1), )
$1_JTREG_GROUP_FILENAMES := $$(shell $$(SED) -n -e 's/\[\(.*\)\]/\1/g' \
-e 's/^groups\w*=//p' $$($1_JTREG_TESTROOT)/TEST.ROOT)
$1_JTREG_GROUP_FILES := $$(addprefix $$($1_JTREG_TESTROOT)/, \
$$($1_JTREG_GROUP_FILENAMES))
-e 's/^groups\w*=//p' $1/TEST.ROOT)
$1_JTREG_GROUP_FILES := $$(addprefix $1/, $$($1_JTREG_GROUP_FILENAMES))
$1_JTREG_TEST_GROUPS := $$(strip $$(shell $$(SED) -n \
-e 's/\([^ ]*\)\w*=.*/\1/gp' $$(wildcard $$($1_JTREG_GROUP_FILES)) \
| $$(SORT) -u))
@ -58,12 +56,11 @@ define FindJtregGroupsBody
endef
# Configure definitions for all available test components
$(foreach component, $(JTREG_COMPONENTS), \
$(eval $(call FindJtregGroups, $(component))))
$(foreach root, $(JTREG_TESTROOTS), $(eval $(call FindJtregGroups, $(root))))
# Create a list of all available Jtreg test groups in all components
JTREG_TEST_GROUPS += $(sort $(foreach component, $(JTREG_COMPONENTS), \
$($(component)_JTREG_TEST_GROUPS)))
JTREG_TEST_GROUPS += $(sort $(foreach root, $(JTREG_TESTROOTS), \
$($(root)_JTREG_TEST_GROUPS)))
# Add Jtreg test groups to list of named tests (test groups, test list, etc)
# ALL_NAMED_TESTS might have been set by a custom extension

View File

@ -27,22 +27,13 @@
# Makefile to run tests from multiple sibling directories
#
# Root of the forest that was built
TOPDIR=..
# This makefile depends on the availability of sibling directories.
LANGTOOLS_DIR=$(TOPDIR)/langtools
JDK_DIR=$(TOPDIR)/jdk
JAXP_DIR=$(TOPDIR)/jaxp
HOTSPOT_DIR=$(TOPDIR)/hotspot
# Macro to run a test target in a subdir
define SUBDIR_TEST # subdirectory target
if [ -d $1 ] ; then \
if [ -r $1/test/Makefile ] ; then \
$(MAKE) --no-print-directory -k -C $1/test $2 ; \
if [ -r $1/Makefile ] ; then \
$(MAKE) --no-print-directory -k -C $1 $2 ; \
else \
echo "ERROR: File does not exist: $1/test/Makefile"; \
echo "ERROR: File does not exist: $1/Makefile"; \
exit 1; \
fi; \
else \
@ -56,9 +47,6 @@ default: jdk_core langtools_jtreg jaxp_all
# All testing
all: jdk_all langtools_all jaxp_all
# Bring in closed test targets if present
-include $(TOPDIR)/closed/test/Makefile
ifeq ($(TEST_JOBS), 0)
ifeq ($(shell $(EXPR) $(JOBS) \> 50), 1)
# JTReg cannot handle more than 50 in concurrency
@ -71,13 +59,18 @@ else
endif
# Test targets
langtools_% :
@$(NO_STOPPING)$(call SUBDIR_TEST, $(LANGTOOLS_DIR), CONCURRENCY=$(JDK_TEST_JOBS) JT_JAVA=$(PRODUCT_HOME) JTREG_HOME=$(JT_HOME) TEST="$(subst langtools_,,$@)" $(subst langtools_,,$@))
@$(NO_STOPPING)$(call SUBDIR_TEST, langtools, CONCURRENCY=$(JDK_TEST_JOBS) \
JT_JAVA=$(PRODUCT_HOME) JTREG_HOME=$(JT_HOME) \
TEST="$(subst langtools_,,$@)" $(subst langtools_,,$@))
jdk_% core_%s svc_%:
@$(NO_STOPPING)$(call SUBDIR_TEST, $(JDK_DIR), CONCURRENCY=$(JDK_TEST_JOBS) TEST="$@" $@)
@$(NO_STOPPING)$(call SUBDIR_TEST, jdk, CONCURRENCY=$(JDK_TEST_JOBS) TEST="$@" $@)
jaxp_%:
@$(NO_STOPPING)$(call SUBDIR_TEST, $(JAXP_DIR), CONCURRENCY=$(JDK_TEST_JOBS) TEST="$@" $@)
@$(NO_STOPPING)$(call SUBDIR_TEST, jaxp, CONCURRENCY=$(JDK_TEST_JOBS) TEST="$@" $@)
nashorn_%:
@$(NO_STOPPING)$(call SUBDIR_TEST, nashorn, CONCURRENCY=$(JDK_TEST_JOBS) TEST="$@" $@)
SUB_MAKE_ARGS :=
ifneq ($(TEST_JOBS), 0)
@ -86,7 +79,7 @@ ifneq ($(TEST_JOBS), 0)
endif
endif
hotspot_%:
@$(NO_STOPPING)$(call SUBDIR_TEST, $(HOTSPOT_DIR), $(SUB_MAKE_ARGS) TEST="$@" $@)
@$(NO_STOPPING)$(call SUBDIR_TEST, hotspot/jtreg, $(SUB_MAKE_ARGS) TEST="$@" $@)
#
# jtreg_tests
@ -103,16 +96,21 @@ hotspot_%:
# corresponding ../<component>/test/Makefile.
ifneq ($(TESTDIRS),)
# Extract the component from ../<component>/...
COMPONENT=$(word 2,$(subst /, ,$(TESTDIRS)))
# Extract the component from ../test/<component>/...
TESTDIRS_NORM := $(patsubst test/%, %, $(patsubst ../%, %, $(TESTDIRS)))
COMPONENT := $(word 1,$(subst /, ,$(TESTDIRS_NORM)))
# Strip off the ../<component>/test prefix and pass the rest as TESTDIRS
# to the delegate Makefile
TESTDIRS_TESTS=$(patsubst ../$(COMPONENT)/test/%,%,$(TESTDIRS))
# Strip off the ../<component>/test prefix and pass the rest as TESTDIRS
# to the delegate Makefile
# The hotspot tests are in a subdir "java". Accept paths both including
# and excluding this extra subdir
TESTDIRS_TESTS := $(patsubst $(COMPONENT)/%,%,$(patsubst hotspot/jtreg/%,%, \
$(patsubst ../%, %, $(TESTDIRS_NORM))))
endif
jtreg_tests:
@$(NO_STOPPING)$(call SUBDIR_TEST, $(TOPDIR)/$(COMPONENT), TESTDIRS=$(TESTDIRS_TESTS) $@)
$(MAKE) --no-print-directory TESTDIRS=$(TESTDIRS_TESTS) \
$(COMPONENT)_jtreg_tests
################################################################

View File

@ -301,7 +301,7 @@ ifndef JT_HOME
endif
# Problematic tests to be excluded
PROBLEM_LISTS=$(call MixedDirs,$(wildcard ProblemList.txt closed/ProblemList.txt))
PROBLEM_LISTS=$(call MixedDirs,$(wildcard ProblemList.txt))
# Create exclude list for this platform and arch
ifdef NO_EXCLUDES
@ -413,6 +413,10 @@ jtreg_tests: prep jtreg_exists $(PRODUCT_HOME)
PHONY_LIST += jtreg_tests
# Make it possible to call this with <component>_jtreg_tests
%_jtreg_tests: jtreg_tests
# Must have a fake recipe here to prevent make from matching any other rule
################################################################
# Phony targets (e.g. these are not filenames)

View File

@ -74,7 +74,7 @@ endif
JTREG_BASIC_OPTIONS += -vmoption:-XX:MaxRAMPercentage=$(shell expr 25 / $(CONCURRENCY))
# Include the common base file with most of the logic
include ../../test/TestCommon.gmk
include ../../TestCommon.gmk
################################################################
# Default make rule (runs jtreg_tests)
@ -91,10 +91,6 @@ hotspot_%:
hotspot_internal:
$(ALT_OUTPUTDIR)/jdk/bin/java -XX:+ExecuteInternalVMTests -XX:+ShowMessageBoxOnError -version
################################################################
ALT_MAKE ?= closed
-include $(ALT_MAKE)/Makefile
################################################################
# Set up the directory in which the jvm directories live (client/, server/, etc.)

View File

@ -29,13 +29,13 @@
# The list of keywords supported in this test suite
keys=cte_test jcmd nmt regression gc stress
groups=TEST.groups [closed/TEST.groups]
groups=TEST.groups
# Source files for classes that will be used at the beginning of each test suite run,
# to determine additional characteristics of the system for use with the @requires tag.
# Note: compiled bootlibs code will be located in the folder 'bootClasses'
requires.extraPropDefns = ../../test/jtreg-ext/requires/VMProps.java [../../closed/test/jtreg-ext/requires/VMPropsExt.java]
requires.extraPropDefns.bootlibs = ../../test/lib/sun ../../test/lib/jdk/test/lib/Platform.java
requires.extraPropDefns = ../../jtreg-ext/requires/VMProps.java
requires.extraPropDefns.bootlibs = ../../lib/sun ../../lib/jdk/test/lib/Platform.java
requires.extraPropDefns.vmOpts = -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:bootClasses
requires.properties= \
sun.arch.data.model \
@ -58,8 +58,8 @@ requires.properties= \
requiredVersion=4.2 b08
# Path to libraries in the topmost test directory. This is needed so @library
# does not need ../../ notation to reach them
external.lib.roots = ../../
# does not need ../../../ notation to reach them
external.lib.roots = ../../../
# Use new module options
useNewOptions=true

View File

@ -49,7 +49,7 @@ hotspot_native_sanity = \
hotspot_tier1_common = \
sanity/BasicVMTest.java \
native/GTestWrapper.java
gtest/GTestWrapper.java
hotspot_tier1_compiler_1 = \
compiler/aot/ \

View File

@ -27,7 +27,7 @@ default: all
USE_JTREG_VERSION := 4.1
include ../../test/TestCommon.gmk
include ../TestCommon.gmk
# Default make rule (runs default JAXP tests)
all: jaxp_all

View File

@ -31,7 +31,7 @@ USE_FAILURE_HANDLER := true
TREAT_EXIT_CODE_1_AS_0 := true
include ../../test/TestCommon.gmk
include ../TestCommon.gmk
# Default make rule (runs default jdk tests)
all: jdk_default

View File

@ -23,7 +23,7 @@ othervm.dirs=java/awt java/beans javax/accessibility javax/imageio javax/sound j
exclusiveAccess.dirs=java/rmi/Naming java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi java/util/stream java/util/Arrays/largeMemory java/util/BitSet/stream javax/rmi com/sun/corba/cachedSocket
# Group definitions
groups=TEST.groups [closed/TEST.groups]
groups=TEST.groups
# Allow querying of various System properties in @requires clauses
#

View File

@ -548,6 +548,7 @@ needs_jre = \
# These are isolated for easy exclusions
#
needs_charsets = \
-:needs_locales_and_charsets \
java/io/OutputStreamWriter/TestWrite.java \
java/nio/charset/RemovingSunIO/SunioAlias.java \
java/nio/charset/coders/Check.java \
@ -782,3 +783,90 @@ compact1_minimal = \
-:needs_compact3 \
-:needs_jre \
-:needs_jdk
needs_headful = \
java/util/TimeZone/DefaultTimeZoneTest.java \
sun/security/tools/policytool
needs_locales = \
-:needs_locales_and_charsets \
java/text/Collator/APITest.java \
java/text/Collator/CollationKeyTest.java \
java/text/Collator/DanishTest.java \
java/text/Collator/FinnishTest.java \
java/text/Collator/FrenchTest.java \
java/text/Collator/G7Test.java \
java/text/Collator/JapaneseTest.java \
java/text/Collator/KoreanTest.java \
java/text/Collator/Regression.java \
java/text/Collator/TurkishTest.java \
java/text/Collator/VietnameseTest.java \
java/text/Format/DateFormat/bug4117335.java \
java/text/Format/DateFormat/DateFormatTest.java \
java/text/Format/DateFormat/IntlTestDateFormatSymbols.java \
java/text/Format/DateFormat/NonGregorianFormatTest.java \
java/text/Format/NumberFormat/IntlTestNumberFormatAPI.java \
java/text/Format/NumberFormat/NumberRegression.java \
java/text/Format/NumberFormat/NumberTest.java \
java/util/Calendar/Bug4302966.java \
java/util/TimeZone/HongKong.java \
java/util/TimeZone/TimeZoneTest.java \
java/util/Calendar/NarrowNamesTest.sh \
java/util/Locale/Bug8001562.java \
java/util/Locale/InternationalBAT.java \
java/util/Locale/LocaleEnhanceTest.java \
java/util/Locale/LocaleTest.java \
java/util/Locale/ThaiGov.java \
java/text/Format/DateFormat/Bug4823811.java \
java/text/Format/DateFormat/Bug6683975.java \
java/text/Format/DateFormat/ContextMonthNamesTest.java \
java/text/Format/DecimalFormat/RoundingAndPropertyTest.java \
java/time/test/java/time/format/TestDateTimeFormatterBuilder.java \
java/time/test/java/time/format/TestDateTimeTextProvider.java \
java/time/test/java/time/format/TestNonIsoFormatter.java \
java/time/test/java/time/format/TestTextParser.java \
java/time/test/java/time/format/TestTextPrinter.java \
java/util/Currency/CurrencyTest.java \
java/util/Formatter/Basic.java \
sun/text/resources/Collator/Bug4248694.java \
sun/text/resources/Collator/Bug4804273.java \
sun/text/resources/Collator/Bug6755060.java \
sun/text/resources/Format/Bug4395196.java \
sun/text/resources/Format/Bug4442855.java \
sun/text/resources/Format/Bug4621320.java \
sun/text/resources/Format/Bug4651568.java \
sun/text/resources/Format/Bug4762201.java \
sun/text/resources/Format/Bug4807540.java \
sun/text/resources/Format/Bug4810032.java \
sun/text/resources/Format/Bug4994312.java \
sun/text/resources/Format/Bug5096553.java \
sun/text/resources/LocaleDataTest.java \
sun/util/resources/Calendar/Bug4518811.java \
sun/util/resources/Calendar/Bug4527203.java \
sun/util/resources/Locale/Bug4429024.java \
sun/util/resources/Locale/Bug4965260.java \
sun/util/resources/Locale/Bug6275682.java \
sun/util/resources/TimeZone/Bug6271396.java \
sun/util/resources/TimeZone/Bug6317929.java \
sun/util/resources/TimeZone/Bug6377794.java \
sun/util/resources/TimeZone/Bug6442006.java
needs_locales_and_charsets = \
java/text/BreakIterator/NewVSOld_th_TH.java \
java/util/Locale/InternationalBAT.java
needs_sunec = \
-:needs_sunec_and_sunpkcs11 \
sun/security/ec/TestEC.java
needs_sunpkcs11 = \
-:needs_sunec_and_sunpkcs11 \
sun/security/pkcs11/Secmod \
sun/security/tools/keytool/autotest.sh
needs_sunec_and_sunpkcs11 = \
sun/security/pkcs11/Secmod/AddPrivateKey.java \
sun/security/pkcs11/Secmod/TrustAnchors.java
needs_nashorn = \
javax/script

View File

@ -162,16 +162,18 @@ public class CreateMultiReleaseTestJars {
String findTestDir(String dir) throws IOException {
Path path = Paths.get(dir).toAbsolutePath();
Path child = null;
while (path != null && !path.endsWith("test")) {
child = path;
path = path.getParent();
}
if (path == null) {
if (child == null) {
throw new IllegalArgumentException(dir + " is not in a test directory");
}
if (!Files.isDirectory(path)) {
throw new IOException(path.toString() + " is not a directory");
if (!Files.isDirectory(child)) {
throw new IOException(child.toString() + " is not a directory");
}
return path.toString();
return child.toString();
}
void compileEntries() {

View File

@ -27,7 +27,7 @@ default: all
USE_FAILURE_HANDLER := true
include ../../test/TestCommon.gmk
include ../TestCommon.gmk
# Default make rule (runs default nashorn tests)
all: nashorn_default