diff options
author | Darrick J. Wong <djwong@kernel.org> | 2023-07-25 18:56:51 -0700 |
---|---|---|
committer | Zorro Lang <zlang@kernel.org> | 2023-08-05 02:06:34 +0800 |
commit | d39fb9a81d76305ab1b3c0c3a042e767a7c1bf89 (patch) | |
tree | 5759a315f68c824da387c276b95663d17aed61d0 /check | |
parent | 24cfe625794ea0c807d0739291f0a9ce7ddd5a2b (diff) | |
download | xfstests-dev-d39fb9a81d76305ab1b3c0c3a042e767a7c1bf89.tar.gz |
check: generate gcov code coverage reports at the end of each section
Support collecting kernel code coverage information as reported in
debugfs. At the start of each section, we reset the gcov counters;
during the section wrapup, we'll collect the kernel gcov data.
If lcov is installed and the kernel source code is available, it will
also generate a nice html report. If a CLI web browser is available, it
will also format the html report into text for easy grepping.
This requires the test runner to set REPORT_GCOV=1 explicitly and gcov
to be enabled in the kernel.
Cc: tytso@mit.edu
Cc: kent.overstreet@linux.dev
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
Diffstat (limited to 'check')
-rwxr-xr-x | check | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -447,6 +447,11 @@ _global_log() { fi } +if [ -n "$REPORT_GCOV" ]; then + . ./common/gcov + _gcov_check_report_gcov +fi + _wrapup() { seq="check" @@ -523,6 +528,18 @@ _wrapup() "${#bad[*]}" "${#notrun[*]}" \ "$((sect_stop - sect_start))" fi + + # Generate code coverage report + if [ -n "$REPORT_GCOV" ]; then + # don't trigger multiple times if caller hits ^C + local gcov_report_dir="$REPORT_GCOV" + test "$gcov_report_dir" = "1" && \ + gcov_report_dir="$REPORT_DIR/gcov" + unset REPORT_GCOV + + _gcov_generate_report "$gcov_report_dir" + fi + needwrap=false fi @@ -797,6 +814,7 @@ function run_section() echo "MOUNT_OPTIONS -- `_scratch_mount_options`" fi echo + test -n "$REPORT_GCOV" && _gcov_reset needwrap=true if [ ! -z "$SCRATCH_DEV" ]; then |