my @coverageLogPathnames;
# First, look for files of the form tpxxx/tpxxx.log:
use File::Find;
my @testDirs;
my $testsDir_mixed = ToMixed::PathToMixed( $testsDir );
find( sub { push @testDirs, $File::Find::name if -d && /tp_\w+/i }, $testsDir_mixed );
foreach (@testDirs) {
m{^(.*)/(tp_\w+)}i;
my ($pathPrefix,$tpname) = ( $1 ? ($1,$2) : ('.',$_) );
my $covLogPathname = "$pathPrefix/$tpname/$tpname";
#print STDERR " // No coverage-logs/hitmaps found in test chekcing $covLogPathname\n" unless $found;
my $found = 0;
foreach my $suff ('log', 'bin', 'txt', 'dat') {
my $mixed = ToMixed::PathToMixed( "$covLogPathname" );
print STDERR " // No coverage-logs/hitmaps found in test chekcing $mixed\n" unless $found;
if ( -e "$mixed" ) {
push @coverageLogPathnames, "$covLogPathname.$suff";
print STDERR " // Found coverage output $covLogPathname.$suff\n";
++$found;
$foundone = $found;
}
}
print STDERR " // No coverage-logs/hitmaps found in test subdirectory $pathPrefix/$tpname\n" unless $found;
}
####
if ($foundone == 0) { # New option: search under the hitmaps-directory (one level only, any name in front)
my $covLogPathname = "$testsDir";
my @hitfiles;
my $covLogPathname_mixed = ToMixed::PathToMixed( $covLogPathname );
find( sub { push @hitfiles, $File::Find::name if -f }, $covLogPathname_mixed );
foreach (@hitfiles) {
my $foundfile = $_;
my ($base,$path,$suff) = fileparse( $foundfile, "\.(log|bin|txt|dat)" );
if ($suff ne "") {
push @coverageLogPathnames, "$foundfile";
print STDERR " // Found coverage output $foundfile\n";
}
}
}
####
# Second, look for logs named hitmap.(log|bin|txt):
find(
sub { if (-f && /^[-\w]*hitmap[-\w]*\.(log|bin|txt|dat)$/i) {
push @coverageLogPathnames, $File::Find::name;
print STDERR " // Found coverage output $File::Find::name\n";
}
},
$testsDir_mixed );
print STDERR " // Found coverage output hi4";
print STDERR " // Number of coverage logs found: ", (@coverageLogPathnames+0), "\n";
return \@coverageLogPathnames;
}