summaryrefslogtreecommitdiff
path: root/common/test.c
diff options
context:
space:
mode:
authorStef Walter <stef@thewalter.net>2013-06-14 22:00:42 +0200
committerStef Walter <stef@thewalter.net>2013-06-17 21:55:34 +0200
commit1caa8801f6d888befb3515d24171bf77a172a93c (patch)
tree69092d74137fbe3914552af52a4766e8592474ad /common/test.c
parentbfe10cd0660fd81d78c8c5ce3eaa7d1f046859e1 (diff)
downloadp11-kit-1caa8801f6d888befb3515d24171bf77a172a93c.tar.gz
trust: Writable module PKCS#11 token functions
Although we don't actually write anything out yet, make the various PKCS#11 functions behave properly when faced with requests to write to token objects
Diffstat (limited to 'common/test.c')
-rw-r--r--common/test.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/common/test.c b/common/test.c
index 122e78a..b6ad012 100644
--- a/common/test.c
+++ b/common/test.c
@@ -200,6 +200,7 @@ p11_test_run (int argc,
test_item *next;
int count;
int ret = 0;
+ int setup;
/* p11-kit specific stuff */
putenv ("P11_KIT_STRICT=1");
@@ -229,20 +230,27 @@ p11_test_run (int argc,
assert (item->type == TEST);
gl.last = item;
gl.number++;
+ setup = 0;
if (setjmp (gl.jump) == 0) {
if (fixture && fixture->x.fix.setup)
(fixture->x.fix.setup) (item->x.test.argument);
+ setup = 1;
+
assert (item->x.test.func);
(item->x.test.func)(item->x.test.argument);
- if (fixture && fixture->x.fix.teardown)
- (fixture->x.fix.teardown) (item->x.test.argument);
-
printf ("ok %d %s\n", gl.number, item->x.test.name);
}
+ if (setup) {
+ if (setjmp (gl.jump) == 0) {
+ if (fixture && fixture->x.fix.teardown)
+ (fixture->x.fix.teardown) (item->x.test.argument);
+ }
+ }
+
gl.last = NULL;
}