chiark / gitweb /
more coverage + doxygen
[disorder] / scripts / format-gcov-report
index f445329cffb9caa28b158a9fca00909ba7f2d5e0..e16239530632b035ed4b7e10f1397596e499d997 100755 (executable)
@@ -3,20 +3,18 @@
 # This file is part of DisOrder.
 # Copyright (C) 2007 Richard Kettlewell
 #
-# This program is free software; you can redistribute it and/or modify
+# This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 import re,sys,os,string
 
@@ -33,17 +31,20 @@ def sgmlquotechar(c):
 def sgmlquote(s):
   return string.join(map(sgmlquotechar, s),'')
 
+missing = {}
 percent = {}
 total_lines = 0
 covered_lines = 0
 args = sys.argv[1:]
 htmldir = None
-while len(args) > 0:
+while len(args) > 0 and re.match("^--", args[0]):
   if args[0] == "--html":
     htmldir = args[1]
     args = args[2:]
   else:
     fatal("unknown option '%s'" % args[0])
+for s in args:
+  missing[s] = True
 
 name = None
 for line in sys.stdin:
@@ -51,6 +52,8 @@ for line in sys.stdin:
   r = re.match("File ['`](?:.*/)?([^/]+.c)'", line)
   if r:
     name = r.group(1)
+    if name in missing:
+      del missing[name]
   r = re.match("Lines executed:([0-9\\.]+)% of ([0-9]+)", line)
   if r:
     if name:
@@ -84,6 +87,14 @@ if htmldir is not None and len(keys):
                 (sgmlquote(k), sgmlquote(k), percent[k]))
   index.write("</table>\n")
   index.write("<p>Total coverage: %d%%</p>\n" % (100 * (covered_lines / total_lines)))
+  missing_files = missing.keys()
+  missing_files.sort()
+  if len(missing_files) > 0:
+    index.write("<p>Missing files:</p>\n")
+    index.write("<ul>\n")
+    for mf in missing_files:
+      index.write("<li><a href=\"%s\">%s</a></li>\n" % (mf, mf))
+    index.write("</lu>\n")
   for k in keys:
     html = open(os.path.join(htmldir, "%s.html" % k), "w")
     html.write("<html><head><title>%s</title>\n" % sgmlquote(k))