|
unbound 0.1
|
Calls negative cache unit tests. More...
#include "config.h"#include "util/log.h"#include "util/net_help.h"#include "util/data/packed_rrset.h"#include "util/data/dname.h"#include "testcode/unitmain.h"#include "validator/val_neg.h"#include "sldns/rrdef.h"Functions | |
| static void | print_neg_cache (struct val_neg_cache *neg) |
| debug printout of neg cache | |
| static char * | get_random_zone (void) |
| get static pointer to random zone name | |
| static void | get_random_data (char **fromp, char **top, char *zname) |
| get static pointer to random data names from and to | |
| static void | add_item (struct val_neg_cache *neg) |
| add a random item | |
| static void | remove_item (struct val_neg_cache *neg) |
| remove a random item | |
| static size_t | sumtrees_all (struct val_neg_cache *neg) |
| sum up the zone trees | |
| static size_t | sumtrees_inuse (struct val_neg_cache *neg) |
| sum up the zone trees, in_use only | |
| static void | check_lru (struct val_neg_cache *neg) |
| check if lru is still valid | |
| static int | sum_subtree_inuse (struct val_neg_zone *zone, struct val_neg_data *data) |
| sum up number of items inuse in subtree | |
| static int | sum_zone_subtree_inuse (struct val_neg_cache *neg, struct val_neg_zone *zone) |
| sum up number of items inuse in subtree | |
| static void | check_data (struct val_neg_zone *zone, struct val_neg_data *data) |
| check point in data tree | |
| static void | checkzonetree (struct val_neg_zone *zone) |
| check if tree of data in zone is valid | |
| static void | check_zone_invariants (struct val_neg_cache *neg, struct val_neg_zone *zone) |
| check if negative cache is still valid | |
| static void | check_neg_invariants (struct val_neg_cache *neg) |
| check if negative cache is still valid | |
| static void | stress_test (struct val_neg_cache *neg) |
| perform stress test on insert and delete in neg cache | |
| void | neg_test (void) |
| unit test for negative cache functions | |
Variables | |
| static int | negverbose = 0 |
| verbose unit test for negative cache | |
Calls negative cache unit tests.
Exits with code 1 on a failure.
|
static |
debug printout of neg cache
References rbtree_type::count, val_neg_data::count, val_neg_zone::count, dname_print(), dname_str(), val_neg_data::in_use, val_neg_zone::in_use, val_neg_data::labs, val_neg_zone::labs, LDNS_MAX_DOMAINLEN, val_neg_data::len, val_neg_zone::len, val_neg_cache::max, val_neg_data::name, val_neg_zone::name, val_neg_cache::nsec3_max_iter, val_neg_zone::parent, print_neg_cache(), RBTREE_FOR, val_neg_cache::tree, val_neg_zone::tree, and val_neg_cache::use.
Referenced by check_zone_invariants(), and print_neg_cache().
|
static |
get static pointer to random zone name
References get_random_zone().
Referenced by add_item(), and get_random_zone().
|
static |
get static pointer to random data names from and to
References get_random_data(), log_nametypeclass(), and negverbose.
Referenced by add_item(), and get_random_data().
|
static |
add a random item
References add_item(), packed_rrset_data::count, lruhash_entry::data, packed_rrset_key::dname, packed_rrset_key::dname_len, ub_packed_rrset_key::entry, get_random_data(), get_random_zone(), LDNS_RR_CLASS_IN, val_neg_cache::lock, log_nametypeclass(), neg_create_zone(), neg_find_zone(), neg_insert_data(), negverbose, 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, sec_status_secure, packed_rrset_data::security, packed_rrset_key::type, unit_assert, and val_neg_zone_take_inuse().
Referenced by add_item(), and stress_test().
|
static |
remove a random item
References rbtree_type::count, val_neg_data::count, val_neg_zone::count, val_neg_data::in_use, val_neg_zone::in_use, val_neg_cache::lock, log_nametypeclass(), val_neg_data::name, val_neg_zone::name, neg_delete_data(), negverbose, rbtree_first(), rbtree_next(), RBTREE_NULL, remove_item(), val_neg_cache::tree, and val_neg_zone::tree.
Referenced by remove_item(), and stress_test().
|
static |
sum up the zone trees
References rbtree_type::count, RBTREE_FOR, sumtrees_all(), val_neg_cache::tree, and val_neg_zone::tree.
Referenced by check_lru(), and sumtrees_all().
|
static |
sum up the zone trees, in_use only
References val_neg_data::count, rbtree_first(), RBTREE_FOR, RBTREE_NULL, sumtrees_inuse(), val_neg_cache::tree, and val_neg_zone::tree.
Referenced by check_lru(), and sumtrees_inuse().
|
static |
check if lru is still valid
References check_lru(), val_neg_cache::first, val_neg_cache::last, negverbose, val_neg_data::next, val_neg_data::prev, sumtrees_all(), sumtrees_inuse(), and unit_assert.
Referenced by check_lru(), and check_neg_invariants().
|
static |
sum up number of items inuse in subtree
References dname_subdomain_c(), val_neg_data::in_use, val_neg_data::name, RBTREE_FOR, sum_subtree_inuse(), val_neg_zone::tree, and val_neg_data::zone.
Referenced by check_data(), and sum_subtree_inuse().
|
static |
sum up number of items inuse in subtree
References dname_subdomain_c(), val_neg_zone::in_use, val_neg_zone::name, RBTREE_FOR, sum_zone_subtree_inuse(), and val_neg_cache::tree.
Referenced by check_zone_invariants(), and sum_zone_subtree_inuse().
|
static |
check point in data tree
References check_data(), val_neg_data::count, dname_is_root(), val_neg_data::in_use, val_neg_data::labs, val_neg_data::len, val_neg_data::name, val_neg_data::parent, query_dname_compare(), sum_subtree_inuse(), and unit_assert.
|
static |
check if tree of data in zone is valid
References check_data(), checkzonetree(), RBTREE_FOR, val_neg_zone::tree, and val_neg_data::zone.
Referenced by check_zone_invariants(), and checkzonetree().
|
static |
check if negative cache is still valid
References check_zone_invariants(), checkzonetree(), rbtree_type::cmp, rbtree_type::count, val_neg_zone::count, dname_is_root(), val_neg_zone::in_use, val_neg_zone::labs, val_neg_zone::len, log_err(), log_nametypeclass(), val_neg_zone::name, negverbose, val_neg_zone::nsec3_hash, val_neg_zone::parent, print_neg_cache(), query_dname_compare(), sum_zone_subtree_inuse(), val_neg_zone::tree, unit_assert, val_neg_data_compare(), and val_neg_data::zone.
Referenced by check_neg_invariants(), and check_zone_invariants().
|
static |
check if negative cache is still valid
References check_lru(), check_neg_invariants(), check_zone_invariants(), rbtree_type::cmp, rbtree_type::count, val_neg_cache::first, val_neg_cache::last, val_neg_cache::lock, val_neg_cache::max, val_neg_cache::nsec3_max_iter, RBTREE_FOR, val_neg_cache::tree, unit_assert, val_neg_cache::use, and val_neg_zone_compare().
Referenced by check_neg_invariants(), and stress_test().
|
static |
perform stress test on insert and delete in neg cache
References add_item(), check_neg_invariants(), val_neg_cache::first, negverbose, remove_item(), stress_test(), and unit_assert.
Referenced by neg_test(), and stress_test().
| void neg_test | ( | void | ) |
unit test for negative cache functions
References neg_cache_delete(), neg_test(), stress_test(), unit_assert, unit_show_feature(), and val_neg_create().
Referenced by main(), and neg_test().
|
static |
verbose unit test for negative cache
Referenced by add_item(), check_lru(), check_zone_invariants(), get_random_data(), remove_item(), and stress_test().