Release coccinelle-0.2.0
[bpt/coccinelle.git] / scripts / stat_directories.pl
1 # Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
2 # Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
3 # This file is part of Coccinelle.
4 #
5 # Coccinelle is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, according to version 2 of the License.
8 #
9 # Coccinelle is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with Coccinelle. If not, see <http://www.gnu.org/licenses/>.
16 #
17 # The authors reserve the right to distribute this or future versions of
18 # Coccinelle under other licenses.
19
20
21 #!/usr/bin/perl
22
23 #usage:
24 # cd tests-big;
25 # ~/coccinelle/scripts/stat_directories.pl bluetooth/* rules/* megas/*
26
27 printf "%-20s %10s %10s %4s\n", "dir/", "failed" , "total", "%ok";
28 print "------------------------------------------------------\n";
29
30 $totalfailed = 0;
31 $total = 0;
32
33 foreach my $dir (@ARGV) {
34
35 if(-e "$dir/") {
36 my ($ok) = `find $dir -name "*.c.*ok" | wc -l`;
37 # my ($ok) = `find $dir -name "*ok" | wc -l`;
38 chomp $ok;
39 my ($failed) = `find $dir -name "*.c.failed" | wc -l`;
40 # my ($failed) = `find $dir -name "*failed" | wc -l`;
41 chomp $failed;
42 $totalfailed += $failed;
43 my $sum = $failed + $ok;
44 $total += $sum;
45 if ($sum == 0) {
46 print "$dir/ have 0 sum\n";
47 } else {
48 my $pourcent = ($ok * 100.0) / ($sum);
49 printf "%-20s %10d %10d %5.1f%%\n", "$dir/", $failed, $sum, $pourcent;
50 }
51 }
52
53
54 }
55
56 my $pourcent = (($total - $totalfailed) * 100.0) / ($total);
57
58 print "------------------------------------------------------\n";
59 printf "total failed = %10d / %10d % 3.1f%%\n",
60 $totalfailed, $total, $pourcent;