199a5d
From 1241f2005d08673c28a595c5a6cd61350b95a929 Mon Sep 17 00:00:00 2001
199a5d
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
199a5d
Date: Tue, 2 Jan 2018 18:13:07 +0100
199a5d
Subject: [PATCH] Fix pkcs11 variants atf tests
199a5d
199a5d
Add dns-pkcs11 tests Makefile to configure
199a5d
199a5d
Add pkcs11 Kyuafile, fix dh_test to pass in pkcs11 mode
199a5d
---
199a5d
 configure.ac                   | 1 +
199a5d
 lib/Kyuafile                   | 2 ++
199a5d
 lib/dns-pkcs11/tests/dh_test.c | 3 ++-
199a5d
 3 files changed, 5 insertions(+), 1 deletion(-)
199a5d
199a5d
diff --git a/configure.ac b/configure.ac
199a5d
index d80ae31..0fb9328 100644
199a5d
--- a/configure.ac
199a5d
+++ b/configure.ac
199a5d
@@ -3090,6 +3090,7 @@ AC_CONFIG_FILES([
199a5d
 	lib/dns-pkcs11/include/Makefile
199a5d
 	lib/dns-pkcs11/include/dns/Makefile
199a5d
 	lib/dns-pkcs11/include/dst/Makefile
199a5d
+	lib/dns-pkcs11/tests/Makefile
199a5d
 	lib/irs/Makefile
199a5d
 	lib/irs/include/Makefile
199a5d
 	lib/irs/include/irs/Makefile
199a5d
diff --git a/lib/Kyuafile b/lib/Kyuafile
199a5d
index 39ce986..037e5ef 100644
199a5d
--- a/lib/Kyuafile
199a5d
+++ b/lib/Kyuafile
199a5d
@@ -2,8 +2,10 @@ syntax(2)
199a5d
 test_suite('bind9')
199a5d
 
199a5d
 include('dns/Kyuafile')
199a5d
+include('dns-pkcs11/Kyuafile')
199a5d
 include('irs/Kyuafile')
199a5d
 include('isc/Kyuafile')
199a5d
 include('isccc/Kyuafile')
199a5d
 include('isccfg/Kyuafile')
199a5d
 include('ns/Kyuafile')
199a5d
+include('ns-pkcs11/Kyuafile')
199a5d
diff --git a/lib/dns-pkcs11/tests/dh_test.c b/lib/dns-pkcs11/tests/dh_test.c
199a5d
index 934e8fd..658d1af 100644
199a5d
--- a/lib/dns-pkcs11/tests/dh_test.c
199a5d
+++ b/lib/dns-pkcs11/tests/dh_test.c
199a5d
@@ -87,7 +87,8 @@ dh_computesecret(void **state) {
199a5d
 	result = dst_key_computesecret(key, key, &buf;;
199a5d
 	assert_int_equal(result, DST_R_NOTPRIVATEKEY);
199a5d
 	result = key->func->computesecret(key, key, &buf;;
199a5d
-	assert_int_equal(result, DST_R_COMPUTESECRETFAILURE);
199a5d
+	/* PKCS11 variant gives different result, accept both */
199a5d
+	assert_true(result == DST_R_COMPUTESECRETFAILURE || result == DST_R_INVALIDPRIVATEKEY);
199a5d
 
199a5d
 	dst_key_free(&key);
199a5d
 }
199a5d
-- 
199a5d
2.20.1
199a5d