From e5f6b89e92e7630ae09f003ac9c162b8f267a071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Mon, 8 Jan 2018 17:16:38 +0100 Subject: [PATCH] Enable unit tests with kyua tool (#1532694) --- bind-9.11-kyua-pkcs11.patch | 191 ++++++++++++++++++++++++++++++++ bind-9.11-kyua-unit.patch | 65 +++++++++++ bind-9.11-kyua.patch | 209 ++++++++++++++++++++++++++++++++++++ bind.spec | 50 ++++++++- softhsm2.conf.in | 10 ++ 5 files changed, 520 insertions(+), 5 deletions(-) create mode 100644 bind-9.11-kyua-pkcs11.patch create mode 100644 bind-9.11-kyua-unit.patch create mode 100644 bind-9.11-kyua.patch create mode 100644 softhsm2.conf.in diff --git a/bind-9.11-kyua-pkcs11.patch b/bind-9.11-kyua-pkcs11.patch new file mode 100644 index 0000000..7567c2a --- /dev/null +++ b/bind-9.11-kyua-pkcs11.patch @@ -0,0 +1,191 @@ +From 55f9cce403c6aa66218fe50073419f20632de0ce Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= +Date: Tue, 2 Jan 2018 18:13:07 +0100 +Subject: [PATCH] Fix pkcs11 variants atf tests + +Add dns-pkcs11 tests Makefile to configure + +Add pkcs11 Kyuafile, fix dh_test to pass in pkcs11 mode +--- + configure.in | 1 + + lib/Kyuafile | 2 ++ + lib/dns-pkcs11/tests/Makefile.in | 10 +++++----- + lib/dns-pkcs11/tests/dh_test.c | 3 ++- + lib/isc-pkcs11/tests/Makefile.in | 6 +++--- + lib/isc-pkcs11/tests/hash_test.c | 32 +++++++++++++++++++++++++------- + 6 files changed, 38 insertions(+), 16 deletions(-) + +diff --git a/configure.in b/configure.in +index 0940743..692373e 100644 +--- a/configure.in ++++ b/configure.in +@@ -5252,6 +5252,7 @@ AC_CONFIG_FILES([ + lib/dns-pkcs11/include/Makefile + lib/dns-pkcs11/include/dns/Makefile + lib/dns-pkcs11/include/dst/Makefile ++ lib/dns-pkcs11/tests/Makefile + lib/irs/Makefile + lib/irs/include/Makefile + lib/irs/include/irs/Makefile +diff --git a/lib/Kyuafile b/lib/Kyuafile +index ff9fc56..eaaf0dc 100644 +--- a/lib/Kyuafile ++++ b/lib/Kyuafile +@@ -2,7 +2,9 @@ syntax(2) + test_suite('bind9') + + include('dns/Kyuafile') ++include('dns-pkcs11/Kyuafile') + include('irs/Kyuafile') + include('isc/Kyuafile') ++include('isc-pkcs11/Kyuafile') + include('isccfg/Kyuafile') + include('lwres/Kyuafile') +diff --git a/lib/dns-pkcs11/tests/Makefile.in b/lib/dns-pkcs11/tests/Makefile.in +index c7fd4ed..7b25d8c 100644 +--- a/lib/dns-pkcs11/tests/Makefile.in ++++ b/lib/dns-pkcs11/tests/Makefile.in +@@ -20,12 +20,12 @@ VERSION=@BIND9_VERSION@ + + CINCLUDES = -I. -Iinclude ${DNS_INCLUDES} ${ISC_INCLUDES} \ + @DST_OPENSSL_INC@ +-CDEFINES = @CRYPTO@ -DTESTS="\"${top_builddir}/lib/dns/tests/\"" ++CDEFINES = @CRYPTO@ -DTESTS="\"${top_builddir}/lib/dns-pkcs11/tests/\"" + +-ISCLIBS = ../../isc/libisc.@A@ +-ISCDEPLIBS = ../../isc/libisc.@A@ +-DNSLIBS = ../libdns.@A@ @DNS_CRYPTO_LIBS@ +-DNSDEPLIBS = ../libdns.@A@ ++ISCLIBS = ../../isc-pkcs11/libisc-pkcs11.@A@ ++ISCDEPLIBS = ../../isc-pkcs11/libisc-pkcs11.@A@ ++DNSLIBS = ../libdns-pkcs11.@A@ @DNS_CRYPTO_LIBS@ ++DNSDEPLIBS = ../libdns-pkcs11.@A@ + + LIBS = @LIBS@ @ATFLIBS@ + +diff --git a/lib/dns-pkcs11/tests/dh_test.c b/lib/dns-pkcs11/tests/dh_test.c +index 036d27a..eb6554f 100644 +--- a/lib/dns-pkcs11/tests/dh_test.c ++++ b/lib/dns-pkcs11/tests/dh_test.c +@@ -63,7 +63,8 @@ ATF_TC_BODY(isc_dh_computesecret, tc) { + ret = dst_key_computesecret(key, key, &buf); + ATF_REQUIRE_EQ(ret, DST_R_NOTPRIVATEKEY); + ret = key->func->computesecret(key, key, &buf); +- ATF_REQUIRE_EQ(ret, DST_R_COMPUTESECRETFAILURE); ++ /* PKCS11 variant gives different result, accept both */ ++ ATF_REQUIRE(ret == DST_R_COMPUTESECRETFAILURE || ret == DST_R_INVALIDPRIVATEKEY); + + dst_key_free(&key); + dns_test_end(); +diff --git a/lib/isc-pkcs11/tests/Makefile.in b/lib/isc-pkcs11/tests/Makefile.in +index 500e853..8b02f03 100644 +--- a/lib/isc-pkcs11/tests/Makefile.in ++++ b/lib/isc-pkcs11/tests/Makefile.in +@@ -17,10 +17,10 @@ VERSION=@BIND9_VERSION@ + @BIND9_MAKE_INCLUDES@ + + CINCLUDES = -I. -Iinclude ${ISC_INCLUDES} @ISC_OPENSSL_INC@ +-CDEFINES = @CRYPTO@ -DTESTS="\"${top_builddir}/lib/isc/tests/\"" ++CDEFINES = @CRYPTO@ -DTESTS="\"${top_builddir}/lib/isc-pkcs11/tests/\"" + +-ISCLIBS = ../libisc.@A@ @ISC_OPENSSL_LIBS@ +-ISCDEPLIBS = ../libisc.@A@ ++ISCLIBS = ../libisc-pkcs11.@A@ @ISC_OPENSSL_LIBS@ ++ISCDEPLIBS = ../libisc-pkcs11.@A@ + + LIBS = @LIBS@ @ATFLIBS@ + +diff --git a/lib/isc-pkcs11/tests/hash_test.c b/lib/isc-pkcs11/tests/hash_test.c +index 0c287e8..bd56d4d 100644 +--- a/lib/isc-pkcs11/tests/hash_test.c ++++ b/lib/isc-pkcs11/tests/hash_test.c +@@ -78,7 +78,7 @@ typedef struct hash_testcase { + + typedef struct hash_test_key { + const char *key; +- const int len; ++ const unsigned len; + } hash_test_key_t; + + /* non-hmac tests */ +@@ -961,8 +961,11 @@ ATF_TC_BODY(isc_hmacsha1, tc) { + hash_test_key_t *test_key = test_keys; + + while (testcase->input != NULL && testcase->result != NULL) { ++ int len = ISC_MAX(test_key->len, ISC_SHA1_DIGESTLENGTH); ++ ++ memset(buffer, 0, ISC_SHA1_DIGESTLENGTH); + memmove(buffer, test_key->key, test_key->len); +- isc_hmacsha1_init(&hmacsha1, buffer, test_key->len); ++ isc_hmacsha1_init(&hmacsha1, buffer, len); + isc_hmacsha1_update(&hmacsha1, + (const isc_uint8_t *) testcase->input, + testcase->input_len); +@@ -1124,8 +1127,11 @@ ATF_TC_BODY(isc_hmacsha224, tc) { + hash_test_key_t *test_key = test_keys; + + while (testcase->input != NULL && testcase->result != NULL) { ++ int len = ISC_MAX(test_key->len, ISC_SHA224_DIGESTLENGTH); ++ ++ memset(buffer, 0, ISC_SHA224_DIGESTLENGTH); + memmove(buffer, test_key->key, test_key->len); +- isc_hmacsha224_init(&hmacsha224, buffer, test_key->len); ++ isc_hmacsha224_init(&hmacsha224, buffer, len); + isc_hmacsha224_update(&hmacsha224, + (const isc_uint8_t *) testcase->input, + testcase->input_len); +@@ -1287,8 +1293,11 @@ ATF_TC_BODY(isc_hmacsha256, tc) { + hash_test_key_t *test_key = test_keys; + + while (testcase->input != NULL && testcase->result != NULL) { ++ int len = ISC_MAX(test_key->len, ISC_SHA256_DIGESTLENGTH); ++ ++ memset(buffer, 0, ISC_SHA256_DIGESTLENGTH); + memmove(buffer, test_key->key, test_key->len); +- isc_hmacsha256_init(&hmacsha256, buffer, test_key->len); ++ isc_hmacsha256_init(&hmacsha256, buffer, len); + isc_hmacsha256_update(&hmacsha256, + (const isc_uint8_t *) testcase->input, + testcase->input_len); +@@ -1456,8 +1465,11 @@ ATF_TC_BODY(isc_hmacsha384, tc) { + hash_test_key_t *test_key = test_keys; + + while (testcase->input != NULL && testcase->result != NULL) { ++ int len = ISC_MAX(test_key->len, ISC_SHA384_DIGESTLENGTH); ++ ++ memset(buffer, 0, ISC_SHA384_DIGESTLENGTH); + memmove(buffer, test_key->key, test_key->len); +- isc_hmacsha384_init(&hmacsha384, buffer, test_key->len); ++ isc_hmacsha384_init(&hmacsha384, buffer, len); + isc_hmacsha384_update(&hmacsha384, + (const isc_uint8_t *) testcase->input, + testcase->input_len); +@@ -1625,8 +1637,11 @@ ATF_TC_BODY(isc_hmacsha512, tc) { + hash_test_key_t *test_key = test_keys; + + while (testcase->input != NULL && testcase->result != NULL) { ++ int len = ISC_MAX(test_key->len, ISC_SHA512_DIGESTLENGTH); ++ ++ memset(buffer, 0, ISC_SHA512_DIGESTLENGTH); + memmove(buffer, test_key->key, test_key->len); +- isc_hmacsha512_init(&hmacsha512, buffer, test_key->len); ++ isc_hmacsha512_init(&hmacsha512, buffer, len); + isc_hmacsha512_update(&hmacsha512, + (const isc_uint8_t *) testcase->input, + testcase->input_len); +@@ -1769,8 +1784,11 @@ ATF_TC_BODY(isc_hmacmd5, tc) { + hash_test_key_t *test_key = test_keys; + + while (testcase->input != NULL && testcase->result != NULL) { ++ int len = ISC_MAX(test_key->len, ISC_MD5_DIGESTLENGTH); ++ ++ memset(buffer, 0, ISC_MD5_DIGESTLENGTH); + memmove(buffer, test_key->key, test_key->len); +- isc_hmacmd5_init(&hmacmd5, buffer, test_key->len); ++ isc_hmacmd5_init(&hmacmd5, buffer, len); + isc_hmacmd5_update(&hmacmd5, + (const isc_uint8_t *) testcase->input, + testcase->input_len); +-- +2.14.3 + diff --git a/bind-9.11-kyua-unit.patch b/bind-9.11-kyua-unit.patch new file mode 100644 index 0000000..3acb1c1 --- /dev/null +++ b/bind-9.11-kyua-unit.patch @@ -0,0 +1,65 @@ +From cb616c6d5c2ece1fac37fa6e0bca2b53d4043098 Mon Sep 17 00:00:00 2001 +From: Mark Andrews +Date: Tue, 2 Jan 2018 10:20:58 +1100 +Subject: [PATCH] 4851. [port] Support using kyua as well as atf-run + to run the unit tests. [RT #46853] + +(cherry picked from commit ccb5678066ea0055012352df5011ce2aa44e0eb0) +--- + unit/unittest.sh.in | 26 +++++++++++++++++++++++--- + 1 file changed, 23 insertions(+), 3 deletions(-) + +diff --git a/unit/unittest.sh.in b/unit/unittest.sh.in +index 899e00e..de304c6 100644 +--- a/unit/unittest.sh.in ++++ b/unit/unittest.sh.in +@@ -2,17 +2,19 @@ + + PATH="@ATFBIN@:${PATH}" + export PATH ++ATFRUN=`type atf-run 2>/dev/null | awk '{print $3}'` ++KYUA=`type kyua 2>/dev/null | awk '{print $3}'` + + status=0 +-if [ -n "@ATFBIN@" -a -f Atffile ] ++if [ -n "@UNITTESTS@" -a -x "$ATFRUN" -a -f Atffile ] + then + echo "S:unit:`date`" +- echo "T:unit:1:A" ++ echo "T:unit:1:A" + echo "I: unit tests" + atf-run > atf.out + status=$? + +- # | cat is there to force non-fancy output ++ # | cat is there to force non-fancy output + atf-report < atf.out | cat + + if [ $status -eq 0 ] +@@ -23,5 +25,23 @@ then + echo R:FAIL + fi + echo "E:unit:`date`" ++elif [ -n "@UNITTESTS@" -a -x "$KYUA" -a -f Kyuafile ] ++then ++ echo "S:unit:`date`" ++ echo "T:unit:1:A" ++ echo "I: unit tests" ++ kyua --logfile kyua.log test ++ status=$? ++ ++ kyua report ++ ++ if [ $status -eq 0 ] ++ then ++ rm -f kyua.log ++ echo R:PASS ++ else ++ echo R:FAIL ++ fi ++ echo "E:unit:`date`" + fi + exit $status +-- +2.9.5 + diff --git a/bind-9.11-kyua.patch b/bind-9.11-kyua.patch new file mode 100644 index 0000000..af37219 --- /dev/null +++ b/bind-9.11-kyua.patch @@ -0,0 +1,209 @@ +From b93950dff6b3bf02225ad64d7c3e02e6b04917fd Mon Sep 17 00:00:00 2001 +From: Tinderbox User +Date: Fri, 29 Dec 2017 02:23:11 +0000 +Subject: [PATCH] regen v9_11 + +--- + Kyuafile | 4 ++++ + lib/Kyuafile | 8 ++++++++ + lib/dns/Kyuafile | 4 ++++ + lib/dns/tests/Kyuafile | 30 ++++++++++++++++++++++++++++++ + lib/irs/Kyuafile | 4 ++++ + lib/irs/tests/Kyuafile | 4 ++++ + lib/isc/Kyuafile | 4 ++++ + lib/isc/tests/Kyuafile | 28 ++++++++++++++++++++++++++++ + lib/isccfg/Kyuafile | 4 ++++ + lib/isccfg/tests/Kyuafile | 4 ++++ + lib/lwres/Kyuafile | 4 ++++ + lib/lwres/tests/Kyuafile | 4 ++++ + 12 files changed, 102 insertions(+) + create mode 100644 Kyuafile + create mode 100644 lib/Kyuafile + create mode 100644 lib/dns/Kyuafile + create mode 100644 lib/dns/tests/Kyuafile + create mode 100644 lib/irs/Kyuafile + create mode 100644 lib/irs/tests/Kyuafile + create mode 100644 lib/isc/Kyuafile + create mode 100644 lib/isc/tests/Kyuafile + create mode 100644 lib/isccfg/Kyuafile + create mode 100644 lib/isccfg/tests/Kyuafile + create mode 100644 lib/lwres/Kyuafile + create mode 100644 lib/lwres/tests/Kyuafile + +diff --git a/Kyuafile b/Kyuafile +new file mode 100644 +index 0000000..70b2cff +--- /dev/null ++++ b/Kyuafile +@@ -0,0 +1,4 @@ ++syntax(2) ++test_suite('bind9') ++ ++include('lib/Kyuafile') +diff --git a/lib/Kyuafile b/lib/Kyuafile +new file mode 100644 +index 0000000..ff9fc56 +--- /dev/null ++++ b/lib/Kyuafile +@@ -0,0 +1,8 @@ ++syntax(2) ++test_suite('bind9') ++ ++include('dns/Kyuafile') ++include('irs/Kyuafile') ++include('isc/Kyuafile') ++include('isccfg/Kyuafile') ++include('lwres/Kyuafile') +diff --git a/lib/dns/Kyuafile b/lib/dns/Kyuafile +new file mode 100644 +index 0000000..0739e3a +--- /dev/null ++++ b/lib/dns/Kyuafile +@@ -0,0 +1,4 @@ ++syntax(2) ++test_suite('bind9') ++ ++include('tests/Kyuafile') +diff --git a/lib/dns/tests/Kyuafile b/lib/dns/tests/Kyuafile +new file mode 100644 +index 0000000..72a581b +--- /dev/null ++++ b/lib/dns/tests/Kyuafile +@@ -0,0 +1,30 @@ ++syntax(2) ++test_suite('bind9') ++ ++atf_test_program{name='acl_test'} ++atf_test_program{name='db_test'} ++atf_test_program{name='dbdiff_test'} ++atf_test_program{name='dbiterator_test'} ++atf_test_program{name='dbversion_test'} ++atf_test_program{name='dh_test'} ++atf_test_program{name='dispatch_test'} ++atf_test_program{name='dnstap_test'} ++atf_test_program{name='geoip_test'} ++atf_test_program{name='gost_test'} ++atf_test_program{name='keytable_test'} ++atf_test_program{name='master_test'} ++atf_test_program{name='name_test'} ++atf_test_program{name='nsec3_test'} ++atf_test_program{name='peer_test'} ++atf_test_program{name='private_test'} ++atf_test_program{name='rbt_serialize_test'} ++atf_test_program{name='rbt_test'} ++atf_test_program{name='rdata_test'} ++atf_test_program{name='rdataset_test'} ++atf_test_program{name='rdatasetstats_test'} ++atf_test_program{name='rsa_test'} ++atf_test_program{name='time_test'} ++atf_test_program{name='tsig_test'} ++atf_test_program{name='update_test'} ++atf_test_program{name='zonemgr_test'} ++atf_test_program{name='zt_test'} +diff --git a/lib/irs/Kyuafile b/lib/irs/Kyuafile +new file mode 100644 +index 0000000..0739e3a +--- /dev/null ++++ b/lib/irs/Kyuafile +@@ -0,0 +1,4 @@ ++syntax(2) ++test_suite('bind9') ++ ++include('tests/Kyuafile') +diff --git a/lib/irs/tests/Kyuafile b/lib/irs/tests/Kyuafile +new file mode 100644 +index 0000000..4ef7136 +--- /dev/null ++++ b/lib/irs/tests/Kyuafile +@@ -0,0 +1,4 @@ ++syntax(2) ++test_suite('bind9') ++ ++atf_test_program{name='resconf_test'} +diff --git a/lib/isc/Kyuafile b/lib/isc/Kyuafile +new file mode 100644 +index 0000000..0739e3a +--- /dev/null ++++ b/lib/isc/Kyuafile +@@ -0,0 +1,4 @@ ++syntax(2) ++test_suite('bind9') ++ ++include('tests/Kyuafile') +diff --git a/lib/isc/tests/Kyuafile b/lib/isc/tests/Kyuafile +new file mode 100644 +index 0000000..c558cbc +--- /dev/null ++++ b/lib/isc/tests/Kyuafile +@@ -0,0 +1,28 @@ ++syntax(2) ++test_suite('bind9') ++ ++atf_test_program{name='aes_test'} ++atf_test_program{name='buffer_test'} ++atf_test_program{name='counter_test'} ++atf_test_program{name='errno_test'} ++atf_test_program{name='file_test'} ++atf_test_program{name='hash_test'} ++atf_test_program{name='ht_test'} ++atf_test_program{name='lex_test'} ++atf_test_program{name='mem_test'} ++atf_test_program{name='netaddr_test'} ++atf_test_program{name='parse_test'} ++atf_test_program{name='pool_test'} ++atf_test_program{name='print_test'} ++atf_test_program{name='queue_test'} ++atf_test_program{name='radix_test'} ++atf_test_program{name='random_test'} ++atf_test_program{name='regex_test'} ++atf_test_program{name='result_test'} ++atf_test_program{name='safe_test'} ++atf_test_program{name='sockaddr_test'} ++atf_test_program{name='socket_test'} ++atf_test_program{name='symtab_test'} ++atf_test_program{name='task_test'} ++atf_test_program{name='taskpool_test'} ++atf_test_program{name='time_test'} +diff --git a/lib/isccfg/Kyuafile b/lib/isccfg/Kyuafile +new file mode 100644 +index 0000000..0739e3a +--- /dev/null ++++ b/lib/isccfg/Kyuafile +@@ -0,0 +1,4 @@ ++syntax(2) ++test_suite('bind9') ++ ++include('tests/Kyuafile') +diff --git a/lib/isccfg/tests/Kyuafile b/lib/isccfg/tests/Kyuafile +new file mode 100644 +index 0000000..342d25f +--- /dev/null ++++ b/lib/isccfg/tests/Kyuafile +@@ -0,0 +1,4 @@ ++syntax(2) ++test_suite('bind9') ++ ++atf_test_program{name='parser_test'} +diff --git a/lib/lwres/Kyuafile b/lib/lwres/Kyuafile +new file mode 100644 +index 0000000..0739e3a +--- /dev/null ++++ b/lib/lwres/Kyuafile +@@ -0,0 +1,4 @@ ++syntax(2) ++test_suite('bind9') ++ ++include('tests/Kyuafile') +diff --git a/lib/lwres/tests/Kyuafile b/lib/lwres/tests/Kyuafile +new file mode 100644 +index 0000000..6d373e8 +--- /dev/null ++++ b/lib/lwres/tests/Kyuafile +@@ -0,0 +1,4 @@ ++syntax(2) ++test_suite('bind9') ++ ++atf_test_program{name='config_test'} +-- +2.9.5 + diff --git a/bind.spec b/bind.spec index 30a82f6..b7a88cd 100644 --- a/bind.spec +++ b/bind.spec @@ -7,7 +7,8 @@ %global BINDVERSION %{version}%{?PREVER}%{?PATCHVER:-%{PATCHVER}} %{?!SDB: %global SDB 1} -%{?!test: %global test 0} +%{?!unittest: %global unittest 1} +%{?!systemtest:%global systemtest 0} %{?!bind_uid: %global bind_uid 25} %{?!bind_gid: %global bind_gid 25} %{?!GSSTSIG: %global GSSTSIG 1} @@ -27,7 +28,7 @@ Summary: The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) serv Name: bind License: MPLv2.0 Version: 9.11.2 -Release: 3%{?PATCHVER:.%{PATCHVER}}%{?PREVER:.%{PREVER}}%{?dist} +Release: 4%{?PATCHVER:.%{PATCHVER}}%{?PREVER:.%{PREVER}}%{?dist} Epoch: 32 Url: http://www.isc.org/products/BIND/ Buildroot:%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -60,6 +61,7 @@ Source44: named-chroot-setup.service Source45: named-sdb-chroot-setup.service Source46: named-setup-rndc.service Source47: named-pkcs11.service +Source48: softhsm2.conf.in # Common patches Patch10: bind-9.5-PIE.patch @@ -86,7 +88,12 @@ Patch142:bind-9.11-dlz-mysql.patch Patch143:bind-9.11-dlz-mysql-modules.patch Patch144:bind-9.11-rh1484451.patch Patch145:bind-9.11-rh1205168.patch -Patch146: bind-9.11-rh1500017.patch +Patch146:bind-9.11-rh1500017.patch +# commit cb616c6d5c2ece1fac37fa6e0bca2b53d4043098 +Patch147:bind-9.11-kyua.patch +# [ISC-Bugs #46853] commit cb616c6d5c2ece1fac37fa6e0bca2b53d4043098 ISC 4851 +Patch148:bind-9.11-kyua-unit.patch +Patch149:bind-9.11-kyua-pkcs11.patch # SDB patches Patch11: bind-9.3.2b2-sdbsrc.patch @@ -121,7 +128,12 @@ BuildRequires: python3-ply BuildRequires: openldap-devel, postgresql-devel, sqlite-devel, mariadb-connector-c-devel BuildRequires: libdb-devel %endif -%if %{test} +%if %{unittest} +# make unit dependencies +BuildRequires: libatf-c-devel kyua-cli softhsm +%endif +%if %{systemtest} +# bin/tests/system dependencies BuildRequires: net-tools perl(Net::DNS) perl(Net::DNS::Nameserver) %endif %if %{GSSTSIG} @@ -387,6 +399,8 @@ This package provides a module which allows commands to be sent to rndc directly %patch144 -p1 -b .rh1484451 %patch145 -p1 -b .rh1205168 %patch146 -p1 -b .rh1500017 +%patch147 -p1 -b .kyua +%patch148 -p1 -b .kyua-unit %if %{PKCS11} cp -r bin/named{,-pkcs11} @@ -394,6 +408,7 @@ cp -r bin/dnssec{,-pkcs11} cp -r lib/isc{,-pkcs11} cp -r lib/dns{,-pkcs11} %patch136 -p1 -b .dist_pkcs11 +%patch149 -p1 -b .kyua-pkcs11 %endif %if %{SDB} @@ -480,6 +495,9 @@ libtoolize -c -f; aclocal -I libtool.m4 --force; autoconf -f --with-lmdb=yes \ %else --with-lmdb=no \ +%endif +%if %{unittest} + --with-atf=/usr \ %endif --enable-fixed-rrset \ --with-docbook-xsl=%{_datadir}/sgml/docbook/xsl-stylesheets \ @@ -508,8 +526,27 @@ popd popd %endif -%if %{test} %check +: +%if %{PKCS11} + # Tests require initialization of pkcs11 token + mkdir softhsm-tokens + sed -e "s,@TOKENPATH@,`pwd`/softhsm-tokens," %{SOURCE48} > softhsm2.conf + export SOFTHSM2_CONF="`pwd`/softhsm2.conf" + echo "Initializing tokens to `pwd`/softhsm-tokens..." + softhsm2-util --init-token --free --label rpm --pin 1234 --so-pin 1234 +%endif + +%if %{unittest} + make unit + e=$? + if [ "$e" -ne 0 ]; then + echo "ERROR: this build of BIND failed 'make unit'. Aborting." + exit $e; + fi; +%endif + +%if %{systemtest} if [ "`whoami`" = 'root' ]; then set -e chmod -R a+rwX . @@ -1157,6 +1194,9 @@ rm -rf ${RPM_BUILD_ROOT} %{python3_sitelib}/isc/__pycache__/*py* %changelog +* Tue Jan 02 2018 Petr Menšík - 32:9.11.2-4 +- Enable unit tests with kyua tool (#1532694) + * Fri Dec 15 2017 Petr Menšík - 32:9.11.2-3 - Own python3-bind isc directory (#1522944) - Make tsstsig system test pass again (#1500017) diff --git a/softhsm2.conf.in b/softhsm2.conf.in new file mode 100644 index 0000000..1f39320 --- /dev/null +++ b/softhsm2.conf.in @@ -0,0 +1,10 @@ +# SoftHSM v2 configuration file + +directories.tokendir = @TOKENPATH@ +objectstore.backend = file + +# ERROR, WARNING, INFO, DEBUG +log.level = ERROR + +# If CKF_REMOVABLE_DEVICE flag should be set +slots.removable = false