make/Main.gmk
changeset 53295 520f8e2041bb
parent 52986 0d0f59acf65a
child 53465 d982794784f1
--- a/make/Main.gmk	Mon Jan 14 23:05:26 2019 +0100
+++ b/make/Main.gmk	Mon Jan 14 08:22:49 2019 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -484,18 +484,27 @@
   exploded-test-$1:
 	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test \
 	    TEST="$1" JDK_IMAGE_DIR=$(JDK_OUTPUTDIR))
-
 endef
 
 # ALL_NAMED_TESTS is defined in FindTests.gmk
 $(foreach t, $(ALL_NAMED_TESTS), $(eval $(call DeclareRunTestRecipe,$t)))
 ALL_TEST_TARGETS := $(addprefix test-, $(ALL_NAMED_TESTS))
 
+define DeclareRunJCovTestRecipe
+  jcov-test-$1:
+	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk \
+	    TEST="$1" TEST_OPTS_JCOV=true)
+endef
+
+# jcov-test only makes sense for some of the tests
+$(foreach t, $(JCOV_NAMED_TESTS), $(eval $(call DeclareRunJCovTestRecipe,$t)))
+ALL_JCOV_TEST_TARGETS := $(addprefix jcov-test-, $(JCOV_NAMED_TESTS))
+
 # We only support the "exploded-test-gtest" shortcut
 ALL_EXPLODED_TESTS := gtest
 ALL_EXPLODED_TEST_TARGETS := $(addprefix exploded-test-, $(ALL_EXPLODED_TESTS))
 
-ALL_TARGETS += $(ALL_TEST_TARGETS) $(ALL_EXPLODED_TEST_TARGETS)
+ALL_TARGETS += $(ALL_TEST_TARGETS) $(ALL_EXPLODED_TEST_TARGETS) $(ALL_JCOV_TEST_TARGETS)
 
 ################################################################################
 # Build tests and microbenchmarks
@@ -568,7 +577,11 @@
 	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test \
 	    TEST="$(TEST)" JDK_IMAGE_DIR=$(JDK_OUTPUTDIR))
 
-ALL_TARGETS += test exploded-test
+jcov-test:
+	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk \
+	    TEST="$(TEST)" TEST_OPTS_JCOV=true)
+
+ALL_TARGETS += test exploded-test jcov-test
 
 ################################################################################
 # Bundles
@@ -869,6 +882,8 @@
 
   exploded-test: exploded-image test-image
 
+  jcov-test: jcov-image test-image
+
   test-make: clean-test-make compile-commands
 
   test-make-compile-commands: compile-commands
@@ -876,6 +891,7 @@
   # Declare dependency for all generated test targets
   $(foreach t, $(filter-out test-make%, $(ALL_TEST_TARGETS)), $(eval $t: jdk-image test-image))
   $(foreach t, $(ALL_EXPLODED_TEST_TARGETS), $(eval $t: exploded-image test-image))
+  $(ALL_JCOV_TEST_TARGETS): jcov-image test-image
 
   create-buildjdk-copy: jdk.jlink-java java.base-gendata \
       $(addsuffix -java, $(INTERIM_IMAGE_MODULES))