From: Evan Hunt Date: Fri, 1 Apr 2022 16:51:37 +0000 (-0700) Subject: fix resolver test when built without --enable-querytrace X-Git-Tag: v9.19.0~30^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5319d8adea7be8daefc22bda3cca1164d0f2adf1;p=thirdparty%2Fbind9.git fix resolver test when built without --enable-querytrace a test case in the 'resolver' system test was reliant on logged output that would only be present when query tracing was enabled, as in developer builds. that test case is now disabled when query tracing is not available. Thanks to Anton Castelli. --- diff --git a/bin/tests/system/feature-test.c b/bin/tests/system/feature-test.c index b7f5fbf81df..30e6e14575e 100644 --- a/bin/tests/system/feature-test.c +++ b/bin/tests/system/feature-test.c @@ -37,6 +37,7 @@ usage(void) { fprintf(stderr, "\t--edns-version\n"); fprintf(stderr, "\t--enable-dnsrps\n"); fprintf(stderr, "\t--enable-dnstap\n"); + fprintf(stderr, "\t--enable-querytrace\n"); fprintf(stderr, "\t--gethostname\n"); fprintf(stderr, "\t--gssapi\n"); fprintf(stderr, "\t--have-geoip2\n"); @@ -81,6 +82,14 @@ main(int argc, char **argv) { #endif /* ifdef HAVE_DNSTAP */ } + if (strcmp(argv[1], "--enable-querytrace") == 0) { +#ifdef WANT_QUERYTRACE + return (0); +#else /* ifdef WANT_QUERYTRACE */ + return (1); +#endif /* ifdef WANT_QUERYTRACE */ + } + if (strcmp(argv[1], "--gethostname") == 0) { char hostname[MAXHOSTNAMELEN]; int n; diff --git a/bin/tests/system/resolver/tests.sh b/bin/tests/system/resolver/tests.sh index db3c8777e16..0d649784383 100755 --- a/bin/tests/system/resolver/tests.sh +++ b/bin/tests/system/resolver/tests.sh @@ -832,25 +832,27 @@ grep "1\.2\.3\.4" dig.ns5.out.${n} > /dev/null && ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) -n=$((n+1)) -echo_i "check that SERVFAIL is returned for an empty question section via TCP ($n)" -ret=0 -nextpart ns5/named.run > /dev/null -# bind to local address so that addresses in log messages are consistent -# between platforms -dig_with_opts @10.53.0.5 -b 10.53.0.5 tcpalso.no-questions. a +tries=2 +timeout=15 > dig.ns5.out.${n} || ret=1 -grep "status: SERVFAIL" dig.ns5.out.${n} > /dev/null || ret=1 -check_namedrun() { -nextpartpeek ns5/named.run > nextpart.out.${n} -grep 'resolving tcpalso.no-questions/A for [^:]*: empty question section, accepting it anyway as TC=1' nextpart.out.${n} > /dev/null || return 1 -grep '(tcpalso.no-questions/A): connecting via TCP' nextpart.out.${n} > /dev/null || return 1 -grep 'resolving tcpalso.no-questions/A for [^:]*: empty question section$' nextpart.out.${n} > /dev/null || return 1 -grep '(tcpalso.no-questions/A): nextitem' nextpart.out.${n} > /dev/null || return 1 -return 0 -} -retry_quiet 12 check_namedrun || ret=1 -if [ $ret != 0 ]; then echo_i "failed"; fi -status=$((status + ret)) +if ${FEATURETEST} --enable-querytrace; then + n=$((n+1)) + echo_i "check that SERVFAIL is returned for an empty question section via TCP ($n)" + ret=0 + nextpart ns5/named.run > /dev/null + # bind to local address so that addresses in log messages are consistent + # between platforms + dig_with_opts @10.53.0.5 -b 10.53.0.5 tcpalso.no-questions. a +tries=2 +timeout=15 > dig.ns5.out.${n} || ret=1 + grep "status: SERVFAIL" dig.ns5.out.${n} > /dev/null || ret=1 + check_namedrun() { + nextpartpeek ns5/named.run > nextpart.out.${n} + grep 'resolving tcpalso.no-questions/A for [^:]*: empty question section, accepting it anyway as TC=1' nextpart.out.${n} > /dev/null || return 1 + grep '(tcpalso.no-questions/A): connecting via TCP' nextpart.out.${n} > /dev/null || return 1 + grep 'resolving tcpalso.no-questions/A for [^:]*: empty question section$' nextpart.out.${n} > /dev/null || return 1 + grep '(tcpalso.no-questions/A): nextitem' nextpart.out.${n} > /dev/null || return 1 + return 0 + } + retry_quiet 12 check_namedrun || ret=1 + if [ $ret != 0 ]; then echo_i "failed"; fi + status=$((status + ret)) +fi n=$((n+1)) echo_i "checking SERVFAIL is returned when all authoritative servers return FORMERR ($n)"