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.py34
1 files changed, 19 insertions, 15 deletions
diff --git a/doc/pkcs11-coverage.py b/doc/pkcs11-coverage.py
index 13d7b6c..55d831c 100644
--- a/doc/pkcs11-coverage.py
+++ b/doc/pkcs11-coverage.py
@@ -13,7 +13,7 @@ We're anxious to complete this, if you have patches please do contribute.
"""
# Matches a comment like /** comment */
-PATTERN = re.compile("""P11T_([A-Z_]+)\("(.+?)"""")
+PATTERN = re.compile(r'\bP11T_([A-Z_]+)\("(.+?)"')
os.chdir("../src")
@@ -23,26 +23,27 @@ files = [ name for name in os.listdir(".") if name[-2:] == ".c" ]
coverage = { }
for file in files:
- data = open(file).read()
+ lines = open(file).readlines()
section = ""
- # Find all the matching comments in this file
- matches = PATTERN.findall(data)
- for match in matches:
+ for line in lines:
- # Strip all the comment stuff out start and of the match
- match = match.strip(" /*\t\n\r")
+ match = PATTERN.search(line)
if not match:
continue
- if match[0] == '-' and section:
- coverage[section].append(match)
- continue
+ name = match.group(1)
+ value = match.group(2)
+
+ if name.find("SECTION") != -1:
+ section = value
+ if section not in coverage:
+ coverage[section] = []
+ elif name.find("CHECK") != -1:
+ if section in coverage:
+ coverage[section].append(value)
- section = match
- if section not in coverage:
- coverage[section] = []
sections = coverage.keys()
sections.sort()
@@ -51,6 +52,9 @@ print HEADER
for section in sections:
print section
- for match in coverage[section]:
- print match
+ checks = list(set(coverage[section]))
+ checks.sort()
+ for check in checks:
+ print " - %s" % check
print
+