Release coccinelle-0.2.0
[bpt/coccinelle.git] / scripts / extractor_README.pl
CommitLineData
9f8e26f4
C
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
34e49164
C
21#!/usr/bin/perl
22
23use strict;
24
25my $ok = 0; #ok+spatch-ok
26my $wrong = 0; #Error, file level
27my $fail = 0;
28my $unknown = 0;
29my $nbfiles = 0;
30
31my $bugfix = 0; # site level ?
32my $wrongsites = 0; # Error, site level
33
34my $SP = "";
35
36while(<>) {
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
50my $pourcentcorrect = ($ok * 100.0) / $nbfiles;
51
52print "----------------------------------------\n";
53print "!!Total files = $nbfiles\n";
54print " Correct number = $ok\n";
55printf "!!Correct = %3.1f\%\n", $pourcentcorrect;
56print "!!Error = $wrong\n";
57print "!!Bugfix (sites) = $bugfix\n";
58
59
60my $sizeSP = `cat $SP | perl -p -e "s/\\/\\/.*//g;" | grep -v '^[ \t]*\$' | wc -l`;
61chomp $sizeSP;
62print "!!Size SP = $sizeSP\n";
63
64my $gitinfo = `ls *.gitinfo`;
65chomp $gitinfo;
66print " gitinfo files = $gitinfo\n";
67
68my $sizeP = `cat *.gitinfo | wc -l`;
69chomp $sizeP;
70print " Size P = $sizeP\n";
71
72my $ratioSPvsP = ($sizeSP * 100.0) / $sizeP;
73printf "!!Ratio SP vs P = %3.1f\%\n", $ratioSPvsP;
74
75my $ratioPvsSP = $sizeP / $sizeSP;
76printf "!!Ratio SP vs P = %3.1f\n", $ratioPvsSP;
77
78
79my $totalstatus = $ok + $fail + $wrong + $unknown;
80print "----------------------------------------------------------------\n";
81print "Sanity checks: nb files = $nbfiles, total status = $totalstatus\n";
82print "NB UNKNOWNS = $unknown\n" if $unknown > 0;