summaryrefslogtreecommitdiff
path: root/doc/pkcs11-coverage.py
diff options
context:
space:
mode:
Diffstat (limited to 'doc/pkcs11-coverage.py')
-rw-r--r--doc/pkcs11-coverage.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/doc/pkcs11-coverage.py b/doc/pkcs11-coverage.py
new file mode 100644
index 0000000..2184cee
--- /dev/null
+++ b/doc/pkcs11-coverage.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+
+import os, sys
+import re
+
+HEADER = """
+
+PKCS#11 COVERAGE
+
+This is the test coverage of the p11-tests tool of the PKCS#11 interface.
+We're anxious to complete this, if you have patches please do contribute.
+
+"""
+
+# Matches a comment like /** comment */
+PATTERN = re.compile(r"/\*\*.*?\*/")
+
+os.chdir("../src")
+
+# All the *.c files
+files = [ name for name in os.listdir(".") if name[-2:] == ".c" ]
+
+coverage = { }
+
+for file in files:
+ data = open(file).read()
+
+ section = ""
+
+ # Find all the matching comments in this file
+ matches = PATTERN.findall(data)
+ for match in matches:
+
+ # Strip all the comment stuff out start and of the match
+ match = match.strip(" /*\t\n\r")
+ if not match:
+ continue
+
+ if match[0] == '-' and section:
+ coverage[section].append(match)
+ continue
+
+ section = match
+ coverage[section] = []
+
+sections = coverage.keys()
+sections.sort()
+
+print HEADER
+
+for section in sections:
+ print section
+ for match in coverage[section]:
+ print match
+ print