|
unbound 0.1
|
Unit test main program. More...
#include "config.h"#include "sldns/rrdef.h"#include "sldns/keyraw.h"#include "util/log.h"#include "testcode/unitmain.h"#include "util/alloc.h"#include "util/net_help.h"#include "util/config_file.h"#include "util/rtt.h"#include "util/timehist.h"#include "iterator/iterator.h"#include "libunbound/unbound.h"#include "util/edns.h"#include "util/random.h"#include "respip/respip.h"#include "services/localzone.h"#include "util/data/packed_rrset.h"#include "util/regional.h"#include "sldns/sbuffer.h"#include "util/data/dname.h"#include "util/data/msgreply.h"#include "util/data/msgencode.h"#include "sldns/str2wire.h"#include "services/mesh.h"Data Structures | |
| struct | addr_action |
| struct | addr_data |
Typedefs | |
| typedef struct addr_action | addr_action_t |
| typedef struct addr_data | addr_data_t |
Functions | |
| static void | alloc_test (void) |
| test alloc code | |
| static void | net_test (void) |
| test net code | |
| static void | config_memsize_test (void) |
| test config_file: cfg_parse_memsize | |
| static void | config_ports_list_test (void) |
| test config_file: cfg_ports_list_contains | |
| static void | config_tag_test (void) |
| test config_file: test tag code | |
| static void | rtt_test (void) |
| test RTT code | |
| static void | edns_cookie_invalid_version (void) |
| static void | edns_cookie_invalid_hash (void) |
| static void | edns_cookie_rfc9018_a3_better (void) |
| static void | edns_cookie_rfc9018_a3 (void) |
| static void | edns_cookie_rfc9018_a2 (void) |
| static void | edns_cookie_rfc9018_a1 (void) |
| static void | edns_cookie_test (void) |
| test interoperable DNS cookies (RFC9018) | |
| static void | rnd_test (void) |
| test randomness | |
| static void | verify_respip_set_actions (struct respip_set *set, addr_action_t actions[], int actions_len) |
| Utility function that verifies that the respip set has actions as expected. | |
| static void | respip_conf_actions_test (void) |
| Global respip actions test; apply raw config data and verify that all the nodes in the respip set, looked up by address, have expected actions. | |
| static void | respip_view_conf_actions_test (void) |
| Per-view respip actions test; apply raw configuration with two views and verify that actions are as expected in respip sets of both views. | |
| static void | verify_rrset (struct respip_set *set, const char *ipstr, const char *rdatastr, size_t rdi, uint16_t type) |
| find the respip address node in the specified tree (by address lookup) and verify type and address of the specified rdata (by index) in this node's rrset | |
| static void | cfg_insert_respip_data (struct config_str2list **respip_actions, struct config_str2list **respip_data) |
| Populate raw respip redirect config data, used for both global and view-based respip redirect test case. | |
| static void | respip_conf_data_test (void) |
| Test global respip redirect w/ data directives. | |
| static void | respip_view_conf_data_test (void) |
| Test per-view respip redirect w/ data directives. | |
| static struct resp_addr * | respip_test_add (struct respip_set *set, char *netblock) |
| Add a netblock to the respip set. | |
| static struct resp_addr * | respip_test_lookup (struct respip_set *set, const char *ip) |
| Find the netblock that encloses ip, like an answer IP lookup does. | |
| static void | respip_delete_first_test (void) |
| Delete the first node in the tree, a netblock that encloses another node. | |
| static void | respip_test (void) |
| respip unit tests | |
| static void | edns_ede_encode_setup (struct edns_data *edns, struct regional *region) |
| static void | edns_ede_encode_encodedecode (struct query_info *qinfo, struct reply_info *rep, struct regional *region, struct edns_data *edns, sldns_buffer *pkt) |
| static void | edns_ede_encode_check (struct edns_data *edns, int *found_ede, int *found_ede_other, int *found_ede_txt, int *found_other_edns) |
| static void | edns_ede_encode_fit_test (struct query_info *qinfo, struct reply_info *rep, struct regional *region) |
| static void | edns_ede_encode_notxt_fit_test (struct query_info *qinfo, struct reply_info *rep, struct regional *region) |
| static void | edns_ede_encode_no_fit_test (struct query_info *qinfo, struct reply_info *rep, struct regional *region) |
| static void | edns_ede_answer_encode_test (void) |
| test optional EDE encoding with various buffer available sizes | |
| static void | compare_localzone_trees (struct local_zones *z1, struct local_zones *z2) |
| static void | localzone_parents_test (void) |
| static void | localzone_test (void) |
| localzone unit tests | |
| static void | mesh_test (void) |
| mesh unit tests | |
| static void | packed_rrset_test (void) |
| packed_rrset unit tests | |
| void | unit_show_func (const char *file, const char *func) |
| we are now testing this function | |
| void | unit_show_feature (const char *feature) |
| we are testing this functionality | |
| int | main (int argc, char *argv[]) |
| Main unit test program. | |
Variables | |
| int | testcount = 0 |
| number of tests done | |
| static addr_data_t | config_response_ip_data [] |
| Dataset used to test redirect rrset initialization for both global and per-view respip redirect configuration. | |
Unit test main program.
Calls all the other unit tests. Exits with code 1 on a failure. 0 if all unit tests are successful.
|
static |
test alloc code
References alloc_clear(), alloc_init(), alloc_special_obtain(), alloc_special_release(), alloc_stats(), alloc_test(), alloc_cache::num_quar, unit_assert, and unit_show_feature().
Referenced by alloc_test(), and main().
|
static |
test net code
References addr_in_common(), addr_is_any(), addr_is_ip4mapped(), addr_mask(), addr_to_str(), ipstrtoaddr(), is_pow2(), net_test(), netblockstrtoaddr(), sockaddr_cmp_addr(), str_is_ip6(), unit_assert, and unit_show_func().
Referenced by main(), and net_test().
|
static |
test config_file: cfg_parse_memsize
References cfg_parse_memsize(), config_memsize_test(), unit_assert, and unit_show_func().
Referenced by config_memsize_test(), and main().
|
static |
test config_file: cfg_ports_list_contains
References cfg_ports_list_contains(), config_ports_list_test(), unit_assert, and unit_show_func().
Referenced by config_ports_list_test(), and main().
|
static |
test config_file: test tag code
References config_tag_test(), taglist_intersect(), unit_assert, and unit_show_func().
Referenced by config_tag_test(), and main().
|
static |
test RTT code
References NUM_BUCKETS_HIST, rtt_init(), rtt_lost(), RTT_MAX_TIMEOUT, RTT_MIN_TIMEOUT, rtt_test(), rtt_timeout(), rtt_update(), UB_STATS_BUCKET_NUM, unit_assert, unit_show_func(), and UNKNOWN_SERVER_NICENESS.
Referenced by main(), and rtt_test().
|
static |
test interoperable DNS cookies (RFC9018)
References edns_cookie_test(), and unit_show_feature().
Referenced by edns_cookie_test(), and main().
|
static |
test randomness
References rnd_test(), ub_initstate(), ub_randfree(), ub_random(), ub_random_max(), unit_assert, and unit_show_feature().
Referenced by main(), and rnd_test().
|
static |
Utility function that verifies that the respip set has actions as expected.
we have the node and the node has the correct action and has no data
References addr_tree_find(), rbtree_type::count, netblockstrtoaddr(), resp_addr::node, resp_addr_get_action(), resp_addr_get_rrset(), respip_set_get_tree(), unit_assert, and verify_respip_set_actions().
Referenced by respip_conf_actions_test(), respip_view_conf_actions_test(), and verify_respip_set_actions().
|
static |
Global respip actions test; apply raw config data and verify that all the nodes in the respip set, looked up by address, have expected actions.
References cfg_str2list_insert(), config_deldblstrlist(), config_file::respip_actions, respip_always_nxdomain, respip_always_refuse, respip_always_transparent, respip_conf_actions_test(), respip_deny, respip_global_apply_cfg(), respip_inform, respip_inform_deny, respip_redirect, respip_set_create(), respip_set_delete(), unit_assert, unit_show_feature(), and verify_respip_set_actions().
Referenced by respip_conf_actions_test(), and respip_test().
|
static |
Per-view respip actions test; apply raw configuration with two views and verify that actions are as expected in respip sets of both views.
References cfg_str2list_insert(), view::lock, config_view::name, config_view::next, config_view::respip_actions, respip_always_nxdomain, respip_always_refuse, respip_always_transparent, respip_deny, respip_inform, respip_inform_deny, respip_redirect, view::respip_set, respip_view_conf_actions_test(), respip_views_apply_cfg(), unit_assert, unit_show_feature(), verify_respip_set_actions(), config_file::views, views_apply_cfg(), views_create(), views_delete(), and views_find_view().
Referenced by respip_test(), and respip_view_conf_actions_test().
|
static |
find the respip address node in the specified tree (by address lookup) and verify type and address of the specified rdata (by index) in this node's rrset
References addr_tree_find(), netblockstrtoaddr(), resp_addr::node, packed_rr_to_string(), resp_addr_get_rrset(), respip_set_get_tree(), ub_packed_rrset_key::rk, packed_rrset_key::type, unit_assert, and verify_rrset().
Referenced by respip_conf_data_test(), respip_view_conf_data_test(), and verify_rrset().
|
static |
Populate raw respip redirect config data, used for both global and view-based respip redirect test case.
References cfg_insert_respip_data(), cfg_str2list_insert(), config_response_ip_data, resp_addr::data, and unit_assert.
Referenced by cfg_insert_respip_data(), respip_conf_data_test(), and respip_view_conf_data_test().
|
static |
Test global respip redirect w/ data directives.
References cfg_insert_respip_data(), LDNS_RR_TYPE_A, LDNS_RR_TYPE_AAAA, LDNS_RR_TYPE_CNAME, config_file::respip_actions, respip_conf_data_test(), config_file::respip_data, respip_global_apply_cfg(), respip_set_create(), respip_set_delete(), unit_assert, unit_show_feature(), and verify_rrset().
Referenced by respip_conf_data_test(), and respip_test().
|
static |
Test per-view respip redirect w/ data directives.
References cfg_insert_respip_data(), LDNS_RR_TYPE_A, LDNS_RR_TYPE_AAAA, LDNS_RR_TYPE_CNAME, view::lock, config_view::name, config_view::respip_actions, config_view::respip_data, view::respip_set, respip_view_conf_data_test(), respip_views_apply_cfg(), unit_assert, unit_show_feature(), verify_rrset(), config_file::views, views_apply_cfg(), views_create(), views_delete(), and views_find_view().
Referenced by respip_test(), and respip_view_conf_data_test().
|
static |
Add a netblock to the respip set.
References netblockstrtoaddr(), respip_sockaddr_find_or_create(), respip_test_add(), and unit_assert.
Referenced by respip_delete_first_test(), and respip_test_add().
|
static |
Find the netblock that encloses ip, like an answer IP lookup does.
References addr_tree_lookup(), ipstrtoaddr(), respip_set_get_tree(), respip_test_lookup(), and unit_assert.
Referenced by respip_delete_first_test(), and respip_test_lookup().
|
static |
Delete the first node in the tree, a netblock that encloses another node.
The enclosed node must not keep the deleted node as parent.
References addr_tree_init_parents(), respip_delete_first_test(), respip_set_create(), respip_set_delete(), respip_set_get_tree(), respip_sockaddr_delete(), respip_test_add(), respip_test_lookup(), unit_assert, and unit_show_func().
Referenced by respip_delete_first_test(), and respip_test().
|
static |
respip unit tests
References respip_conf_actions_test(), respip_conf_data_test(), respip_delete_first_test(), respip_test(), respip_view_conf_actions_test(), and respip_view_conf_data_test().
Referenced by main(), and respip_test().
|
static |
test optional EDE encoding with various buffer available sizes
References BIT_QR, construct_reply_info_base(), edns_ede_answer_encode_test(), LDNS_RR_CLASS_IN, LDNS_RR_TYPE_TXT, query_info::qclass, query_info::qname, query_info::qname_len, query_info::qtype, regional_create(), regional_destroy(), regional_free_all(), sec_status_unchecked, sldns_str2wire_dname(), unit_assert, and unit_show_feature().
Referenced by edns_ede_answer_encode_test(), and main().
|
static |
|
static |
mesh unit tests
References fatal_exit(), regional::large_list, regional::large_object_size, mesh_copy_client_info(), mesh_test(), view::name, regional::next, regional_create(), regional_destroy(), unit_assert, unit_show_func(), respip_client_info::view, and respip_client_info::view_name.
Referenced by main(), and mesh_test().
|
static |
packed_rrset unit tests
References packed_rrset_data::count, lruhash_entry::data, packed_rrset_key::dname, packed_rrset_key::dname_len, ub_packed_rrset_key::entry, fatal_exit(), LDNS_MAX_DOMAINLEN, LDNS_RR_CLASS_IN, LDNS_RR_TYPE_A, LDNS_RR_TYPE_TXT, packed_rr_to_string(), packed_rrset_test(), ub_packed_rrset_key::rk, packed_rrset_data::rr_data, packed_rrset_data::rr_len, packed_rrset_data::rr_ttl, packed_rrset_key::rrset_class, packed_rrset_key::type, unit_assert, and unit_show_func().
Referenced by main(), and packed_rrset_test().
| void unit_show_func | ( | const char * | file, |
| const char * | func ) |
we are now testing this function
References unit_show_func().
Referenced by canon_owner_buf_test(), config_memsize_test(), config_ports_list_test(), config_tag_test(), dname_test_canoncmp(), dname_test_count_labels(), dname_test_count_size_labels(), dname_test_dname_lab_cmp(), dname_test_has_label(), dname_test_isroot(), dname_test_iswild(), dname_test_pdtl(), dname_test_pkt_dname_len(), dname_test_pkt_dname_len_budget(), dname_test_qdl(), dname_test_qdtl(), dname_test_query_dname_compare(), dname_test_removelabel(), dname_test_removelabellimitlen(), dname_test_sigcount(), dname_test_strict_subdomain(), dname_test_subdomain(), dname_test_topdomain(), dname_test_valid(), dnskey_ds_digest_test(), dstest_file(), mesh_test(), net_test(), nsec3_hash_test(), packed_rrset_test(), respip_delete_first_test(), rtt_test(), tcp_reuse_tree_list_test(), tcpid_test(), unit_show_func(), verifytest_file(), zonemd_check_test(), zonemd_generate_tests(), and zonemd_verify_tests().
| void unit_show_feature | ( | const char * | feature | ) |
we are testing this functionality
References unit_show_feature().
Referenced by alloc_test(), anchors_test(), authzone_test(), edns_cookie_test(), edns_ede_answer_encode_test(), infra_test(), ldns_test(), lruhash_test(), msgparse_test(), neg_test(), regional_test(), respip_conf_actions_test(), respip_conf_data_test(), respip_view_conf_actions_test(), respip_view_conf_data_test(), rnd_test(), slabhash_test(), tcpreuse_test(), unit_show_feature(), verify_test(), and zonemd_test().
| int main | ( | int | argc, |
| char * | argv[] ) |
Main unit test program.
Setup, teardown and report errors.
| argc | arg count. |
| argv | array of commandline arguments. |
References alloc_test(), anchors_test(), authzone_test(), config_memsize_test(), config_ports_list_test(), config_tag_test(), dname_test(), doq_test(), edns_cookie_test(), edns_ede_answer_encode_test(), fatal_exit(), infra_test(), ldns_test(), localzone_test(), log_get_lock(), log_init(), lruhash_test(), main, mesh_test(), msgparse_test(), neg_test(), net_test(), packed_rrset_test(), regional_test(), respip_test(), rnd_test(), RRSET_ROUNDROBIN, rtt_test(), slabhash_test(), tcpreuse_test(), testcount, verify_test(), and zonemd_test().
| int testcount = 0 |
number of tests done
Referenced by main().
|
static |
Dataset used to test redirect rrset initialization for both global and per-view respip redirect configuration.
Referenced by cfg_insert_respip_data().