|
unbound 0.1
|
Calls msg parse unit tests. More...
#include "config.h"#include <sys/time.h>#include "util/log.h"#include "testcode/unitmain.h"#include "util/data/msgparse.h"#include "util/data/msgreply.h"#include "util/data/msgencode.h"#include "util/data/dname.h"#include "util/alloc.h"#include "util/regional.h"#include "util/net_help.h"#include "testcode/readhex.h"#include "testcode/testpkts.h"#include "sldns/sbuffer.h"#include "sldns/str2wire.h"#include "sldns/wire2str.h"Macros | |
| #define | xstr(s) |
| #define | str(s) |
| #define | SRCDIRSTR xstr(SRCDIR) |
Functions | |
| static int | test_buffers (sldns_buffer *pkt, sldns_buffer *out) |
| see if buffers contain the same packet | |
| static void | checkformerr (sldns_buffer *pkt) |
| check if unbound formerr equals ldns formerr | |
| static void | perf_encode (struct query_info *qi, struct reply_info *rep, uint16_t id, uint16_t flags, sldns_buffer *out, time_t timenow, struct edns_data *edns) |
| performance test message encoding | |
| static void | perftestpkt (sldns_buffer *pkt, struct alloc_cache *alloc, sldns_buffer *out, const char *hex) |
| perf test a packet | |
| static void | print_rrset (struct ub_packed_rrset_key *rrset) |
| print packed rrset | |
| static void | print_packet_rrsets (struct query_info *qinfo, struct reply_info *rep) |
| debug print a packet that failed | |
| static int | no_data_for_rrsig (struct reply_info *rep, struct ub_packed_rrset_key *rrsig) |
| check that there is no data element that matches the RRSIG | |
| static void | check_the_rrsigs (struct query_info *qinfo, struct reply_info *rep) |
| check RRSIGs in packet | |
| static void | testpkt (sldns_buffer *pkt, struct alloc_cache *alloc, sldns_buffer *out, const char *hex) |
| test a packet | |
| static void | simpletest (sldns_buffer *pkt, struct alloc_cache *alloc, sldns_buffer *out) |
| simple test of parsing | |
| static void | testfromfile (sldns_buffer *pkt, struct alloc_cache *alloc, sldns_buffer *out, const char *fname) |
| simple test of parsing, pcat file | |
| static void | testfromdrillfile (sldns_buffer *pkt, struct alloc_cache *alloc, sldns_buffer *out, const char *fname) |
| simple test of parsing, drill file | |
| void | msgparse_test (void) |
| unit test for msgreply and msgparse | |
Variables | |
| static int | vbmp = 0 |
| verbose message parse unit test | |
| static int | check_formerr_gone = 0 |
| do not accept formerr | |
| static int | matches_nolocation = 0 |
| if matching within a section should disregard the order of RRs. | |
| static int | check_rrsigs = 0 |
| see if RRSIGs are properly matched to RRsets. | |
| static int | check_nosameness = 0 |
| do not check buffer sameness | |
Calls msg parse unit tests.
Exits with code 1 on a failure.
| #define xstr | ( | s | ) |
| #define str | ( | s | ) |
|
static |
see if buffers contain the same packet
References log_buf(), log_hex(), log_info(), match_all(), matches_nolocation, sldns_buffer_at(), sldns_buffer_begin(), sldns_buffer_limit(), sldns_wire2str_pkt(), test_buffers(), unit_assert, and vbmp.
Referenced by test_buffers(), and testpkt().
|
static |
check if unbound formerr equals ldns formerr
References checkformerr(), fatal_exit(), sldns_buffer_begin(), sldns_buffer_limit(), sldns_wire2str_pkt(), and unit_assert.
Referenced by checkformerr(), perftestpkt(), and testpkt().
|
static |
performance test message encoding
References attach_edns_record(), edns_data::bits, EDNS_DO, fatal_exit(), perf_encode(), regional_create(), regional_destroy(), regional_free_all(), reply_info_encode(), sldns_buffer_limit(), and unit_assert.
Referenced by perf_encode(), and perftestpkt().
|
static |
perf test a packet
References checkformerr(), reply_info::flags, hex_to_buf(), perf_encode(), perftestpkt(), query_info_clear(), regional_create(), regional_destroy(), reply_info_parse(), reply_info_parsedelete(), sldns_buffer_at(), sldns_buffer_begin(), sldns_buffer_limit(), sldns_wire2str_rcode_buf(), unit_assert, and vbmp.
Referenced by perftestpkt(), and simpletest().
|
static |
print packed rrset
References packed_rrset_data::count, packed_rr_to_string(), print_rrset(), and packed_rrset_data::rrsig_count.
Referenced by print_packet_rrsets(), and print_rrset().
|
static |
debug print a packet that failed
References reply_info::an_numrrsets, reply_info::ar_numrrsets, log_query_info(), reply_info::ns_numrrsets, print_packet_rrsets(), print_rrset(), and reply_info::rrsets.
Referenced by check_the_rrsigs(), and print_packet_rrsets().
|
static |
check that there is no data element that matches the RRSIG
References packed_rrset_key::dname, LDNS_RR_TYPE_RRSIG, no_data_for_rrsig(), query_dname_compare(), ub_packed_rrset_key::rk, reply_info::rrset_count, reply_info::rrsets, and packed_rrset_key::type.
Referenced by check_the_rrsigs(), and no_data_for_rrsig().
|
static |
check RRSIGs in packet
References check_the_rrsigs(), LDNS_RR_TYPE_RRSIG, log_dns_msg(), no_data_for_rrsig(), print_packet_rrsets(), ub_packed_rrset_key::rk, reply_info::rrset_count, reply_info::rrsets, packed_rrset_key::type, and unit_assert.
Referenced by check_the_rrsigs(), and testpkt().
|
static |
test a packet
References attach_edns_record(), edns_data::bits, calc_edns_field_size(), check_formerr_gone, check_nosameness, check_rrsigs, check_the_rrsigs(), checkformerr(), EDNS_DO, reply_info::flags, hex_to_buf(), query_info_clear(), regional_create(), regional_destroy(), reply_info_encode(), reply_info_parse(), reply_info_parsedelete(), sldns_buffer_at(), sldns_buffer_begin(), sldns_buffer_limit(), sldns_wire2str_rcode_buf(), test_buffers(), testpkt(), unit_assert, and vbmp.
Referenced by simpletest(), testfromdrillfile(), testfromfile(), and testpkt().
|
static |
simple test of parsing
References perftestpkt(), simpletest(), and testpkt().
Referenced by msgparse_test(), and simpletest().
|
static |
simple test of parsing, pcat file
References testfromfile(), testpkt(), and vbmp.
Referenced by msgparse_test(), and testfromfile().
|
static |
simple test of parsing, drill file
References testfromdrillfile(), and testpkt().
Referenced by msgparse_test(), and testfromdrillfile().
| void msgparse_test | ( | void | ) |
unit test for msgreply and msgparse
References alloc_clear(), alloc_init(), check_formerr_gone, check_nosameness, check_rrsigs, matches_nolocation, MAX_NEG_TTL, msgparse_test(), simpletest(), sldns_buffer_free(), sldns_buffer_new(), testfromdrillfile(), testfromfile(), and unit_show_feature().
Referenced by main(), and msgparse_test().
|
static |
do not accept formerr
Referenced by msgparse_test(), and testpkt().
|
static |
if matching within a section should disregard the order of RRs.
Referenced by msgparse_test(), and test_buffers().
|
static |
see if RRSIGs are properly matched to RRsets.
Referenced by msgparse_test(), and testpkt().
|
static |
do not check buffer sameness
Referenced by msgparse_test(), and testpkt().