unitneg.c File Reference

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
 

Detailed Description

Calls negative cache unit tests.

Exits with code 1 on a failure.