summaryrefslogtreecommitdiff
path: root/common/tests/get-cov.pl
diff options
context:
space:
mode:
Diffstat (limited to 'common/tests/get-cov.pl')
-rwxr-xr-xcommon/tests/get-cov.pl50
1 files changed, 50 insertions, 0 deletions
diff --git a/common/tests/get-cov.pl b/common/tests/get-cov.pl
new file mode 100755
index 0000000000..273db8509c
--- /dev/null
+++ b/common/tests/get-cov.pl
@@ -0,0 +1,50 @@
+#!/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 (<FILE>)
+ {
+ if (/^SF:/)
+ {
+ close FILE;
+ return 1;
+ }
+ }
+ close FILE;
+ return 0;
+}
+
+# Read tests file.
+while (<STDIN>)
+{
+ 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";
+ }
+}