summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2008-12-04 22:49:51 +0000
committerStef Walter <stef@memberwebs.com>2008-12-04 22:49:51 +0000
commit7d457091d456510c9710a8e7263c70035f4fe0fc (patch)
tree2779714608513540e525a3784e6e9ae16a737828 /doc
parentb929f7b5768f8d9b0dde5062059a365c0df88494 (diff)
Add test coverage documentation.
Diffstat (limited to 'doc')
-rw-r--r--doc/pkcs11-coverage.py55
-rw-r--r--doc/pkcs11-coverage.txt30
2 files changed, 85 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
diff --git a/doc/pkcs11-coverage.txt b/doc/pkcs11-coverage.txt
new file mode 100644
index 0000000..39aa5dc
--- /dev/null
+++ b/doc/pkcs11-coverage.txt
@@ -0,0 +1,30 @@
+
+C_Initialize
+ -
+ - Checks various locking styles.
+ - Checks double initialization.
+ - Various mutex functions have checks.
+
+C_Finalize
+ - Checks double calls.
+
+C_GetInfo
+ - Checks NULL argument.
+ - Space padding in CK_INFO strings.
+ - Cryptoki version matches that in CK_FUNCTION_LIST table.
+ -
+
+C_GetFunctionList
+ - Checks NULL arguments.
+ - Checks that results match library exported C_GetFunctionList.
+
+C_GetSlotList
+ - Calling with NULL arguments.
+ - Calling with extra memory.
+ - Calling with too little memory.
+
+C_GetSlotInfo
+ - Calling with NULL arguments.
+ - Padding
+
+