From: Wouter Wijngaards Date: Wed, 25 Jun 2008 09:56:22 +0000 (+0000) Subject: fixup unit test for lameness changes. X-Git-Tag: release-1.0.1~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78a3c4e93d34aab84428be63e3afe32ec8d4a8bb;p=thirdparty%2Funbound.git fixup unit test for lameness changes. git-svn-id: file:///svn/unbound/trunk@1138 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/doc/Changelog b/doc/Changelog index 93120d731..cd14132c1 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -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. diff --git a/testcode/unitmain.c b/testcode/unitmain.c index f109ad5e9..769db39ab 100644 --- a/testcode/unitmain.c +++ b/testcode/unitmain.c @@ -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);