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