Release coccinelle-0.2.0rc1
[bpt/coccinelle.git] / scripts / stat_directories.pl
CommitLineData
34e49164
C
1#!/usr/bin/perl
2
3#usage:
4# cd tests-big;
5# ~/coccinelle/scripts/stat_directories.pl bluetooth/* rules/* megas/*
6
7printf "%-20s %10s %10s %4s\n", "dir/", "failed" , "total", "%ok";
8print "------------------------------------------------------\n";
9
10$totalfailed = 0;
11$total = 0;
12
13foreach 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
36my $pourcent = (($total - $totalfailed) * 100.0) / ($total);
37
38print "------------------------------------------------------\n";
39printf "total failed = %10d / %10d % 3.1f%%\n",
40 $totalfailed, $total, $pourcent;