Skip to content

Commit 59ba5d6

Browse files
committed
Log '--no-external' exclusions: clarify tool action to (hopefully)
reduce confusion. Signed-off-by: Henry Cox <[email protected]>
1 parent e3f7395 commit 59ba5d6

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

bin/geninfo

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -562,13 +562,22 @@ $output_filename = catfile($cwd, $output_filename)
562562
# Build list of directories to identify external files
563563
foreach my $entry (@data_directory, $base_directory) {
564564
next if (!defined($entry));
565+
# do not apply substitution patterns to the dir name -
566+
# if user really wants that, they can specify a substitution and/or
567+
# include/exclude patterns
565568
my $p = solve_relative_path($cwd, $entry);
566-
push(@lcovutil::internal_dirs, $p);
569+
push(@lcovutil::internal_dirs, $p)
570+
unless grep($p, @lcovutil::internal_dirs);
567571
if (!file_name_is_absolute($entry) &&
568572
$entry ne $p) {
569-
push(@lcovutil::internal_dirs, $entry);
573+
push(@lcovutil::internal_dirs, $entry)
574+
unless grep($entry, @lcovutil::internal_dirs);
570575
}
571576
}
577+
if (@lcovutil::internal_dirs) {
578+
lcovutil::info("Recording 'internal' directories:\n\t" .
579+
join("\n\t", @internal_dirs) . "\n");
580+
}
572581

573582
# Function is_external() requires all internal_dirs to end with a slash
574583
foreach my $dir (@lcovutil::internal_dirs) {
@@ -3375,8 +3384,14 @@ sub filter_source_files($)
33753384

33763385
foreach my $filename (keys(%{$hash})) {
33773386
# Skip external files if requested
3378-
if (is_external($filename) ||
3387+
my $external = is_external($filename);
3388+
if ($external ||
33793389
TraceFile::skipCurrentFile($filename)) {
3390+
if ($external) {
3391+
lcovutil::info("Dropping 'external' file '$filename'\n");
3392+
} else {
3393+
lcovutil::info("Excluding file '$filename'\n");
3394+
}
33803395
# Remove file data
33813396
delete($hash->{$filename});
33823397
$lcovutil::excluded_files{$filename} = 1;

lib/lcovutil.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6186,6 +6186,7 @@ sub applyFilters
61866186
unless ('TraceInfo' eq ref($traceInfo));
61876187
my $source_file = $traceInfo->filename();
61886188
if (lcovutil::is_external($source_file)) {
6189+
lcovutil::info("excluding 'external' file '$source_file'\n");
61896190
delete($self->[FILES]->{$source_file});
61906191
next;
61916192
}

0 commit comments

Comments
 (0)