mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 05:57:52 +00:00
[master] Refactor RDATA unit tests
4667. [cleanup] Refactor RDATA unit tests. [RT #45610]
This commit is contained in:
parent
433af1819b
commit
712825d755
2
CHANGES
2
CHANGES
@ -1,3 +1,5 @@
|
|||||||
|
4667. [cleanup] Refactor RDATA unit tests. [RT #45610]
|
||||||
|
|
||||||
4666. [bug] dnssec-keymgr: Domain names beginning with digits (0-9)
|
4666. [bug] dnssec-keymgr: Domain names beginning with digits (0-9)
|
||||||
could cause a parser error when reading the policy
|
could cause a parser error when reading the policy
|
||||||
file. This now works correctly so long as the domain
|
file. This now works correctly so long as the domain
|
||||||
|
@ -71,7 +71,6 @@ XTARGETS = adb_test@EXEEXT@ \
|
|||||||
nsecify@EXEEXT@ \
|
nsecify@EXEEXT@ \
|
||||||
ratelimiter_test@EXEEXT@ \
|
ratelimiter_test@EXEEXT@ \
|
||||||
rbt_test@EXEEXT@ \
|
rbt_test@EXEEXT@ \
|
||||||
rdata_test@EXEEXT@ \
|
|
||||||
rwlock_test@EXEEXT@ \
|
rwlock_test@EXEEXT@ \
|
||||||
serial_test@EXEEXT@ \
|
serial_test@EXEEXT@ \
|
||||||
shutdown_test@EXEEXT@ \
|
shutdown_test@EXEEXT@ \
|
||||||
@ -110,7 +109,6 @@ XSRCS = adb_test.c \
|
|||||||
nsecify.c \
|
nsecify.c \
|
||||||
ratelimiter_test.c \
|
ratelimiter_test.c \
|
||||||
rbt_test.c \
|
rbt_test.c \
|
||||||
rdata_test.c \
|
|
||||||
rwlock_test.c \
|
rwlock_test.c \
|
||||||
serial_test.c \
|
serial_test.c \
|
||||||
shutdown_test.c \
|
shutdown_test.c \
|
||||||
@ -228,10 +226,6 @@ rbt_test@EXEEXT@: rbt_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS}
|
|||||||
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ rbt_test.@O@ \
|
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ rbt_test.@O@ \
|
||||||
${DNSLIBS} ${ISCLIBS} ${LIBS}
|
${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}
|
rwlock_test@EXEEXT@: rwlock_test.@O@ ${ISCDEPLIBS}
|
||||||
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ rwlock_test.@O@ \
|
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ rwlock_test.@O@ \
|
||||||
${ISCLIBS} ${LIBS}
|
${ISCLIBS} ${LIBS}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <atf-c.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -19,6 +21,7 @@
|
|||||||
#include <isc/entropy.h>
|
#include <isc/entropy.h>
|
||||||
#include <isc/file.h>
|
#include <isc/file.h>
|
||||||
#include <isc/hash.h>
|
#include <isc/hash.h>
|
||||||
|
#include <isc/hex.h>
|
||||||
#include <isc/mem.h>
|
#include <isc/mem.h>
|
||||||
#include <isc/os.h>
|
#include <isc/os.h>
|
||||||
#include <isc/print.h>
|
#include <isc/print.h>
|
||||||
@ -353,6 +356,29 @@ fromhex(char c) {
|
|||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
dns_test_getdata(const char *file, unsigned char *buf,
|
dns_test_getdata(const char *file, unsigned char *buf,
|
||||||
size_t bufsiz, size_t *sizep)
|
size_t bufsiz, size_t *sizep)
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id$ */
|
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@ -79,3 +77,6 @@ dns_test_loaddb(dns_db_t **db, dns_dbtype_t dbtype, const char *origin,
|
|||||||
isc_result_t
|
isc_result_t
|
||||||
dns_test_getdata(const char *file, unsigned char *buf,
|
dns_test_getdata(const char *file, unsigned char *buf,
|
||||||
size_t bufsiz, size_t *sizep);
|
size_t bufsiz, size_t *sizep);
|
||||||
|
|
||||||
|
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
Loading…
x
Reference in New Issue
Block a user