[v9_10] Refactor RDATA unit tests

4667.	[cleanup]	Refactor RDATA unit tests. [RT #45610]

(cherry picked from commit 712825d755)
This commit is contained in:
Michał Kępień 2017-07-25 07:34:27 +02:00
parent fc9b18d917
commit 41620b94c4
6 changed files with 892 additions and 1777 deletions

View file

@ -1,3 +1,5 @@
4667. [cleanup] Refactor RDATA unit tests. [RT #45610]
4665. [protocol] Added support for ED25519 and ED448 DNSSEC signing
algorithms (RFC 8080). (Note: these algorithms
depend on code currently in the development branch

View file

@ -83,7 +83,6 @@ XTARGETS = adb_test@EXEEXT@ \
nsecify@EXEEXT@ \
ratelimiter_test@EXEEXT@ \
rbt_test@EXEEXT@ \
rdata_test@EXEEXT@ \
rwlock_test@EXEEXT@ \
serial_test@EXEEXT@ \
shutdown_test@EXEEXT@ \
@ -123,7 +122,6 @@ XSRCS = adb_test.c \
nsecify.c \
ratelimiter_test.c \
rbt_test.c \
rdata_test.c \
rwlock_test.c \
serial_test.c \
shutdown_test.c \
@ -241,10 +239,6 @@ rbt_test@EXEEXT@: rbt_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS}
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ rbt_test.@O@ \
${DNSLIBS} ${ISCLIBS} ${LIBS}
rdata_test@EXEEXT@: rdata_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS}
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ rdata_test.@O@ \
${DNSLIBS} ${ISCLIBS} ${LIBS}
rwlock_test@EXEEXT@: rwlock_test.@O@ ${ISCDEPLIBS}
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ rwlock_test.@O@ \
${ISCLIBS} ${LIBS}

File diff suppressed because it is too large Load diff

View file

@ -20,6 +20,8 @@
#include <config.h>
#include <atf-c.h>
#include <time.h>
#include <unistd.h>
@ -27,6 +29,7 @@
#include <isc/buffer.h>
#include <isc/entropy.h>
#include <isc/hash.h>
#include <isc/hex.h>
#include <isc/mem.h>
#include <isc/os.h>
#include <isc/string.h>
@ -326,3 +329,26 @@ dns_test_loaddb(dns_db_t **db, dns_dbtype_t dbtype, const char *origin,
result = dns_db_load(*db, testfile);
return (result);
}
/*
* Format contents of given memory region as a hex string, using the buffer
* of length 'buflen' pointed to by 'buf'. 'buflen' must be at least three
* times 'len'. Always returns 'buf'.
*/
char *
dns_test_tohex(const unsigned char *data, size_t len, char *buf, size_t buflen)
{
isc_constregion_t source = {
.base = data,
.length = len
};
isc_buffer_t target;
isc_result_t result;
memset(buf, 0, buflen);
isc_buffer_init(&target, buf, buflen);
result = isc_hex_totext((isc_region_t *)&source, 1, " ", &target);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
return (buf);
}

View file

@ -14,8 +14,6 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id$ */
/*! \file */
#include <config.h>
@ -80,3 +78,6 @@ dns_test_nap(isc_uint32_t usec);
isc_result_t
dns_test_loaddb(dns_db_t **db, dns_dbtype_t dbtype, const char *origin,
const char *testfile);
char *
dns_test_tohex(const unsigned char *data, size_t len, char *buf, size_t buflen);

File diff suppressed because it is too large Load diff