From 6daeaa08d0e7c7f49392cd9e419c74b6c8721811 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Tue, 25 Jun 2013 13:30:17 +0200 Subject: Fix running trust module tests under distcheck --- trust/tests/test-module.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'trust/tests') diff --git a/trust/tests/test-module.c b/trust/tests/test-module.c index 3d6c00b..f5d882e 100644 --- a/trust/tests/test-module.c +++ b/trust/tests/test-module.c @@ -762,18 +762,19 @@ test_remove_token (void) CK_ULONG count; CK_RV rv; - rv = test.module->C_OpenSession (test.slots[0], CKF_SERIAL_SESSION | CKF_RW_SESSION, NULL, NULL, &session); - assert (rv == CKR_OK); + rv = test.module->C_OpenSession (test.slots[0], CKF_SERIAL_SESSION, NULL, NULL, &session); + assert_num_eq (rv, CKR_OK); rv = test.module->C_FindObjectsInit (session, NULL, 0); - assert (rv == CKR_OK); + assert_num_eq (rv, CKR_OK); rv = test.module->C_FindObjects (session, &handle, 1, &count); - assert (rv == CKR_OK); + assert_num_eq (rv, CKR_OK); assert_num_eq (1, count); rv = test.module->C_DestroyObject (session, handle); - assert_num_eq (rv, CKR_FUNCTION_REJECTED); + if (rv != CKR_TOKEN_WRITE_PROTECTED) + assert_num_eq (rv, CKR_SESSION_READ_ONLY); } static void @@ -791,18 +792,19 @@ test_setattr_token (void) CK_ULONG count; CK_RV rv; - rv = test.module->C_OpenSession (test.slots[0], CKF_SERIAL_SESSION | CKF_RW_SESSION, NULL, NULL, &session); - assert (rv == CKR_OK); + rv = test.module->C_OpenSession (test.slots[0], CKF_SERIAL_SESSION, NULL, NULL, &session); + assert_num_eq (rv, CKR_OK); rv = test.module->C_FindObjectsInit (session, NULL, 0); - assert (rv == CKR_OK); + assert_num_eq (rv, CKR_OK); rv = test.module->C_FindObjects (session, &handle, 1, &count); - assert (rv == CKR_OK); + assert_num_eq (rv, CKR_OK); assert_num_eq (1, count); rv = test.module->C_SetAttributeValue (session, handle, original, 2); - assert_num_eq (rv, CKR_ATTRIBUTE_READ_ONLY); + if (rv != CKR_TOKEN_WRITE_PROTECTED) + assert_num_eq (rv, CKR_ATTRIBUTE_READ_ONLY); } static void -- cgit v1.1