]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
check result tables are complete
authorMark Andrews <marka@isc.org>
Fri, 9 Nov 2018 23:21:44 +0000 (10:21 +1100)
committerMark Andrews <marka@isc.org>
Fri, 9 Nov 2018 23:30:43 +0000 (10:30 +1100)
13 files changed:
CHANGES
configure
configure.ac
lib/dns/result.c
lib/dns/tests/Makefile.in
lib/dns/tests/result_test.c [new file with mode: 0644]
lib/isc/pk11_result.c
lib/isc/result.c
lib/isc/tests/result_test.c
lib/isccc/Makefile.in
lib/isccc/tests/Makefile.in [new file with mode: 0644]
lib/isccc/tests/result_test.c [new file with mode: 0644]
util/copyrights

diff --git a/CHANGES b/CHANGES
index 96000cc1dc8ed5c6ba0e763834d1b0a12617a9b7..56dbd992b930a227b0d9be2950cb3b1afc84b689 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+5087.  [test]          Check that result tables are complete. [GL #676]
+
 5086.  [func]          Log of RPZ now includes the QTYPE and QCLASS. [GL #623]
 
 5085.  [bug]           win32: Restore looking up nameservers, search list,
index 5576d75ccb22c8713179d45077ab2fcb1166aeb5..e666ddfcc2de8daa470cc78197c9aa29ba415fda 100755 (executable)
--- a/configure
+++ b/configure
@@ -844,7 +844,6 @@ infodir
 docdir
 oldincludedir
 includedir
-runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -1004,7 +1003,6 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1257,15 +1255,6 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
-  -runstatedir | --runstatedir | --runstatedi | --runstated \
-  | --runstate | --runstat | --runsta | --runst | --runs \
-  | --run | --ru | --r)
-    ac_prev=runstatedir ;;
-  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
-  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
-  | --run=* | --ru=* | --r=*)
-    runstatedir=$ac_optarg ;;
-
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1403,7 +1392,7 @@ fi
 for ac_var in  exec_prefix prefix bindir sbindir libexecdir datarootdir \
                datadir sysconfdir sharedstatedir localstatedir includedir \
                oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-               libdir localedir mandir runstatedir
+               libdir localedir mandir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1556,7 +1545,6 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
-  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -21702,7 +21690,7 @@ ac_config_commands="$ac_config_commands chmod"
 # elsewhere if there's a good reason for doing so.
 #
 
-ac_config_files="$ac_config_files make/Makefile make/mkdep Makefile bin/Makefile bin/check/Makefile bin/confgen/Makefile bin/confgen/unix/Makefile bin/delv/Makefile bin/dig/Makefile bin/dnssec/Makefile bin/named/Makefile bin/named/unix/Makefile bin/nsupdate/Makefile bin/pkcs11/Makefile bin/python/Makefile bin/python/isc/Makefile bin/python/isc/utils.py bin/python/isc/tests/Makefile bin/python/dnssec-checkds.py bin/python/dnssec-coverage.py bin/python/dnssec-keymgr.py bin/python/isc/__init__.py bin/python/isc/checkds.py bin/python/isc/coverage.py bin/python/isc/dnskey.py bin/python/isc/eventlist.py bin/python/isc/keydict.py bin/python/isc/keyevent.py bin/python/isc/keymgr.py bin/python/isc/keyseries.py bin/python/isc/keyzone.py bin/python/isc/policy.py bin/python/isc/rndc.py bin/python/isc/tests/dnskey_test.py bin/python/isc/tests/policy_test.py bin/rndc/Makefile bin/tests/Makefile bin/tests/headerdep_test.sh bin/tests/optional/Makefile bin/tests/pkcs11/Makefile bin/tests/pkcs11/benchmarks/Makefile bin/tests/system/Makefile bin/tests/system/conf.sh bin/tests/system/dlz/prereq.sh bin/tests/system/dlzexternal/Makefile bin/tests/system/dlzexternal/ns1/dlzs.conf bin/tests/system/dyndb/Makefile bin/tests/system/dyndb/driver/Makefile bin/tests/system/pipelined/Makefile bin/tests/system/rndc/Makefile bin/tests/system/rpz/Makefile bin/tests/system/rsabigexponent/Makefile bin/tests/system/tkey/Makefile bin/tests/virtual-time/Makefile bin/tests/virtual-time/conf.sh bin/tools/Makefile contrib/scripts/check-secure-delegation.pl contrib/scripts/zone-edit.sh doc/Makefile doc/arm/Makefile doc/arm/noteversion.xml doc/arm/pkgversion.xml doc/arm/releaseinfo.xml doc/doxygen/Doxyfile doc/doxygen/Makefile doc/doxygen/doxygen-input-filter doc/misc/Makefile doc/tex/Makefile doc/tex/armstyle.sty doc/xsl/Makefile doc/xsl/isc-docbook-chunk.xsl doc/xsl/isc-docbook-html.xsl doc/xsl/isc-manpage.xsl doc/xsl/isc-notes-html.xsl isc-config.sh lib/Makefile lib/bind9/Makefile lib/bind9/include/Makefile lib/bind9/include/bind9/Makefile lib/dns/Makefile lib/dns/include/Makefile lib/dns/include/dns/Makefile lib/dns/include/dst/Makefile lib/dns/tests/Makefile lib/irs/Makefile lib/irs/include/Makefile lib/irs/include/irs/Makefile lib/irs/include/irs/netdb.h lib/irs/include/irs/platform.h lib/irs/tests/Makefile lib/isc/pthreads/Makefile lib/isc/pthreads/include/Makefile lib/isc/pthreads/include/isc/Makefile lib/isc/Makefile lib/isc/include/Makefile lib/isc/include/isc/Makefile lib/isc/include/isc/platform.h lib/isc/include/pk11/Makefile lib/isc/include/pkcs11/Makefile lib/isc/tests/Makefile lib/isc/nls/Makefile lib/isc/unix/Makefile lib/isc/unix/include/Makefile lib/isc/unix/include/isc/Makefile lib/isc/unix/include/pkcs11/Makefile lib/isccc/Makefile lib/isccc/include/Makefile lib/isccc/include/isccc/Makefile lib/isccfg/Makefile lib/isccfg/include/Makefile lib/isccfg/include/isccfg/Makefile lib/isccfg/tests/Makefile lib/ns/Makefile lib/ns/include/Makefile lib/ns/include/ns/Makefile lib/ns/tests/Makefile lib/samples/Makefile lib/samples/Makefile-postinstall unit/Makefile unit/unittest.sh fuzz/Makefile"
+ac_config_files="$ac_config_files make/Makefile make/mkdep Makefile bin/Makefile bin/check/Makefile bin/confgen/Makefile bin/confgen/unix/Makefile bin/delv/Makefile bin/dig/Makefile bin/dnssec/Makefile bin/named/Makefile bin/named/unix/Makefile bin/nsupdate/Makefile bin/pkcs11/Makefile bin/python/Makefile bin/python/isc/Makefile bin/python/isc/utils.py bin/python/isc/tests/Makefile bin/python/dnssec-checkds.py bin/python/dnssec-coverage.py bin/python/dnssec-keymgr.py bin/python/isc/__init__.py bin/python/isc/checkds.py bin/python/isc/coverage.py bin/python/isc/dnskey.py bin/python/isc/eventlist.py bin/python/isc/keydict.py bin/python/isc/keyevent.py bin/python/isc/keymgr.py bin/python/isc/keyseries.py bin/python/isc/keyzone.py bin/python/isc/policy.py bin/python/isc/rndc.py bin/python/isc/tests/dnskey_test.py bin/python/isc/tests/policy_test.py bin/rndc/Makefile bin/tests/Makefile bin/tests/headerdep_test.sh bin/tests/optional/Makefile bin/tests/pkcs11/Makefile bin/tests/pkcs11/benchmarks/Makefile bin/tests/system/Makefile bin/tests/system/conf.sh bin/tests/system/dlz/prereq.sh bin/tests/system/dlzexternal/Makefile bin/tests/system/dlzexternal/ns1/dlzs.conf bin/tests/system/dyndb/Makefile bin/tests/system/dyndb/driver/Makefile bin/tests/system/pipelined/Makefile bin/tests/system/rndc/Makefile bin/tests/system/rpz/Makefile bin/tests/system/rsabigexponent/Makefile bin/tests/system/tkey/Makefile bin/tests/virtual-time/Makefile bin/tests/virtual-time/conf.sh bin/tools/Makefile contrib/scripts/check-secure-delegation.pl contrib/scripts/zone-edit.sh doc/Makefile doc/arm/Makefile doc/arm/noteversion.xml doc/arm/pkgversion.xml doc/arm/releaseinfo.xml doc/doxygen/Doxyfile doc/doxygen/Makefile doc/doxygen/doxygen-input-filter doc/misc/Makefile doc/tex/Makefile doc/tex/armstyle.sty doc/xsl/Makefile doc/xsl/isc-docbook-chunk.xsl doc/xsl/isc-docbook-html.xsl doc/xsl/isc-manpage.xsl doc/xsl/isc-notes-html.xsl isc-config.sh lib/Makefile lib/bind9/Makefile lib/bind9/include/Makefile lib/bind9/include/bind9/Makefile lib/dns/Makefile lib/dns/include/Makefile lib/dns/include/dns/Makefile lib/dns/include/dst/Makefile lib/dns/tests/Makefile lib/irs/Makefile lib/irs/include/Makefile lib/irs/include/irs/Makefile lib/irs/include/irs/netdb.h lib/irs/include/irs/platform.h lib/irs/tests/Makefile lib/isc/pthreads/Makefile lib/isc/pthreads/include/Makefile lib/isc/pthreads/include/isc/Makefile lib/isc/Makefile lib/isc/include/Makefile lib/isc/include/isc/Makefile lib/isc/include/isc/platform.h lib/isc/include/pk11/Makefile lib/isc/include/pkcs11/Makefile lib/isc/tests/Makefile lib/isc/nls/Makefile lib/isc/unix/Makefile lib/isc/unix/include/Makefile lib/isc/unix/include/isc/Makefile lib/isc/unix/include/pkcs11/Makefile lib/isccc/Makefile lib/isccc/include/Makefile lib/isccc/include/isccc/Makefile lib/isccc/tests/Makefile lib/isccfg/Makefile lib/isccfg/include/Makefile lib/isccfg/include/isccfg/Makefile lib/isccfg/tests/Makefile lib/ns/Makefile lib/ns/include/Makefile lib/ns/include/ns/Makefile lib/ns/tests/Makefile lib/samples/Makefile lib/samples/Makefile-postinstall unit/Makefile unit/unittest.sh fuzz/Makefile"
 
 
 #
@@ -22812,6 +22800,7 @@ do
     "lib/isccc/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isccc/Makefile" ;;
     "lib/isccc/include/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isccc/include/Makefile" ;;
     "lib/isccc/include/isccc/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isccc/include/isccc/Makefile" ;;
+    "lib/isccc/tests/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isccc/tests/Makefile" ;;
     "lib/isccfg/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isccfg/Makefile" ;;
     "lib/isccfg/include/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isccfg/include/Makefile" ;;
     "lib/isccfg/include/isccfg/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isccfg/include/isccfg/Makefile" ;;
index 55e65150bd7b39af03216f63c14904a8e8e50993..fc48c7418e2aecc37cef45b6962781939787b3af 100644 (file)
@@ -3153,6 +3153,7 @@ AC_CONFIG_FILES([
        lib/isccc/Makefile
        lib/isccc/include/Makefile
        lib/isccc/include/isccc/Makefile
+       lib/isccc/tests/Makefile
        lib/isccfg/Makefile
        lib/isccfg/include/Makefile
        lib/isccfg/include/isccfg/Makefile
index 0d992920614c1e8fe23a050754080ba3c5ca26dc..ffbe7f760b26e1a1853a4c7c03052b308f47bdc6 100644 (file)
@@ -290,6 +290,8 @@ static const char *ids[DNS_R_NRESULTS] = {
        "DNS_R_BADDNSTAP",
        "DNS_R_BADTSIG",
        "DNS_R_BADSIG0",
+       "DNS_R_TOOMANYRECORDS",
+       "DNS_R_VERIFYFAILURE",
 };
 
 static const char *rcode_text[DNS_R_NRCODERESULTS] = {
index 75c073e400b6e19fb70293f7d4a17763f6fe6df4..011ecca03fd6cc59ae350c3d6064020be183e984 100644 (file)
@@ -56,6 +56,7 @@ SRCS =                acl_test.c \
                rdataset_test.c \
                rdatasetstats_test.c \
                resolver_test.c \
+               result_test.c \
                rsa_test.c \
                sigs_test.c \
                time_test.c \
@@ -88,6 +89,7 @@ TARGETS =     acl_test@EXEEXT@ \
                rdataset_test@EXEEXT@ \
                rdatasetstats_test@EXEEXT@ \
                resolver_test@EXEEXT@ \
+               result_test@EXEEXT@ \
                rsa_test@EXEEXT@ \
                sigs_test@EXEEXT@ \
                time_test@EXEEXT@ \
@@ -218,6 +220,12 @@ resolver_test@EXEEXT@: resolver_test.@O@ dnstest.@O@ \
                        resolver_test.@O@ dnstest.@O@ ${DNSLIBS} \
                                ${ISCLIBS} ${LIBS}
 
+result_test@EXEEXT@: result_test.@O@ \
+               ${ISCDEPLIBS} ${DNSDEPLIBS}
+       ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
+                       result_test.@O@ ${DNSLIBS} \
+                               ${ISCLIBS} ${LIBS}
+
 rsa_test@EXEEXT@: rsa_test.@O@ dnstest.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS}
        ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
                        rsa_test.@O@ dnstest.@O@ ${DNSLIBS} \
diff --git a/lib/dns/tests/result_test.c b/lib/dns/tests/result_test.c
new file mode 100644 (file)
index 0000000..6fbb451
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * See the COPYRIGHT file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+/* ! \file */
+
+#include <config.h>
+
+#include <atf-c.h>
+
+#include <isc/result.h>
+#include <isc/util.h>
+
+#include <dns/lib.h>
+#include <dns/result.h>
+#include <dst/result.h>
+
+ATF_TC(ids);
+ATF_TC_HEAD(ids, tc) {
+       atf_tc_set_md_var(tc, "descr", "check ids array is populated");
+}
+ATF_TC_BODY(ids, tc) {
+       const char *str;
+       isc_result_t result;
+
+       UNUSED(tc);
+
+       dns_result_register();
+       dst_result_register();
+
+       for (result = ISC_RESULTCLASS_DNS;
+            result < (ISC_RESULTCLASS_DNS + DNS_R_NRESULTS);
+            result++) {
+               str = isc_result_toid(result);
+               ATF_REQUIRE_MSG(str != NULL,
+                               "isc_result_toid(%u) returned NULL", result);
+               ATF_CHECK_MSG(strcmp(str,
+                                    "(result code text not available)") != 0,
+                             "isc_result_toid(%u) returned %s", result, str);
+
+               str = isc_result_totext(result);
+               ATF_REQUIRE_MSG(str != NULL,
+                               "isc_result_totext(%u) returned NULL", result);
+               ATF_CHECK_MSG(strcmp(str,
+                                    "(result code text not available)") != 0,
+                             "isc_result_totext(%u) returned %s", result, str);
+       }
+
+       str = isc_result_toid(result);
+       ATF_REQUIRE(str != NULL);
+       ATF_CHECK_STREQ(str, "(result code text not available)");
+
+       str = isc_result_totext(result);
+       ATF_REQUIRE(str != NULL);
+       ATF_CHECK_STREQ(str, "(result code text not available)");
+
+       for (result = ISC_RESULTCLASS_DST;
+            result < (ISC_RESULTCLASS_DST + DST_R_NRESULTS);
+            result++) {
+               str = isc_result_toid(result);
+               ATF_REQUIRE_MSG(str != NULL,
+                               "isc_result_toid(%u) returned NULL", result);
+               ATF_CHECK_MSG(strcmp(str,
+                                    "(result code text not available)") != 0,
+                             "isc_result_toid(%u) returned %s", result, str);
+
+               str = isc_result_totext(result);
+               ATF_REQUIRE_MSG(str != NULL,
+                               "isc_result_totext(%u) returned NULL", result);
+               ATF_CHECK_MSG(strcmp(str,
+                                    "(result code text not available)") != 0,
+                             "isc_result_totext(%u) returned %s", result, str);
+       }
+
+       str = isc_result_toid(result);
+       ATF_REQUIRE(str != NULL);
+       ATF_CHECK_STREQ(str, "(result code text not available)");
+
+       str = isc_result_totext(result);
+       ATF_REQUIRE(str != NULL);
+       ATF_CHECK_STREQ(str, "(result code text not available)");
+
+       for (result = ISC_RESULTCLASS_DNSRCODE;
+            result < (ISC_RESULTCLASS_DNSRCODE + DNS_R_NRCODERESULTS);
+            result++) {
+               str = isc_result_toid(result);
+               ATF_REQUIRE_MSG(str != NULL,
+                               "isc_result_toid(%u) returned NULL", result);
+               ATF_CHECK_MSG(strcmp(str,
+                                    "(result code text not available)") != 0,
+                             "isc_result_toid(%u) returned %s", result, str);
+
+               str = isc_result_totext(result);
+               ATF_REQUIRE_MSG(str != NULL,
+                               "isc_result_totext(%u) returned NULL", result);
+               ATF_CHECK_MSG(strcmp(str,
+                                    "(result code text not available)") != 0,
+                             "isc_result_totext(%u) returned %s", result, str);
+       }
+
+       str = isc_result_toid(result);
+       ATF_REQUIRE(str != NULL);
+       ATF_CHECK_STREQ(str, "(result code text not available)");
+
+       str = isc_result_totext(result);
+       ATF_REQUIRE(str != NULL);
+       ATF_CHECK_STREQ(str, "(result code text not available)");
+}
+
+/*
+ * Main
+ */
+ATF_TP_ADD_TCS(tp) {
+       ATF_TP_ADD_TC(tp, ids);
+
+       return (atf_no_error());
+}
index eebf08f0553df6807cb1bd9ed08d2d79cccaa074..650cf78ca21d7c4a9194c8895bab17e27a15a46f 100644 (file)
@@ -24,12 +24,18 @@ static isc_once_t           msgcat_once = ISC_ONCE_INIT;
 
 static const char *text[PK11_R_NRESULTS] = {
        "PKCS#11 initialization failed",                /*%< 0 */
-       "no PKCS#11 provider"
+       "no PKCS#11 provider",                          /*%< 1 */
+       "PKCS#11 no random service",                    /*%< 2 */
+       "PKCS#11 no digist service",                    /*%< 3 */
+       "PKCS#11 no AES service",                       /*%< 4 */
 };
 
 static const char *ids[PK11_R_NRESULTS] = {
        "PK11_R_INITFAILED",
-       "PK11_R_NOPROVIDER"
+       "PK11_R_NOPROVIDER",
+       "PK11_R_NORANDOMSERVICE",
+       "PK11_R_NODIGESTSERVICE",
+       "PK11_R_NOAESSERVICE",
 };
 
 #define PK11_RESULT_RESULTSET                  2
index 23ff2099ead062ecee982e87a59f1d91843ce92b..4920a98be7719ea6ae3f0d045d4804b5419263e7 100644 (file)
@@ -100,6 +100,7 @@ static const char *description[ISC_R_NRESULTS] = {
        "multiple",                             /*%< 62 */
        "would block",                          /*%< 63 */
        "complete",                             /*%< 64 */
+       "crypto failure",                       /*%< 65 */
 };
 
 static const char *identifier[ISC_R_NRESULTS] = {
@@ -168,6 +169,7 @@ static const char *identifier[ISC_R_NRESULTS] = {
        "ISC_R_MULTIPLE",
        "ISC_R_WOULDBLOCK",
        "ISC_R_COMPLETE",
+       "ISC_R_CRYPTOFAILURE",
 };
 
 #define ISC_RESULT_RESULTSET                   2
index cfaabb325f6f7f906a8f4aa39c3f541321f812d9..1e53f63a2b2ed1a000bc7ce333c1603e77072cd8 100644 (file)
 #include <string.h>
 
 #include <isc/result.h>
+#include <pk11/result.h>
+
+ATF_TC(tables);
+ATF_TC_HEAD(tables, tc) {
+       atf_tc_set_md_var(tc, "descr", "check tables are populated");
+}
+ATF_TC_BODY(tables, tc) {
+       const char *str;
+       isc_result_t result;
+
+       pk11_result_register();
+
+       for (result = 0; result < ISC_R_NRESULTS; result++) {
+               str = isc_result_toid(result);
+               ATF_REQUIRE_MSG(str != NULL,
+                               "isc_result_toid(%u) returned NULL", result);
+               ATF_CHECK_MSG(strcmp(str,
+                             "(result code text not available)") != 0,
+                             "isc_result_toid(%u) returned %s", result, str);
+
+               str = isc_result_totext(result);
+               ATF_REQUIRE_MSG(str != NULL,
+                               "isc_result_totext(%u) returned NULL", result);
+               ATF_CHECK_MSG(strcmp(str,
+                             "(result code text not available)") != 0,
+                             "isc_result_totext(%u) returned %s", result, str);
+       }
+
+       str = isc_result_toid(result);
+       ATF_REQUIRE(str != NULL);
+       ATF_CHECK_STREQ(str, "(result code text not available)");
+
+       str = isc_result_totext(result);
+       ATF_REQUIRE(str != NULL);
+       ATF_CHECK_STREQ(str, "(result code text not available)");
+
+       for (result = ISC_RESULTCLASS_PK11;
+            result < (ISC_RESULTCLASS_PK11 + PK11_R_NRESULTS);
+            result++)
+       {
+               str = isc_result_toid(result);
+               ATF_REQUIRE_MSG(str != NULL,
+                               "isc_result_toid(%u) returned NULL", result);
+               ATF_CHECK_MSG(strcmp(str,
+                             "(result code text not available)") != 0,
+                             "isc_result_toid(%u) returned %s", result, str);
+
+               str = isc_result_totext(result);
+               ATF_REQUIRE_MSG(str != NULL,
+                               "isc_result_totext(%u) returned NULL", result);
+               ATF_CHECK_MSG(strcmp(str,
+                             "(result code text not available)") != 0,
+                             "isc_result_totext(%u) returned %s", result, str);
+       }
+
+       str = isc_result_toid(result);
+       ATF_REQUIRE(str != NULL);
+       ATF_CHECK_STREQ(str, "(result code text not available)");
+
+       str = isc_result_totext(result);
+       ATF_REQUIRE(str != NULL);
+       ATF_CHECK_STREQ(str, "(result code text not available)");
+}
 
 ATF_TC(isc_result_toid);
 ATF_TC_HEAD(isc_result_toid, tc) {
@@ -51,6 +114,7 @@ ATF_TC_BODY(isc_result_totext, tc) {
 ATF_TP_ADD_TCS(tp) {
        ATF_TP_ADD_TC(tp, isc_result_toid);
        ATF_TP_ADD_TC(tp, isc_result_totext);
+       ATF_TP_ADD_TC(tp, tables);
 
        return (atf_no_error());
 }
index e7f3f55806e4589ff98a01950fea7cea53ef63f2..01d01abd3c6fdef1d3d7f0d8b4854d7406bee13a 100644 (file)
@@ -45,6 +45,7 @@ SRCS =                alist.c base64.c cc.c ccmsg.c \
 
 
 TARGETS =      timestamp
+TESTDIRS =     @UNITTESTS@
 
 @BIND9_MAKE_RULES@
 
@@ -69,6 +70,8 @@ libisccc.la: ${OBJS}
 timestamp: libisccc.@A@
        touch timestamp
 
+testdirs: libisccc.@A@
+
 installdirs:
        $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir}
 
diff --git a/lib/isccc/tests/Makefile.in b/lib/isccc/tests/Makefile.in
new file mode 100644 (file)
index 0000000..4023373
--- /dev/null
@@ -0,0 +1,53 @@
+# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# See the COPYRIGHT file distributed with this work for additional
+# information regarding copyright ownership.
+
+srcdir =       @srcdir@
+VPATH =                @srcdir@
+top_srcdir =   @top_srcdir@
+
+# Attempt to disable parallel processing.
+.NOTPARALLEL:
+.NO_PARALLEL:
+
+VERSION=@BIND9_VERSION@
+
+@BIND9_MAKE_INCLUDES@
+
+CINCLUDES =    -I. -Iinclude ${ISCCC_INCLUDES} ${ISC_INCLUDES}
+CDEFINES =
+
+ISCLIBS =      ../../isc/libisc.@A@ @OPENSSL_LIBS@
+ISCDEPLIBS =   ../../isc/libisc.@A@
+ISCCCLIBS =    ../libisccc.@A@
+ISCCCDEPLIBS = ../libisccc.@A@
+
+LIBS =         @LIBS@ @ATFLIBS@
+
+CMOCKA_CFLAGS =        @CMOCKA_CFLAGS@
+CMOCKA_LIBS =  @CMOCKA_LIBS@
+
+OBJS =
+SRCS =         result_test.c
+SUBDIRS =
+TARGETS =      result_test@EXEEXT@
+
+@BIND9_MAKE_RULES@
+
+result_test@EXEEXT@: result_test.@O@ \
+               ${ISCDEPLIBS} ${ISCCCDEPLIBS}
+       ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
+                       result_test.@O@ ${ISCCCLIBS} \
+                               ${ISCLIBS} ${LIBS}
+
+unit::
+       sh ${top_builddir}/unit/unittest.sh
+
+clean distclean::
+       rm -f ${TARGETS}
+       rm -f atf.out
diff --git a/lib/isccc/tests/result_test.c b/lib/isccc/tests/result_test.c
new file mode 100644 (file)
index 0000000..27f2228
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * See the COPYRIGHT file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+/* ! \file */
+
+#include <config.h>
+
+#include <atf-c.h>
+
+#include <isc/result.h>
+#include <isc/util.h>
+
+#include <isccc/lib.h>
+#include <isccc/result.h>
+
+ATF_TC(tables);
+ATF_TC_HEAD(tables, tc) {
+       atf_tc_set_md_var(tc, "descr", "check tables are populated");
+}
+ATF_TC_BODY(tables, tc) {
+       const char *str;
+       isc_result_t result;
+
+       UNUSED(tc);
+
+       isccc_result_register();
+
+       for (result = ISC_RESULTCLASS_ISCCC;
+            result < (ISC_RESULTCLASS_ISCCC + ISCCC_R_NRESULTS);
+            result++) {
+               str = isc_result_toid(result);
+               ATF_REQUIRE_MSG(str != NULL,
+                               "isc_result_toid(%u) returned NULL", result);
+               ATF_CHECK_MSG(strcmp(str,
+                                    "(result code text not available)") != 0,
+                             "isc_result_toid(%u) returned %s", result, str);
+
+               str = isc_result_totext(result);
+               ATF_REQUIRE_MSG(str != NULL,
+                               "isc_result_totext(%u) returned NULL", result);
+               ATF_CHECK_MSG(strcmp(str,
+                                    "(result code text not available)") != 0,
+                             "isc_result_totext(%u) returned %s", result, str);
+       }
+
+       str = isc_result_toid(result);
+       ATF_REQUIRE(str != NULL);
+       ATF_CHECK_STREQ(str, "(result code text not available)");
+
+       str = isc_result_totext(result);
+       ATF_REQUIRE(str != NULL);
+       ATF_CHECK_STREQ(str, "(result code text not available)");
+}
+
+/*
+ * Main
+ */
+ATF_TP_ADD_TCS(tp) {
+       ATF_TP_ADD_TC(tp, tables);
+
+       return (atf_no_error());
+}
index 17df487657e919d028e48a5918a280e6e85817f6..1f519512ac1a77c10f072e1e2682b69d107db08c 100644 (file)
 ./lib/dns/tests/rdataset_test.c                        C       2012,2016,2018
 ./lib/dns/tests/rdatasetstats_test.c           C       2012,2015,2016,2018
 ./lib/dns/tests/resolver_test.c                        C       2018
+./lib/dns/tests/result_test.c                  C       2018
 ./lib/dns/tests/rsa_test.c                     C       2016,2018
 ./lib/dns/tests/sigs_test.c                    C       2018
 ./lib/dns/tests/testdata/db/data.db            ZONE    2018
 ./lib/isccc/result.c                           C.NOM   2001,2003,2004,2005,2007,2015,2016,2018
 ./lib/isccc/sexpr.c                            C.NOM   2001,2004,2005,2007,2014,2015,2016,2018
 ./lib/isccc/symtab.c                           C.NOM   2001,2004,2005,2007,2016,2018
+./lib/isccc/tests/result_test.c                        C       2018
 ./lib/isccc/version.c                          C       1998,1999,2000,2001,2004,2005,2007,2016,2018
 ./lib/isccc/win32/DLLMain.c                    C       2001,2004,2007,2016,2018
 ./lib/isccc/win32/libisccc.def                 X       2001,2016,2018