From 7d457091d456510c9710a8e7263c70035f4fe0fc Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Thu, 4 Dec 2008 22:49:51 +0000 Subject: Add test coverage documentation. --- doc/pkcs11-coverage.py | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ doc/pkcs11-coverage.txt | 30 +++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 doc/pkcs11-coverage.py create mode 100644 doc/pkcs11-coverage.txt (limited to 'doc') 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 + + -- cgit v1.2.3