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