blob: 2df744c991134fd5c8e6379633ccbfb7cdc68d64 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#!/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
if section not in coverage:
coverage[section] = []
sections = coverage.keys()
sections.sort()
print HEADER
for section in sections:
print section
for match in coverage[section]:
print match
print
|