From faedafd2b48eeb04bb504645e6c6909bf06cdf79 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Mon, 26 Feb 2018 23:18:59 -0800 Subject: [PATCH] migrate t_net to lib/isc/tests (cherry picked from commit 05b7251d51b4b31ad822d701beb0313ad1bcb4d9) (cherry picked from commit af0c9b2ceecbca3f71f6895bbfac6cdf11c46094) --- bin/tests/.gitignore | 1 - bin/tests/Makefile.in | 2 +- bin/tests/net/Makefile.in | 44 ------------ bin/tests/net/driver.c | 103 ---------------------------- bin/tests/net/driver.h | 39 ----------- bin/tests/net/netaddr_multicast.c | 104 ----------------------------- bin/tests/net/sockaddr_multicast.c | 27 -------- bin/tests/net/testsuite.h | 24 ------- configure | 3 +- configure.in | 1 - lib/isc/tests/netaddr_test.c | 53 +++++++++++++-- util/copyrights | 8 --- 12 files changed, 50 insertions(+), 359 deletions(-) delete mode 100644 bin/tests/net/Makefile.in delete mode 100644 bin/tests/net/driver.c delete mode 100644 bin/tests/net/driver.h delete mode 100644 bin/tests/net/netaddr_multicast.c delete mode 100644 bin/tests/net/sockaddr_multicast.c delete mode 100644 bin/tests/net/testsuite.h diff --git a/bin/tests/.gitignore b/bin/tests/.gitignore index 1f09253c58..6745b0493e 100644 --- a/bin/tests/.gitignore +++ b/bin/tests/.gitignore @@ -10,7 +10,6 @@ gsstest t_dst t_mem t_names -t_net t_rbt t_resolver conf.sh diff --git a/bin/tests/Makefile.in b/bin/tests/Makefile.in index de1b36d496..7db160b02c 100644 --- a/bin/tests/Makefile.in +++ b/bin/tests/Makefile.in @@ -29,7 +29,7 @@ ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@ LIBS = @LIBS@ -SUBDIR = atomic db dst mem names net rbt resolver \ +SUBDIR = atomic db dst mem names rbt resolver \ tasks timers system @PKCS11_TOOLS@ optional # Test programs that are built by default: diff --git a/bin/tests/net/Makefile.in b/bin/tests/net/Makefile.in deleted file mode 100644 index 6303622c35..0000000000 --- a/bin/tests/net/Makefile.in +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (C) 2000-2002, 2004, 2007, 2009, 2012, 2014, 2016 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/. - -# $Id: Makefile.in,v 1.19 2009/12/05 23:31:40 each Exp $ - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -@BIND9_MAKE_INCLUDES@ - -CINCLUDES = ${TEST_INCLUDES} ${DNS_INCLUDES} ${ISC_INCLUDES} - -CDEFINES = -CWARNINGS = - -ISCLIBS = ../../../lib/isc/libisc.@A@ @ISC_OPENSSL_LIBS@ - -ISCDEPLIBS = ../../../lib/isc/libisc.@A@ - -DEPLIBS = ${ISCDEPLIBS} - -LIBS = ${ISCLIBS} @LIBS@ - -TARGETS = t_net@EXEEXT@ - -SRCS = driver.c netaddr_multicast.c sockaddr_multicast.c - -OBJS = driver.@O@ netaddr_multicast.@O@ sockaddr_multicast.@O@ - -@BIND9_MAKE_RULES@ - -t_net@EXEEXT@: ${OBJS} ${DEPLIBS} ${TLIB} - ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ ${OBJS} ${TLIB} ${LIBS} - -test: t_net@EXEEXT@ - -@./t_net@EXEEXT@ - -clean distclean:: - rm -f ${TARGETS} - rm -f ${OBJS} diff --git a/bin/tests/net/driver.c b/bin/tests/net/driver.c deleted file mode 100644 index 2d574bb035..0000000000 --- a/bin/tests/net/driver.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (C) 2000, 2001, 2004, 2007, 2015-2017 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/. - */ - -/* $Id: driver.c,v 1.11 2007/06/19 23:47:00 tbox Exp $ */ - -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include "driver.h" - -#include "testsuite.h" - -#define NTESTS (sizeof(tests) / sizeof(test_t)) - -const char *gettime(void); -const char *test_result_totext(test_result_t); - -const char * -gettime(void) { - static char now[512]; - time_t t; -#if defined(ISC_PLATFORM_USETHREADS) && !defined(WIN32) - struct tm tm; -#endif - - (void)time(&t); - -#if defined(ISC_PLATFORM_USETHREADS) && !defined(WIN32) - strftime(now, sizeof(now) - 1, "%A %d %B %H:%M:%S %Y", - localtime_r(&t, &tm)); -#else - strftime(now, sizeof(now) - 1, "%A %d %B %H:%M:%S %Y", localtime(&t)); -#endif - - return (now); -} - -const char * -test_result_totext(test_result_t result) { - const char *s; - switch (result) { - case PASSED: - s = "PASS"; - break; - case FAILED: - s = "FAIL"; - break; - case UNTESTED: - s = "UNTESTED"; - break; - case UNKNOWN: - default: - s = "UNKNOWN"; - break; - } - - return (s); -} - -int -main(int argc, char **argv) { - test_t *test; - test_result_t result; - unsigned int n_failed; - unsigned int testno; - - UNUSED(argc); - UNUSED(argv); - - printf("S:%s:%s\n", SUITENAME, gettime()); - - n_failed = 0; - for (testno = 0; testno < NTESTS; testno++) { - test = &tests[testno]; - printf("T:%s:%u:A\n", test->tag, testno + 1); - printf("A:%s\n", test->description); - result = test->func(); - printf("R:%s\n", test_result_totext(result)); - if (result != PASSED) - n_failed++; - } - - printf("E:%s:%s\n", SUITENAME, gettime()); - - if (n_failed > 0) - exit(1); - - return (0); -} - diff --git a/bin/tests/net/driver.h b/bin/tests/net/driver.h deleted file mode 100644 index 33a531cde3..0000000000 --- a/bin/tests/net/driver.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2000, 2001, 2004, 2007, 2016 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/. - */ - -/* $Id: driver.h,v 1.8 2007/06/19 23:47:00 tbox Exp $ */ - -/* - * PASSED and FAILED mean the particular test passed or failed. - * - * UNKNOWN means that for one reason or another, the test process itself - * failed. For instance, missing files, error when parsing files or - * IP addresses, etc. That is, the test itself is broken, not what is - * being tested. - * - * UNTESTED means the test was unable to be run because a prerequisite test - * failed, the test is disabled, or the test needs a system component - * (for instance, Perl) and cannot run. - */ -typedef enum { - PASSED = 0, - FAILED = 1, - UNKNOWN = 2, - UNTESTED = 3 -} test_result_t; - -typedef test_result_t (*test_func_t)(void); - -typedef struct { - const char *tag; - const char *description; - test_func_t func; -} test_t; - -#define TESTDECL(name) test_result_t name(void) - diff --git a/bin/tests/net/netaddr_multicast.c b/bin/tests/net/netaddr_multicast.c deleted file mode 100644 index 5303bb2e6a..0000000000 --- a/bin/tests/net/netaddr_multicast.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2000, 2001, 2004, 2007, 2015, 2016 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/. - */ - -/* $Id: netaddr_multicast.c,v 1.12 2007/06/19 23:47:00 tbox Exp $ */ - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "driver.h" - -TESTDECL(netaddr_multicast); - -typedef struct { - int family; - const char *addr; - isc_boolean_t is_multicast; -} t_addr_t; - -static t_addr_t addrs[] = { - { AF_INET, "1.2.3.4", ISC_FALSE }, - { AF_INET, "4.3.2.1", ISC_FALSE }, - { AF_INET, "224.1.1.1", ISC_TRUE }, - { AF_INET, "1.1.1.244", ISC_FALSE }, - { AF_INET6, "::1", ISC_FALSE }, - { AF_INET6, "ff02::1", ISC_TRUE } -}; -#define NADDRS (sizeof(addrs) / sizeof(t_addr_t)) - -static isc_result_t to_netaddr(t_addr_t *, isc_netaddr_t *); - -static isc_result_t -to_netaddr(t_addr_t *addr, isc_netaddr_t *na) { - int r; - struct in_addr in; - struct in6_addr in6; - - switch (addr->family) { - case AF_INET: - r = inet_pton(AF_INET, addr->addr, (unsigned char *)&in); - if (r != 1) - return (ISC_R_FAILURE); - isc_netaddr_fromin(na, &in); - break; - case AF_INET6: - r = inet_pton(AF_INET6, addr->addr, (unsigned char *)&in6); - if (r != 1) - return (ISC_R_FAILURE); - isc_netaddr_fromin6(na, &in6); - break; - default: - return (ISC_R_UNEXPECTED); - } - - return (ISC_R_SUCCESS); -} - -test_result_t -netaddr_multicast(void) { - isc_netaddr_t na; - unsigned int n_fail; - t_addr_t *addr; - unsigned int i; - isc_result_t result; - isc_boolean_t tf; - - n_fail = 0; - for (i = 0; i < NADDRS; i++) { - addr = &addrs[i]; - result = to_netaddr(addr, &na); - if (result != ISC_R_SUCCESS) { - printf("I:to_netaddr() returned %s on item %u\n", - isc_result_totext(result), i); - return (UNKNOWN); - } - tf = isc_netaddr_ismulticast(&na); - if (tf == addr->is_multicast) { - printf("I:%s is%s multicast (PASSED)\n", - (addr->addr), (tf ? "" : " not")); - } else { - printf("I:%s is%s multicast (FAILED)\n", - (addr->addr), (tf ? "" : " not")); - n_fail++; - } - } - - if (n_fail > 0) - return (FAILED); - - return (PASSED); -} diff --git a/bin/tests/net/sockaddr_multicast.c b/bin/tests/net/sockaddr_multicast.c deleted file mode 100644 index e6dff99deb..0000000000 --- a/bin/tests/net/sockaddr_multicast.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2000, 2001, 2004, 2007, 2016 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/. - */ - -/* $Id: sockaddr_multicast.c,v 1.8 2007/06/19 23:47:00 tbox Exp $ */ - -#include - -#include -#include - -#include -#include - -#include "driver.h" - -TESTDECL(sockaddr_multicast); - -test_result_t -sockaddr_multicast(void) { - - return (PASSED); -} diff --git a/bin/tests/net/testsuite.h b/bin/tests/net/testsuite.h deleted file mode 100644 index 069276da22..0000000000 --- a/bin/tests/net/testsuite.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2000, 2001, 2004, 2007, 2016 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/. - */ - -/* $Id: testsuite.h,v 1.7 2007/06/19 23:47:00 tbox Exp $ */ - -#define SUITENAME "net" - -TESTDECL(netaddr_multicast); -TESTDECL(sockaddr_multicast); - -static test_t tests[] = { - { "isc_netaddr_ismulticast", - "Checking to see if multicast addresses are detected properly", - netaddr_multicast }, - { "isc_sockaddr_ismulticast", - "Checking to see if multicast addresses are detected properly", - sockaddr_multicast }, - -}; diff --git a/configure b/configure index d464d2a2d2..ed8c0d7e95 100755 --- a/configure +++ b/configure @@ -23871,7 +23871,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/atomic/Makefile bin/tests/db/Makefile bin/tests/dst/Makefile bin/tests/dst/Kdh.+002+18602.key bin/tests/dst/Kdh.+002+18602.private bin/tests/dst/Kdh.+002+48957.key bin/tests/dst/Kdh.+002+48957.private bin/tests/dst/Ktest.+001+00002.key bin/tests/dst/Ktest.+001+54622.key bin/tests/dst/Ktest.+001+54622.private bin/tests/dst/Ktest.+003+23616.key bin/tests/dst/Ktest.+003+23616.private bin/tests/dst/Ktest.+003+49667.key bin/tests/dst/dst_2_data bin/tests/dst/t2_data_1 bin/tests/dst/t2_data_2 bin/tests/dst/t2_dsasig bin/tests/dst/t2_rsasig bin/tests/headerdep_test.sh bin/tests/mem/Makefile bin/tests/names/Makefile bin/tests/net/Makefile bin/tests/optional/Makefile bin/tests/pkcs11/Makefile bin/tests/pkcs11/benchmarks/Makefile bin/tests/rbt/Makefile bin/tests/resolver/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/inline/checkdsa.sh bin/tests/system/lwresd/Makefile bin/tests/system/pipelined/Makefile bin/tests/system/rndc/Makefile bin/tests/system/rsabigexponent/Makefile bin/tests/system/tkey/Makefile bin/tests/tasks/Makefile bin/tests/timers/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/$arch/Makefile lib/isc/$arch/include/Makefile lib/isc/$arch/include/isc/Makefile lib/isc/$thread_dir/Makefile lib/isc/$thread_dir/include/Makefile lib/isc/$thread_dir/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/lwres/Makefile lib/lwres/include/Makefile lib/lwres/include/lwres/Makefile lib/lwres/include/lwres/netdb.h lib/lwres/include/lwres/platform.h lib/lwres/man/Makefile lib/lwres/tests/Makefile lib/lwres/unix/Makefile lib/lwres/unix/include/Makefile lib/lwres/unix/include/lwres/Makefile lib/tests/Makefile lib/tests/include/Makefile lib/tests/include/tests/Makefile lib/samples/Makefile lib/samples/Makefile-postinstall unit/Makefile unit/unittest.sh" +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/atomic/Makefile bin/tests/db/Makefile bin/tests/dst/Makefile bin/tests/dst/Kdh.+002+18602.key bin/tests/dst/Kdh.+002+18602.private bin/tests/dst/Kdh.+002+48957.key bin/tests/dst/Kdh.+002+48957.private bin/tests/dst/Ktest.+001+00002.key bin/tests/dst/Ktest.+001+54622.key bin/tests/dst/Ktest.+001+54622.private bin/tests/dst/Ktest.+003+23616.key bin/tests/dst/Ktest.+003+23616.private bin/tests/dst/Ktest.+003+49667.key bin/tests/dst/dst_2_data bin/tests/dst/t2_data_1 bin/tests/dst/t2_data_2 bin/tests/dst/t2_dsasig bin/tests/dst/t2_rsasig bin/tests/headerdep_test.sh bin/tests/mem/Makefile bin/tests/names/Makefile bin/tests/optional/Makefile bin/tests/pkcs11/Makefile bin/tests/pkcs11/benchmarks/Makefile bin/tests/rbt/Makefile bin/tests/resolver/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/inline/checkdsa.sh bin/tests/system/lwresd/Makefile bin/tests/system/pipelined/Makefile bin/tests/system/rndc/Makefile bin/tests/system/rsabigexponent/Makefile bin/tests/system/tkey/Makefile bin/tests/tasks/Makefile bin/tests/timers/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/$arch/Makefile lib/isc/$arch/include/Makefile lib/isc/$arch/include/isc/Makefile lib/isc/$thread_dir/Makefile lib/isc/$thread_dir/include/Makefile lib/isc/$thread_dir/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/lwres/Makefile lib/lwres/include/Makefile lib/lwres/include/lwres/Makefile lib/lwres/include/lwres/netdb.h lib/lwres/include/lwres/platform.h lib/lwres/man/Makefile lib/lwres/tests/Makefile lib/lwres/unix/Makefile lib/lwres/unix/include/Makefile lib/lwres/unix/include/lwres/Makefile lib/tests/Makefile lib/tests/include/Makefile lib/tests/include/tests/Makefile lib/samples/Makefile lib/samples/Makefile-postinstall unit/Makefile unit/unittest.sh" # @@ -24925,7 +24925,6 @@ do "bin/tests/headerdep_test.sh") CONFIG_FILES="$CONFIG_FILES bin/tests/headerdep_test.sh" ;; "bin/tests/mem/Makefile") CONFIG_FILES="$CONFIG_FILES bin/tests/mem/Makefile" ;; "bin/tests/names/Makefile") CONFIG_FILES="$CONFIG_FILES bin/tests/names/Makefile" ;; - "bin/tests/net/Makefile") CONFIG_FILES="$CONFIG_FILES bin/tests/net/Makefile" ;; "bin/tests/optional/Makefile") CONFIG_FILES="$CONFIG_FILES bin/tests/optional/Makefile" ;; "bin/tests/pkcs11/Makefile") CONFIG_FILES="$CONFIG_FILES bin/tests/pkcs11/Makefile" ;; "bin/tests/pkcs11/benchmarks/Makefile") CONFIG_FILES="$CONFIG_FILES bin/tests/pkcs11/benchmarks/Makefile" ;; diff --git a/configure.in b/configure.in index a306aedd16..5fdced8ed9 100644 --- a/configure.in +++ b/configure.in @@ -5446,7 +5446,6 @@ AC_CONFIG_FILES([ bin/tests/headerdep_test.sh bin/tests/mem/Makefile bin/tests/names/Makefile - bin/tests/net/Makefile bin/tests/optional/Makefile bin/tests/pkcs11/Makefile bin/tests/pkcs11/benchmarks/Makefile diff --git a/lib/isc/tests/netaddr_test.c b/lib/isc/tests/netaddr_test.c index 92869478bb..695a4e8172 100644 --- a/lib/isc/tests/netaddr_test.c +++ b/lib/isc/tests/netaddr_test.c @@ -19,11 +19,11 @@ #include #include -ATF_TC(isc_netaddr_isnetzero); -ATF_TC_HEAD(isc_netaddr_isnetzero, tc) { - atf_tc_set_md_var(tc, "descr", "test isc_netaddr_isnetzero"); +ATF_TC(netaddr_isnetzero); +ATF_TC_HEAD(netaddr_isnetzero, tc) { + atf_tc_set_md_var(tc, "descr", "test netaddr_isnetzero"); } -ATF_TC_BODY(isc_netaddr_isnetzero, tc) { +ATF_TC_BODY(netaddr_isnetzero, tc) { unsigned int i; struct in_addr ina; struct { @@ -99,12 +99,55 @@ ATF_TC_BODY(netaddr_masktoprefixlen, tc) { ATF_CHECK_EQ(plen, 24); } +ATF_TC(netaddr_multicast); +ATF_TC_HEAD(netaddr_multicast, tc) { + atf_tc_set_md_var(tc, "descr", + "check multicast addresses are detected properly"); +} +ATF_TC_BODY(netaddr_multicast, tc) { + unsigned int i; + struct { + int family; + const char *addr; + isc_boolean_t is_multicast; + } tests[] = { + { AF_INET, "1.2.3.4", ISC_FALSE }, + { AF_INET, "4.3.2.1", ISC_FALSE }, + { AF_INET, "224.1.1.1", ISC_TRUE }, + { AF_INET, "1.1.1.244", ISC_FALSE }, + { AF_INET6, "::1", ISC_FALSE }, + { AF_INET6, "ff02::1", ISC_TRUE } + }; + + for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) { + isc_netaddr_t na; + struct in_addr in; + struct in6_addr in6; + int r; + + if (tests[i].family == AF_INET) { + r = inet_pton(AF_INET, tests[i].addr, + (unsigned char *)&in); + ATF_REQUIRE_EQ(r, 1); + isc_netaddr_fromin(&na, &in); + } else { + r = inet_pton(AF_INET6, tests[i].addr, + (unsigned char *)&in6); + ATF_REQUIRE_EQ(r, 1); + isc_netaddr_fromin6(&na, &in6); + } + + ATF_CHECK_EQ(isc_netaddr_ismulticast(&na), + tests[i].is_multicast); + } +} /* * Main */ ATF_TP_ADD_TCS(tp) { - ATF_TP_ADD_TC(tp, isc_netaddr_isnetzero); + ATF_TP_ADD_TC(tp, netaddr_isnetzero); ATF_TP_ADD_TC(tp, netaddr_masktoprefixlen); + ATF_TP_ADD_TC(tp, netaddr_multicast); return (atf_no_error()); } diff --git a/util/copyrights b/util/copyrights index 3c3291df74..f5e2b30e36 100644 --- a/util/copyrights +++ b/util/copyrights @@ -611,14 +611,6 @@ ./bin/tests/names/wire_test6.data X 1999,2000,2001 ./bin/tests/names/wire_test7.data X 1999,2000,2001 ./bin/tests/names/wire_test8.data X 1999,2000,2001 -./bin/tests/ndc.conf CONF-C 2000,2001,2004,2007,2016 -./bin/tests/ndc.conf-include CONF-C 2001,2004,2007,2016 -./bin/tests/net/Makefile.in MAKE 2000,2001,2002,2004,2007,2009,2012,2014,2016 -./bin/tests/net/driver.c C 2000,2001,2004,2007,2015,2016,2017 -./bin/tests/net/driver.h C 2000,2001,2004,2007,2016 -./bin/tests/net/netaddr_multicast.c C 2000,2001,2004,2007,2015,2016 -./bin/tests/net/sockaddr_multicast.c C 2000,2001,2004,2007,2016 -./bin/tests/net/testsuite.h C 2000,2001,2004,2007,2016 ./bin/tests/nsecify.c C 1999,2000,2001,2003,2004,2007,2008,2009,2011,2015,2016,2017 ./bin/tests/pkcs11/.gitignore X 2014 ./bin/tests/pkcs11/Makefile.in MAKE 2014,2016