8221857: Collect code coverage for a subset of code

Reviewed-by: erikj
This commit is contained in:
Alexandre Iline 2019-04-11 03:05:11 -08:00
parent 06e17e05a2
commit 11c8caf157
4 changed files with 17 additions and 0 deletions

View File

@ -49,6 +49,7 @@ $(JCOV_IMAGE_DIR)/release: $(JCOV_INPUT_IMAGE_DIR)/release
-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)

View File

@ -1194,10 +1194,18 @@ ifeq ($(TEST_OPTS_JCOV), true)
$(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 \

View File

@ -404,9 +404,12 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_CODE_COVERAGE],
[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 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_CODE_COVERAGE],
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)
])
###############################################################################

View File

@ -389,6 +389,7 @@ GCOV_ENABLED=@GCOV_ENABLED@
JCOV_ENABLED=@JCOV_ENABLED@
JCOV_HOME=@JCOV_HOME@
JCOV_INPUT_JDK=@JCOV_INPUT_JDK@
JCOV_FILTERS=@JCOV_FILTERS@
# AddressSanitizer
export ASAN_ENABLED:=@ASAN_ENABLED@