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.
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.
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.
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/>.
17 # The authors reserve the right to distribute this or future versions of
18 # Coccinelle under other licenses.
25 my $ok = 0; #ok+spatch-ok
26 my $wrong = 0; #Error, file level
31 my $bugfix = 0; # site level ?
32 my $wrongsites = 0; # Error, site level
38 if(/\[status\]/) { $nbfiles++; }
40 if(/\[status\]\s*(spatch-ok|ok)\b/) { $ok++; }
41 if(/\[status\]\s*(wrong)\b/) { $wrong++; }
42 if(/\[status\]\s*(fail)\b/) { $fail++; }
44 if(/\[status\]\s*(UNKNOWN)\b/) { $unknown++; }
46 if(/Cocci\s+file\s*:\s*(\w+.cocci)/) { $SP = $1; }
50 my $pourcentcorrect = ($ok * 100.0) / $nbfiles;
52 print "----------------------------------------\n";
53 print "!!Total files = $nbfiles\n";
54 print " Correct number = $ok\n";
55 printf "!!Correct = %3.1f\%\n", $pourcentcorrect;
56 print "!!Error = $wrong\n";
57 print "!!Bugfix (sites) = $bugfix\n";
60 my $sizeSP = `cat $SP | perl -p -e "s/\\/\\/.*//g;" | grep -v '^[ \t]*\$' | wc -l`;
62 print "!!Size SP = $sizeSP\n";
64 my $gitinfo = `ls *.gitinfo`;
66 print " gitinfo files = $gitinfo\n";
68 my $sizeP = `cat *.gitinfo | wc -l`;
70 print " Size P = $sizeP\n";
72 my $ratioSPvsP = ($sizeSP * 100.0) / $sizeP;
73 printf "!!Ratio SP vs P = %3.1f\%\n", $ratioSPvsP;
75 my $ratioPvsSP = $sizeP / $sizeSP;
76 printf "!!Ratio SP vs P = %3.1f\n", $ratioPvsSP;
79 my $totalstatus = $ok + $fail + $wrong + $unknown;
80 print "----------------------------------------------------------------\n";
81 print "Sanity checks: nb files = $nbfiles, total status = $totalstatus\n";
82 print "NB UNKNOWNS = $unknown\n" if $unknown > 0;