summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2016-02-27 21:54:51 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2016-02-27 22:26:39 +0100
commit4ea1269d2c46676c2ca7dffcaac9822295c2b0a9 (patch)
tree74610747f798496c60558e03c9ae1c95d2b153db
parentd9e4dffd4af6d66b1fcc4b7e22e3e81d940133cc (diff)
downloadgnutls-4ea1269d2c46676c2ca7dffcaac9822295c2b0a9.tar.gz
tests: enable softhsmv2 test suite by default
Also do not fatally fail with known softhsmv2 bugs.
-rw-r--r--tests/suite/pkcs11-chainverify.c4
-rw-r--r--tests/suite/pkcs11-is-known.c4
-rw-r--r--tests/suite/softhsm.h6
-rwxr-xr-xtests/suite/testpkcs11.softhsm1
-rw-r--r--tests/utils.c13
-rw-r--r--tests/utils.h2
6 files changed, 22 insertions, 8 deletions
diff --git a/tests/suite/pkcs11-chainverify.c b/tests/suite/pkcs11-chainverify.c
index 7b5d4ce755..ac2148b219 100644
--- a/tests/suite/pkcs11-chainverify.c
+++ b/tests/suite/pkcs11-chainverify.c
@@ -213,8 +213,8 @@ void doit(void)
GNUTLS_PKCS11_OBJ_FLAG_MARK_CA|
GNUTLS_PKCS11_OBJ_FLAG_LOGIN_SO);
if (ret < 0) {
- fail("gnutls_pkcs11_copy_x509_crt: %s\n", gnutls_strerror(ret));
- exit(1);
+ /* FIXME: this is a known softhsm v2.0.0 bug - remove this once our testsuite is updated */
+ fail_ignore("gnutls_pkcs11_copy_x509_crt: %s\n", gnutls_strerror(ret));
}
gnutls_x509_trust_list_init(&tl, 0);
diff --git a/tests/suite/pkcs11-is-known.c b/tests/suite/pkcs11-is-known.c
index 3f4c4a8b37..fc070032c2 100644
--- a/tests/suite/pkcs11-is-known.c
+++ b/tests/suite/pkcs11-is-known.c
@@ -381,8 +381,8 @@ void doit(void)
snprintf(name, sizeof(name), "test-ca%d", j);
ret = gnutls_pkcs11_copy_x509_crt(SOFTHSM_URL, certs[j], name, GNUTLS_PKCS11_OBJ_FLAG_MARK_TRUSTED|GNUTLS_PKCS11_OBJ_FLAG_MARK_CA|GNUTLS_PKCS11_OBJ_FLAG_LOGIN_SO);
if (ret < 0) {
- fail("gnutls_pkcs11_copy_x509_crt: %s\n", gnutls_strerror(ret));
- exit(1);
+ /* FIXME: this is a known softhsm v2.0.0 bug - remove this once our testsuite is updated */
+ fail_ignore("gnutls_pkcs11_copy_x509_crt: %s\n", gnutls_strerror(ret));
}
}
diff --git a/tests/suite/softhsm.h b/tests/suite/softhsm.h
index 7ad9860a70..3ac8167d74 100644
--- a/tests/suite/softhsm.h
+++ b/tests/suite/softhsm.h
@@ -23,7 +23,7 @@
#include <sys/stat.h>
-#define SOFTHSM_V1
+#define SOFTHSM_V2
#ifdef SOFTHSM_V1
# define SOFTHSM_URL "pkcs11:model=SoftHSM;manufacturer=SoftHSM;serial=1;token=test"
@@ -38,8 +38,8 @@
# define SOFTHSM_URL "pkcs11:model=SoftHSM%20v2;manufacturer=SoftHSM%20project;token=test"
# define LIB1 "/usr/lib64/pkcs11/libsofthsm2.so"
# define LIB2 "/usr/lib/pkcs11/libsofthsm2.so"
-# define LIB3 "/usr/lib/softhsm/libsofthsm.so"
-# define LIB4 "/usr/lib64/softhsm/libsofthsm.so"
+# define LIB3 "/usr/lib/softhsm/libsofthsm2.so"
+# define LIB4 "/usr/lib/x86_64-linux-gnu/softhsm/libsofthsm2.so"
# define SOFTHSM_BIN1 "/usr/bin/softhsm2-util"
# define SOFTHSM_BIN2 "/usr/local/bin/softhsm2-util"
# define SOFTHSM_ENV "SOFTHSM2_CONF"
diff --git a/tests/suite/testpkcs11.softhsm b/tests/suite/testpkcs11.softhsm
index a349af6d6e..3ec5076318 100755
--- a/tests/suite/testpkcs11.softhsm
+++ b/tests/suite/testpkcs11.softhsm
@@ -41,7 +41,6 @@ init_card () {
if test $? = 0; then
echo "softhsm2-util 2.0.0 is broken"
export BROKEN_SOFTHSM2=1
- exit 77
fi
fi
diff --git a/tests/utils.c b/tests/utils.c
index d6c54a0a1d..a0a0ea9354 100644
--- a/tests/utils.c
+++ b/tests/utils.c
@@ -68,6 +68,19 @@ void fail(const char *format, ...)
exit(1);
}
+void fail_ignore(const char *format, ...)
+{
+ char str[1024];
+ va_list arg_ptr;
+
+ va_start(arg_ptr, format);
+ vsnprintf(str, sizeof(str), format, arg_ptr);
+ va_end(arg_ptr);
+ fputs(str, stderr);
+ error_count++;
+ exit(77);
+}
+
void sec_sleep(int sec)
{
int ret;
diff --git a/tests/utils.h b/tests/utils.h
index e5949a7249..2e53d963ed 100644
--- a/tests/utils.h
+++ b/tests/utils.h
@@ -50,6 +50,8 @@ extern const char *pkcs3;
extern void fail(const char *format, ...)
__attribute__ ((format(printf, 1, 2)));
+extern void fail_ignore(const char *format, ...)
+ __attribute__ ((format(printf, 1, 2)));
extern void success(const char *format, ...)
__attribute__ ((format(printf, 1, 2)));