Coccinelle release-1.0.0-rc11
[bpt/coccinelle.git] / scripts / extractor_README.pl
CommitLineData
17ba0788
C
1# Copyright 2012, INRIA
2# Julia Lawall, Gilles Muller
3# Copyright 2010-2011, INRIA, University of Copenhagen
f537ebc4
C
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
34e49164
C
25#!/usr/bin/perl
26
27use strict;
28
29my $ok = 0; #ok+spatch-ok
30my $wrong = 0; #Error, file level
31my $fail = 0;
32my $unknown = 0;
33my $nbfiles = 0;
34
35my $bugfix = 0; # site level ?
36my $wrongsites = 0; # Error, site level
37
38my $SP = "";
39
40while(<>) {
41
42 if(/\[status\]/) { $nbfiles++; }
43
44 if(/\[status\]\s*(spatch-ok|ok)\b/) { $ok++; }
45 if(/\[status\]\s*(wrong)\b/) { $wrong++; }
46 if(/\[status\]\s*(fail)\b/) { $fail++; }
47
48 if(/\[status\]\s*(UNKNOWN)\b/) { $unknown++; }
49
50 if(/Cocci\s+file\s*:\s*(\w+.cocci)/) { $SP = $1; }
51
52}
53
54my $pourcentcorrect = ($ok * 100.0) / $nbfiles;
55
56print "----------------------------------------\n";
57print "!!Total files = $nbfiles\n";
58print " Correct number = $ok\n";
59printf "!!Correct = %3.1f\%\n", $pourcentcorrect;
60print "!!Error = $wrong\n";
61print "!!Bugfix (sites) = $bugfix\n";
62
63
64my $sizeSP = `cat $SP | perl -p -e "s/\\/\\/.*//g;" | grep -v '^[ \t]*\$' | wc -l`;
65chomp $sizeSP;
66print "!!Size SP = $sizeSP\n";
67
68my $gitinfo = `ls *.gitinfo`;
69chomp $gitinfo;
70print " gitinfo files = $gitinfo\n";
71
72my $sizeP = `cat *.gitinfo | wc -l`;
73chomp $sizeP;
74print " Size P = $sizeP\n";
75
76my $ratioSPvsP = ($sizeSP * 100.0) / $sizeP;
77printf "!!Ratio SP vs P = %3.1f\%\n", $ratioSPvsP;
78
79my $ratioPvsSP = $sizeP / $sizeSP;
80printf "!!Ratio SP vs P = %3.1f\n", $ratioPvsSP;
81
82
83my $totalstatus = $ok + $fail + $wrong + $unknown;
84print "----------------------------------------------------------------\n";
85print "Sanity checks: nb files = $nbfiles, total status = $totalstatus\n";
86print "NB UNKNOWNS = $unknown\n" if $unknown > 0;