#!/usr/bin/perl # # Get the list of coverage trace files. # use strict; use warnings; my $base = shift @ARGV; my $dir; my $fail = 0; # Return truth if the given info file contains at least one trace # information. sub not_empty { my $f = shift; open FILE, "<$f" or die; while () { if (/^SF:/) { close FILE; return 1; } } close FILE; return 0; } # Read tests file. while () { chomp; # Drop comments. next if /^\s*(?:#.*)?$/; if (/^(.*):(:)?$/) { # Directory line. $dir = $1; -d "$base/$dir" or die "cannot change directory"; } elsif (/^cov.*? (.*?): .*$/) { # Coverage test line. my $f = "$base/$dir/obj/$1.info"; -f $f && not_empty ($f) and print "$f\n"; } }