Release coccinelle-0.2.0
[bpt/coccinelle.git] / scripts / extractor_README.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 use strict;
24
25 my $ok = 0; #ok+spatch-ok
26 my $wrong = 0; #Error, file level
27 my $fail = 0;
28 my $unknown = 0;
29 my $nbfiles = 0;
30
31 my $bugfix = 0; # site level ?
32 my $wrongsites = 0; # Error, site level
33
34 my $SP = "";
35
36 while(<>) {
37
38 if(/\[status\]/) { $nbfiles++; }
39
40 if(/\[status\]\s*(spatch-ok|ok)\b/) { $ok++; }
41 if(/\[status\]\s*(wrong)\b/) { $wrong++; }
42 if(/\[status\]\s*(fail)\b/) { $fail++; }
43
44 if(/\[status\]\s*(UNKNOWN)\b/) { $unknown++; }
45
46 if(/Cocci\s+file\s*:\s*(\w+.cocci)/) { $SP = $1; }
47
48 }
49
50 my $pourcentcorrect = ($ok * 100.0) / $nbfiles;
51
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";
58
59
60 my $sizeSP = `cat $SP | perl -p -e "s/\\/\\/.*//g;" | grep -v '^[ \t]*\$' | wc -l`;
61 chomp $sizeSP;
62 print "!!Size SP = $sizeSP\n";
63
64 my $gitinfo = `ls *.gitinfo`;
65 chomp $gitinfo;
66 print " gitinfo files = $gitinfo\n";
67
68 my $sizeP = `cat *.gitinfo | wc -l`;
69 chomp $sizeP;
70 print " Size P = $sizeP\n";
71
72 my $ratioSPvsP = ($sizeSP * 100.0) / $sizeP;
73 printf "!!Ratio SP vs P = %3.1f\%\n", $ratioSPvsP;
74
75 my $ratioPvsSP = $sizeP / $sizeSP;
76 printf "!!Ratio SP vs P = %3.1f\n", $ratioPvsSP;
77
78
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;