From b060495bb4a21fafa7544739a42eefd488e887f3 Mon Sep 17 00:00:00 2001 From: Michael Rash Date: Sun, 23 Aug 2015 20:32:59 -0700 Subject: [PATCH] [test suite] rm previous coverage files in coverage mode when --include criteria is not used --- Makefile.am | 1 + test/init-lcov.sh | 3 +++ test/rm-coverage-files.sh | 12 ++++++++++++ test/test-fwknop.pl | 8 ++++++++ 4 files changed, 24 insertions(+) create mode 100755 test/rm-coverage-files.sh diff --git a/Makefile.am b/Makefile.am index 6ed2e9b1..fe14ee66 100644 --- a/Makefile.am +++ b/Makefile.am @@ -455,6 +455,7 @@ EXTRA_DIST = \ test/configure_max_coverage.sh \ test/gen-coverage-report.sh \ test/init-lcov.sh \ + test/rm-coverage-files.sh \ test/lcov.env \ test/configure_max_coverage.sh \ test/README \ diff --git a/test/init-lcov.sh b/test/init-lcov.sh index 8d454ff5..3cb15659 100755 --- a/test/init-lcov.sh +++ b/test/init-lcov.sh @@ -4,6 +4,9 @@ cd .. [ ! -d $TOP_DIR ] && mkdir $TOP_DIR +[ -f $LCOV_BASE ] && rm -f $LCOV_BASE +[ -f $LCOV_INFO ] && rm -f $LCOV_INFO +[ -f $LCOV_INFO_FINAL ] && rm -f $LCOV_INFO_FINAL [ -d $LCOV_RESULTS_DIR ] && rm -rf $LCOV_RESULTS_DIR [ ! -d $LCOV_RESULTS_DIR ] && mkdir $LCOV_RESULTS_DIR diff --git a/test/rm-coverage-files.sh b/test/rm-coverage-files.sh new file mode 100755 index 00000000..9bb474dc --- /dev/null +++ b/test/rm-coverage-files.sh @@ -0,0 +1,12 @@ +#!/bin/sh -x + +cd .. +for d in client server lib +do + for s in *.gcda *.gcno *.gcov + do + find $d -name $s | xargs rm -f + done +done +cd test +exit diff --git a/test/test-fwknop.pl b/test/test-fwknop.pl index b701c6a9..2d5c368c 100755 --- a/test/test-fwknop.pl +++ b/test/test-fwknop.pl @@ -247,6 +247,8 @@ my $enable_profile_coverage_check = 0; my $enable_profile_coverage_init = 0; my $profile_gen_report_sh = './gen-coverage-report.sh'; my $profile_init_sh = './init-lcov.sh'; +my $profile_rm_files_sh = './rm-coverage-files.sh'; +my $do_rm_coverage_files = 0; my $enable_make_distcheck = 0; my $enable_perl_module_checks = 0; my $enable_perl_module_fuzzing_spa_pkt_generation = 0; @@ -6888,6 +6890,8 @@ sub init() { unlink $init_file if -e $init_file; unlink $logfile if -e $logfile; + $do_rm_coverage_files = 1 unless @tests_to_include; + ### always restore the gpg directories before tests are ### executed &restore_gpg_dirs(); @@ -7115,6 +7119,10 @@ sub init() { print "[-] Warning: --enable-profile-coverage not ", "found, use ./configure --enable-profile-coverage?\n"; } + if ($do_rm_coverage_files) { + &run_cmd($profile_rm_files_sh, $cmd_out_tmp, + $curr_test_file); + } &run_cmd($profile_init_sh, $cmd_out_tmp, $curr_test_file); } push @tests_to_exclude, qr/distcheck/;