mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-01-08 07:49:35 -05:00
fixup unit test for lameness changes.
git-svn-id: file:///svn/unbound/trunk@1138 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
5eb7ff35ca
commit
78a3c4e93d
2 changed files with 21 additions and 4 deletions
|
|
@ -1,6 +1,7 @@
|
|||
25 June 2008: Wouter
|
||||
- fixup fwd_ancil test typos.
|
||||
- Fix for newegg lameness : ok for qtype=A, but lame for others.
|
||||
- fixup unit test for infra cache, test lame merging.
|
||||
|
||||
24 June 2008: Wouter
|
||||
- removed testcode/checklocks from production code compilation path.
|
||||
|
|
|
|||
|
|
@ -319,6 +319,7 @@ infra_test()
|
|||
struct infra_host_key* k;
|
||||
struct infra_host_data* d;
|
||||
int init = 376;
|
||||
int dlame, alame, olame;
|
||||
|
||||
slab = infra_create(cfg);
|
||||
unit_assert( infra_host(slab, (struct sockaddr_storage*)&one,
|
||||
|
|
@ -343,15 +344,30 @@ infra_test()
|
|||
unit_assert( vs == 0 && to == init );
|
||||
|
||||
unit_assert( infra_set_lame(slab, (struct sockaddr_storage*)&one,
|
||||
(socklen_t)sizeof(int), zone, zonelen, now, 0) );
|
||||
(socklen_t)sizeof(int), zone, zonelen, now, 0,
|
||||
LDNS_RR_TYPE_A) );
|
||||
unit_assert( (d=infra_lookup_host(slab, (struct sockaddr_storage*)&one,
|
||||
(socklen_t)sizeof(int), 0, now, &k)) );
|
||||
unit_assert( d->ttl == now+cfg->host_ttl );
|
||||
unit_assert( d->edns_version == 0 );
|
||||
unit_assert( infra_lookup_lame(d, zone, zonelen, now)==1 );
|
||||
unit_assert( infra_lookup_lame(d, zone, zonelen, now,
|
||||
&dlame, &alame, &olame) );
|
||||
unit_assert(!dlame && alame && !olame);
|
||||
unit_assert( !infra_lookup_lame(d, zone, zonelen,
|
||||
now+cfg->lame_ttl+10) );
|
||||
unit_assert( !infra_lookup_lame(d, (uint8_t*)"\000", 1, now) );
|
||||
now+cfg->lame_ttl+10, &dlame, &alame, &olame) );
|
||||
unit_assert( !infra_lookup_lame(d, (uint8_t*)"\000", 1, now,
|
||||
&dlame, &alame, &olame) );
|
||||
lock_rw_unlock(&k->entry.lock);
|
||||
|
||||
/* test merge of data */
|
||||
unit_assert( infra_set_lame(slab, (struct sockaddr_storage*)&one,
|
||||
(socklen_t)sizeof(int), zone, zonelen, now, 0,
|
||||
LDNS_RR_TYPE_AAAA) );
|
||||
unit_assert( (d=infra_lookup_host(slab, (struct sockaddr_storage*)&one,
|
||||
(socklen_t)sizeof(int), 0, now, &k)) );
|
||||
unit_assert( infra_lookup_lame(d, zone, zonelen, now,
|
||||
&dlame, &alame, &olame) );
|
||||
unit_assert(!dlame && alame && olame);
|
||||
lock_rw_unlock(&k->entry.lock);
|
||||
|
||||
infra_delete(slab);
|
||||
|
|
|
|||
Loading…
Reference in a new issue