Release coccinelle-0.2.0rc1
[bpt/coccinelle.git] / scripts / stat_directories.pl
1 #!/usr/bin/perl
2
3 #usage:
4 # cd tests-big;
5 # ~/coccinelle/scripts/stat_directories.pl bluetooth/* rules/* megas/*
6
7 printf "%-20s %10s %10s %4s\n", "dir/", "failed" , "total", "%ok";
8 print "------------------------------------------------------\n";
9
10 $totalfailed = 0;
11 $total = 0;
12
13 foreach my $dir (@ARGV) {
14
15 if(-e "$dir/") {
16 my ($ok) = `find $dir -name "*.c.*ok" | wc -l`;
17 # my ($ok) = `find $dir -name "*ok" | wc -l`;
18 chomp $ok;
19 my ($failed) = `find $dir -name "*.c.failed" | wc -l`;
20 # my ($failed) = `find $dir -name "*failed" | wc -l`;
21 chomp $failed;
22 $totalfailed += $failed;
23 my $sum = $failed + $ok;
24 $total += $sum;
25 if ($sum == 0) {
26 print "$dir/ have 0 sum\n";
27 } else {
28 my $pourcent = ($ok * 100.0) / ($sum);
29 printf "%-20s %10d %10d %5.1f%%\n", "$dir/", $failed, $sum, $pourcent;
30 }
31 }
32
33
34 }
35
36 my $pourcent = (($total - $totalfailed) * 100.0) / ($total);
37
38 print "------------------------------------------------------\n";
39 printf "total failed = %10d / %10d % 3.1f%%\n",
40 $totalfailed, $total, $pourcent;