Commit 712825d7 authored by Michał Kępień's avatar Michał Kępień
Browse files

[master] Refactor RDATA unit tests

4667.	[cleanup]	Refactor RDATA unit tests. [RT #45610]
parent 433af181
4667. [cleanup] Refactor RDATA unit tests. [RT #45610]
4666. [bug] dnssec-keymgr: Domain names beginning with digits (0-9)
could cause a parser error when reading the policy
file. This now works correctly so long as the domain
......
......@@ -71,7 +71,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@ \
......@@ -110,7 +109,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 \
......@@ -228,10 +226,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}
......
This diff is collapsed.
......@@ -10,6 +10,8 @@
#include <config.h>
#include <atf-c.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
......@@ -19,6 +21,7 @@
#include <isc/entropy.h>
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/hex.h>
#include <isc/mem.h>
#include <isc/os.h>
#include <isc/print.h>
......@@ -353,6 +356,29 @@ fromhex(char c) {
/* 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
dns_test_getdata(const char *file, unsigned char *buf,
size_t bufsiz, size_t *sizep)
......
......@@ -6,8 +6,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id$ */
/*! \file */
#include <config.h>
......@@ -79,3 +77,6 @@ dns_test_loaddb(dns_db_t **db, dns_dbtype_t dbtype, const char *origin,
isc_result_t
dns_test_getdata(const char *file, unsigned char *buf,
size_t bufsiz, size_t *sizep);
char *
dns_test_tohex(const unsigned char *data, size_t len, char *buf, size_t buflen);
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment