changeset 54627:688ce88f89cd

8217761: Enhance run-test-prebuilt jib profile to support running tests with JCov Reviewed-by: erikj
author shurailine
date Mon, 28 Jan 2019 03:51:38 -0800
parents c55508666f24
children fcfeed9fef45
files make/RunTests.gmk make/RunTestsPrebuilt.gmk make/conf/jib-profiles.js
diffstat 3 files changed, 26 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/make/RunTests.gmk	Mon Jan 28 18:49:34 2019 +0000
+++ b/make/RunTests.gmk	Mon Jan 28 03:51:38 2019 -0800
@@ -119,10 +119,8 @@
   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)"
--- a/make/RunTestsPrebuilt.gmk	Mon Jan 28 18:49:34 2019 +0000
+++ b/make/RunTestsPrebuilt.gmk	Mon Jan 28 03:51:38 2019 -0800
@@ -95,12 +95,12 @@
 # $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 @@
   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 @@
     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 @@
     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), \
 )
 
--- a/make/conf/jib-profiles.js	Mon Jan 28 18:49:34 2019 +0000
+++ b/make/conf/jib-profiles.js	Mon Jan 28 03:51:38 2019 -0800
@@ -760,20 +760,27 @@
     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 @@
             version: "3.0",
             build_number: "b07",
             file: "bundles/jcov-3_0.zip",
+            environment_name: "JCOV_HOME",
         },
 
         gnumake: {