From: Ian Jackson Date: Sat, 24 May 2025 17:18:14 +0000 (+0100) Subject: adns: Add a test case and a Debian autopkgtest X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=e0f536725fb3d39efa7cb10bcb93344c1ec235e7;p=chiark-tcl.git adns: Add a test case and a Debian autopkgtest This includes testing IPv6 address lookups. Signed-off-by: Ian Jackson --- diff --git a/adns/runtest.tcl b/adns/runtest.tcl new file mode 100644 index 0000000..f7b1ca1 --- /dev/null +++ b/adns/runtest.tcl @@ -0,0 +1,34 @@ + +proc query {args} { + set q [concat adns synch $args] + puts "% $q" + set r [eval $q] + puts "=> $r" + return $r +} +proc query_ok {args} { + set r [eval query $args] + set outcome [lindex $r 0] + if {"$outcome" != "ok"} { error "outcome $outcome, not ok" } + return [lindex $r 6] +} + +# We could perhaps do this with a mocked nameserver but that seems +# like an excessive effort. +# +# Use mythic-beasts as a test case. +# They are very likely to have both A and AAAA RRsets for the foreseeable. + +query_ok a www.mythic-beasts.com +query_ok aaaa www.mythic-beasts.com + +set data [query_ok addr www.mythic-beasts.com] + +set got_type(INET) 0 +set got_type(INET6) 0 +foreach addr $data { + incr got_type([lindex $addr 0]) +} +foreach type [array names got_type] { + if {$got_type($type) == 0} { error $r "no $type" } +} diff --git a/debian/regenerate-autopkgtests b/debian/regenerate-autopkgtests index 8e63f57..14e6738 100755 --- a/debian/regenerate-autopkgtests +++ b/debian/regenerate-autopkgtests @@ -26,6 +26,9 @@ for sv in */debian-substvars; do echo >&4 "Tests: $t" sed "s/^shlibs:Depends=/Depends: tcl$v, /" >&4 $sv restrictions='' + case $d in + adns) restrictions+=' needs-internet'; + esac case $v in '') ;; ?*) restrictions+=' skip-not-installable'; diff --git a/debian/tests/control b/debian/tests/control index 849b1ee..b82317f 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -1,18 +1,18 @@ Tests: adns--def Depends: tcl, libadns1t64 (>= 1.5.0~), libc6 (>= 2.2.5), libtcl-chiark-1 (>= 1.3.5+b1) -Restrictions: +Restrictions: needs-internet Tests: adns--8.5 Depends: tcl8.5, libadns1t64 (>= 1.5.0~), libc6 (>= 2.2.5), libtcl-chiark-1 (>= 1.3.5+b1) -Restrictions: skip-not-installable +Restrictions: needs-internet skip-not-installable Tests: adns--8.6 Depends: tcl8.6, libadns1t64 (>= 1.5.0~), libc6 (>= 2.2.5), libtcl-chiark-1 (>= 1.3.5+b1) -Restrictions: skip-not-installable +Restrictions: needs-internet skip-not-installable Tests: adns--8.7 Depends: tcl8.7, libadns1t64 (>= 1.5.0~), libc6 (>= 2.2.5), libtcl-chiark-1 (>= 1.3.5+b1) -Restrictions: skip-not-installable +Restrictions: needs-internet skip-not-installable Tests: cdb--def Depends: tcl, libc6 (>= 2.33), libcdb1 (>= 0.76), libtcl-chiark-1 (>= 1.3.5+b1)