]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
fixup unit test for lameness changes.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 25 Jun 2008 09:56:22 +0000 (09:56 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 25 Jun 2008 09:56:22 +0000 (09:56 +0000)
git-svn-id: file:///svn/unbound/trunk@1138 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
testcode/unitmain.c

index 93120d731a97ca119fcd8f7f772418868ea0f6b9..cd14132c105be4b0d087cb393ade4166f46a20ef 100644 (file)
@@ -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.
index f109ad5e94f21e166fc9618f4fc27c091a0b515f..769db39abb1abd840811c3dfa77ea496063b65ba 100644 (file)
@@ -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);