From 6026d7fcc3a9ba07c559471ce4678a3048de5f50 Mon Sep 17 00:00:00 2001 From: Alexandre Iline Date: Mon, 28 Jan 2019 03:51:38 -0800 Subject: [PATCH] 8217761: Enhance run-test-prebuilt jib profile to support running tests with JCov Reviewed-by: erikj --- make/RunTests.gmk | 6 ++---- make/RunTestsPrebuilt.gmk | 14 ++++++++++++-- make/conf/jib-profiles.js | 16 ++++++++++++---- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/make/RunTests.gmk b/make/RunTests.gmk index dd2e1de7a3..38a8d354ae 100644 --- a/make/RunTests.gmk +++ b/make/RunTests.gmk @@ -119,10 +119,8 @@ ifeq ($(TEST_OPTS_JCOV), true) JCOV_REPORT := $(JCOV_OUTPUT_DIR)/report JCOV_MEM_OPTIONS := -Xms64m -Xmx4g - ifneq ($(JCOV_IMAGE_DIR), ) - # Replace our normal test JDK with the JCov image, if present. - JDK_UNDER_TEST := $(JCOV_IMAGE_DIR) - endif + # Replace our normal test JDK with the JCov image. + JDK_UNDER_TEST := $(JCOV_IMAGE_DIR) JCOV_ENVIRONMENT := JAVA_TOOL_OPTIONS="$(JCOV_MEM_OPTIONS)" \ _JAVA_OPTIONS="$(JCOV_MEM_OPTIONS)" diff --git a/make/RunTestsPrebuilt.gmk b/make/RunTestsPrebuilt.gmk index 737f9cee05..5a40f42270 100644 --- a/make/RunTestsPrebuilt.gmk +++ b/make/RunTestsPrebuilt.gmk @@ -95,12 +95,12 @@ endef # $1: The output file name # $2..$N: The lines to output to the file define CreateNewSpec - $(if $(strip $(31)), \ + $(if $(strip $(33)), \ $(error Internal makefile error: \ Too many arguments to macro, please update CreateNewSpec in RunTestsPrebuilt.gmk) \ ) \ $(shell $(RM) $1) \ - $(foreach i, $(call sequence, 2, 30), \ + $(foreach i, $(call sequence, 2, 32), \ $(if $(strip $($i)), \ $(call AppendFile, $(strip $($i)), $1) \ ) \ @@ -275,6 +275,14 @@ else LD := ld 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 ################################################################################ @@ -295,6 +303,7 @@ $(call CreateNewSpec, $(NEW_SPEC), \ BOOT_JDK := $(BOOT_JDK), \ JT_HOME := $(JT_HOME), \ JDK_IMAGE_DIR := $(JDK_IMAGE_DIR), \ + JCOV_IMAGE_DIR := $(JCOV_IMAGE_DIR), \ TEST_IMAGE_DIR := $(TEST_IMAGE_DIR), \ SYMBOLS_IMAGE_DIR := $(SYMBOLS_IMAGE_DIR), \ MAKE := $(MAKE), \ @@ -315,6 +324,7 @@ $(call CreateNewSpec, $(NEW_SPEC), \ LIBRARY_PREFIX := $(LIBRARY_PREFIX), \ SHARED_LIBRARY_SUFFIX := $(SHARED_LIBRARY_SUFFIX), \ include $(TOPDIR)/make/RunTestsPrebuiltSpec.gmk, \ + TEST_OPTS_JCOV := $(TEST_OPTS_JCOV), \ $(CUSTOM_NEW_SPEC_LINE), \ ) diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js index 8665cc2be5..f47ca0f036 100644 --- a/make/conf/jib-profiles.js +++ b/make/conf/jib-profiles.js @@ -760,20 +760,27 @@ var getJibProfilesProfiles = function (input, common, data) { if (testedProfile == null) { 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 = { "run-test-prebuilt": { target_os: input.build_os, target_cpu: input.build_cpu, dependencies: [ - "jtreg", "gnumake", "boot_jdk", "devkit", "jib", testedProfile + ".jdk", - testedProfile + ".test" + "jtreg", "gnumake", "boot_jdk", "devkit", "jib", "jcov", testedProfileJDK, + testedProfileTest ], src: "src.conf", make_args: [ "run-test-prebuilt", "LOG_CMDLINES=true", "JTREG_VERBOSE=fail,error,time" ], environment: { "BOOT_JDK": common.boot_jdk_home, - "JDK_IMAGE_DIR": input.get(testedProfile + ".jdk", "home_path"), - "TEST_IMAGE_DIR": input.get(testedProfile + ".test", "home_path") + "JDK_IMAGE_DIR": input.get(testedProfileJDK, "home_path"), + "TEST_IMAGE_DIR": input.get(testedProfileTest, "home_path") }, labels: "test" } @@ -939,6 +946,7 @@ var getJibProfilesDependencies = function (input, common) { version: "3.0", build_number: "b07", file: "bundles/jcov-3_0.zip", + environment_name: "JCOV_HOME", }, gnumake: {