8217761: Enhance run-test-prebuilt jib profile to support running tests with JCov

Reviewed-by: erikj
This commit is contained in:
Alexandre Iline 2019-01-28 03:51:38 -08:00
parent 6dcfd0f93a
commit 6026d7fcc3
3 changed files with 26 additions and 10 deletions

View File

@ -119,10 +119,8 @@ ifeq ($(TEST_OPTS_JCOV), true)
JCOV_REPORT := $(JCOV_OUTPUT_DIR)/report JCOV_REPORT := $(JCOV_OUTPUT_DIR)/report
JCOV_MEM_OPTIONS := -Xms64m -Xmx4g JCOV_MEM_OPTIONS := -Xms64m -Xmx4g
ifneq ($(JCOV_IMAGE_DIR), ) # Replace our normal test JDK with the JCov image.
# Replace our normal test JDK with the JCov image, if present. JDK_UNDER_TEST := $(JCOV_IMAGE_DIR)
JDK_UNDER_TEST := $(JCOV_IMAGE_DIR)
endif
JCOV_ENVIRONMENT := JAVA_TOOL_OPTIONS="$(JCOV_MEM_OPTIONS)" \ JCOV_ENVIRONMENT := JAVA_TOOL_OPTIONS="$(JCOV_MEM_OPTIONS)" \
_JAVA_OPTIONS="$(JCOV_MEM_OPTIONS)" _JAVA_OPTIONS="$(JCOV_MEM_OPTIONS)"

View File

@ -95,12 +95,12 @@ endef
# $1: The output file name # $1: The output file name
# $2..$N: The lines to output to the file # $2..$N: The lines to output to the file
define CreateNewSpec define CreateNewSpec
$(if $(strip $(31)), \ $(if $(strip $(33)), \
$(error Internal makefile error: \ $(error Internal makefile error: \
Too many arguments to macro, please update CreateNewSpec in RunTestsPrebuilt.gmk) \ Too many arguments to macro, please update CreateNewSpec in RunTestsPrebuilt.gmk) \
) \ ) \
$(shell $(RM) $1) \ $(shell $(RM) $1) \
$(foreach i, $(call sequence, 2, 30), \ $(foreach i, $(call sequence, 2, 32), \
$(if $(strip $($i)), \ $(if $(strip $($i)), \
$(call AppendFile, $(strip $($i)), $1) \ $(call AppendFile, $(strip $($i)), $1) \
) \ ) \
@ -275,6 +275,14 @@ else
LD := ld LD := ld
endif endif
ifneq ($(wildcard $(JDK_IMAGE_DIR)/template.xml), )
TEST_OPTS_JCOV := true
JCOV_IMAGE_DIR := $(JDK_IMAGE_DIR)
else
TEST_OPTS_JCOV := false
JCOV_IMAGE_DIR :=
endif
################################################################################ ################################################################################
# Generate the ephemeral spec file # Generate the ephemeral spec file
################################################################################ ################################################################################
@ -295,6 +303,7 @@ $(call CreateNewSpec, $(NEW_SPEC), \
BOOT_JDK := $(BOOT_JDK), \ BOOT_JDK := $(BOOT_JDK), \
JT_HOME := $(JT_HOME), \ JT_HOME := $(JT_HOME), \
JDK_IMAGE_DIR := $(JDK_IMAGE_DIR), \ JDK_IMAGE_DIR := $(JDK_IMAGE_DIR), \
JCOV_IMAGE_DIR := $(JCOV_IMAGE_DIR), \
TEST_IMAGE_DIR := $(TEST_IMAGE_DIR), \ TEST_IMAGE_DIR := $(TEST_IMAGE_DIR), \
SYMBOLS_IMAGE_DIR := $(SYMBOLS_IMAGE_DIR), \ SYMBOLS_IMAGE_DIR := $(SYMBOLS_IMAGE_DIR), \
MAKE := $(MAKE), \ MAKE := $(MAKE), \
@ -315,6 +324,7 @@ $(call CreateNewSpec, $(NEW_SPEC), \
LIBRARY_PREFIX := $(LIBRARY_PREFIX), \ LIBRARY_PREFIX := $(LIBRARY_PREFIX), \
SHARED_LIBRARY_SUFFIX := $(SHARED_LIBRARY_SUFFIX), \ SHARED_LIBRARY_SUFFIX := $(SHARED_LIBRARY_SUFFIX), \
include $(TOPDIR)/make/RunTestsPrebuiltSpec.gmk, \ include $(TOPDIR)/make/RunTestsPrebuiltSpec.gmk, \
TEST_OPTS_JCOV := $(TEST_OPTS_JCOV), \
$(CUSTOM_NEW_SPEC_LINE), \ $(CUSTOM_NEW_SPEC_LINE), \
) )

View File

@ -760,20 +760,27 @@ var getJibProfilesProfiles = function (input, common, data) {
if (testedProfile == null) { if (testedProfile == null) {
testedProfile = input.build_os + "-" + input.build_cpu; testedProfile = input.build_os + "-" + input.build_cpu;
} }
var testedProfileJDK = testedProfile + ".jdk";
var testedProfileTest = ""
if (testedProfile.endsWith("-jcov")) {
testedProfileTest = testedProfile.substring(0, testedProfile.length - "-jcov".length) + ".test";
} else {
testedProfileTest = testedProfile + ".test";
}
var testOnlyProfilesPrebuilt = { var testOnlyProfilesPrebuilt = {
"run-test-prebuilt": { "run-test-prebuilt": {
target_os: input.build_os, target_os: input.build_os,
target_cpu: input.build_cpu, target_cpu: input.build_cpu,
dependencies: [ dependencies: [
"jtreg", "gnumake", "boot_jdk", "devkit", "jib", testedProfile + ".jdk", "jtreg", "gnumake", "boot_jdk", "devkit", "jib", "jcov", testedProfileJDK,
testedProfile + ".test" testedProfileTest
], ],
src: "src.conf", src: "src.conf",
make_args: [ "run-test-prebuilt", "LOG_CMDLINES=true", "JTREG_VERBOSE=fail,error,time" ], make_args: [ "run-test-prebuilt", "LOG_CMDLINES=true", "JTREG_VERBOSE=fail,error,time" ],
environment: { environment: {
"BOOT_JDK": common.boot_jdk_home, "BOOT_JDK": common.boot_jdk_home,
"JDK_IMAGE_DIR": input.get(testedProfile + ".jdk", "home_path"), "JDK_IMAGE_DIR": input.get(testedProfileJDK, "home_path"),
"TEST_IMAGE_DIR": input.get(testedProfile + ".test", "home_path") "TEST_IMAGE_DIR": input.get(testedProfileTest, "home_path")
}, },
labels: "test" labels: "test"
} }
@ -939,6 +946,7 @@ var getJibProfilesDependencies = function (input, common) {
version: "3.0", version: "3.0",
build_number: "b07", build_number: "b07",
file: "bundles/jcov-3_0.zip", file: "bundles/jcov-3_0.zip",
environment_name: "JCOV_HOME",
}, },
gnumake: { gnumake: {