8221857: Collect code coverage for a subset of code
authorshurailine
Thu, 11 Apr 2019 03:05:11 -0800
changeset 54516 5b1ad4cbe59e
parent 54515 138f47e9d8c4
child 54517 c201ca660afd
8221857: Collect code coverage for a subset of code Reviewed-by: erikj
make/Coverage.gmk
make/RunTests.gmk
make/autoconf/jdk-options.m4
make/autoconf/spec.gmk.in
--- a/make/Coverage.gmk	Thu Apr 11 19:09:45 2019 +0200
+++ b/make/Coverage.gmk	Thu Apr 11 03:05:11 2019 -0800
@@ -49,6 +49,7 @@
 	    -exclude 'java.lang.Object' \
 	    -exclude 'jdk.internal.org.objectweb.**' \
 	    -exclude jdk.test.Main -exclude '**\$Proxy*' \
+	    $(JCOV_FILTERS) \
 	    $(JCOV_TEMP)/$(JCOV_IMAGE_SUBDIR)
 	$(MV) $(JCOV_TEMP)/$(JCOV_IMAGE_SUBDIR) $(JCOV_IMAGE_DIR)
 	$(RMDIR) $(JCOV_TEMP)
--- a/make/RunTests.gmk	Thu Apr 11 19:09:45 2019 +0200
+++ b/make/RunTests.gmk	Thu Apr 11 03:05:11 2019 -0800
@@ -1194,10 +1194,18 @@
 	$(call LogWarn, Stopping JCov Grabber...)
 	$(JAVA) -jar $(JCOV_HOME)/lib/jcov.jar GrabberManager -stop -stoptimeout 3600
 
+  JCOV_REPORT_TITLE := JDK code coverage report<br/>
+  ifneq ($(JCOV_FILTERS), )
+    JCOV_REPORT_TITLE += Code filters: $(JCOV_FILTERS)<br>
+  endif
+  JCOV_REPORT_TITLE += Tests: $(TEST)
+	
   jcov-gen-report: jcov-stop-grabber
 	$(call LogWarn, Generating JCov report ...)
 	$(JAVA) -Xmx4g -jar $(JCOV_HOME)/lib/jcov.jar RepGen -sourcepath \
 	    `$(ECHO) $(TOPDIR)/src/*/share/classes/ | $(TR) ' ' ':'` -fmt html \
+	    $(JCOV_FILTERS) \
+	    -mainReportTitle "$(JCOV_REPORT_TITLE)" \
 	    -o $(JCOV_REPORT) $(JCOV_RESULT_FILE)
 
   TARGETS += jcov-do-start-grabber jcov-start-grabber jcov-stop-grabber \
--- a/make/autoconf/jdk-options.m4	Thu Apr 11 19:09:45 2019 +0200
+++ b/make/autoconf/jdk-options.m4	Thu Apr 11 03:05:11 2019 -0800
@@ -404,9 +404,12 @@
       [jcov library location])])
   AC_ARG_WITH(jcov-input-jdk, [AS_HELP_STRING([--with-jcov-input-jdk],
       [jdk image to instrument])])
+  AC_ARG_WITH(jcov-filters, [AS_HELP_STRING([--with-jcov-filters],
+      [filters to limit code for jcov instrumentation and report generation])])
   JCOV_HOME=
   JCOV_INPUT_JDK=
   JCOV_ENABLED=
+  JCOV_FILTERS=
   if test "x$with_jcov" = "x" ; then
     JCOV_ENABLED="false"
   else
@@ -425,10 +428,14 @@
       fi
       BASIC_FIXUP_PATH(JCOV_INPUT_JDK)
     fi
+    if test "x$with_jcov_filters" != "x" ; then
+      JCOV_FILTERS="$with_jcov_filters"
+    fi
   fi
   AC_SUBST(JCOV_ENABLED)
   AC_SUBST(JCOV_HOME)
   AC_SUBST(JCOV_INPUT_JDK)
+  AC_SUBST(JCOV_FILTERS)
 ])
 
 ###############################################################################
--- a/make/autoconf/spec.gmk.in	Thu Apr 11 19:09:45 2019 +0200
+++ b/make/autoconf/spec.gmk.in	Thu Apr 11 03:05:11 2019 -0800
@@ -389,6 +389,7 @@
 JCOV_ENABLED=@JCOV_ENABLED@
 JCOV_HOME=@JCOV_HOME@
 JCOV_INPUT_JDK=@JCOV_INPUT_JDK@
+JCOV_FILTERS=@JCOV_FILTERS@
 
 # AddressSanitizer
 export ASAN_ENABLED:=@ASAN_ENABLED@