From ed3f67b8371f374bc2cf2f7b42f03b944c55af9b Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Wed, 28 Oct 2015 21:05:27 -0700 Subject: [PATCH] [v9_10] fix statschannel with no libjson 4246. [test] Ensure the statschannel system test runs when BIND is not built with libjson. [RT #40944] (cherry picked from commit aa9b64060fb6e946a920e957805f564d149e88e0) --- CHANGES | 3 +++ bin/tests/system/conf.sh.in | 8 ++++++++ bin/tests/system/statschannel/tests.sh | 20 ++++++++++++++------ configure | 14 ++++++++++---- configure.in | 12 ++++++++---- 5 files changed, 43 insertions(+), 14 deletions(-) diff --git a/CHANGES b/CHANGES index 2344dc6a6e..a0ac34b106 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +4246. [test] Ensure the statschannel system test runs when BIND + is not built with libjson. [RT #40944] + 4245. [bug] Fix statistics version to match against in bind9.xsl. [RT #41039] diff --git a/bin/tests/system/conf.sh.in b/bin/tests/system/conf.sh.in index c31bde244f..fa3af16cb3 100644 --- a/bin/tests/system/conf.sh.in +++ b/bin/tests/system/conf.sh.in @@ -103,6 +103,14 @@ else TESTSOCK6=false fi +# +# Determine if we support various optional features. +# +CHECK_DSA=@CHECK_DSA@ +XMLSTATS=@XMLSTATS@ +JSONSTATS=@JSONSTATS@ +ZLIB=@ZLIB@ + . ${TOP}/version export NAMED LWRESD DIG NSUPDATE KEYGEN KEYFRLAB SIGNER KEYSIGNER KEYSETTOOL \ diff --git a/bin/tests/system/statschannel/tests.sh b/bin/tests/system/statschannel/tests.sh index 645df1c609..6950c17bec 100644 --- a/bin/tests/system/statschannel/tests.sh +++ b/bin/tests/system/statschannel/tests.sh @@ -19,7 +19,11 @@ SYSTEMTESTTOP=.. DIGCMD="$DIG @10.53.0.2 -p 5300" -if $PERL -e 'use JSON;' 2>/dev/null +if [ ! "$JSONSTATS" ] +then + unset PERL_JSON + echo "I:JSON was not configured; skipping" >&2 +elif $PERL -e 'use JSON;' 2>/dev/null then PERL_JSON=1 else @@ -27,7 +31,11 @@ else echo "I:JSON tests require JSON library; skipping" >&2 fi -if $PERL -e 'use XML::Simple;' 2>/dev/null +if [ ! "$XMLSTATS" ] +then + unset PERL_XML + echo "I:XML was not configured; skipping" >&2 +elif $PERL -e 'use XML::Simple;' 2>/dev/null then PERL_XML=1 else @@ -54,10 +62,10 @@ if [ $PERL_XML ]; then file=`$PERL fetch.pl xml/v3/server` mv $file xml.stats $PERL server-xml.pl > xml.fmtstats 2> /dev/null - xml_query_count=`awk '/opcode QUERY/ { print $NF }' xml.fmtstats` + xml_query_count=`awk '/opcode QUERY/ { print $NF }' xml.fmtstats` xml_query_count=${xml_query_count:-0} [ "$query_count" -eq "$xml_query_count" ] || ret=1 - xml_txt_count=`awk '/qtype TXT/ { print $NF }' xml.fmtstats` + xml_txt_count=`awk '/qtype TXT/ { print $NF }' xml.fmtstats` xml_txt_count=${xml_txt_count:-0} [ "$txt_count" -eq "$xml_txt_count" ] || ret=1 fi @@ -65,10 +73,10 @@ if [ $PERL_JSON ]; then file=`$PERL fetch.pl json/v1/server` mv $file json.stats $PERL server-json.pl > json.fmtstats 2> /dev/null - json_query_count=`awk '/opcode QUERY/ { print $NF }' json.fmtstats` + json_query_count=`awk '/opcode QUERY/ { print $NF }' json.fmtstats` json_query_count=${json_query_count:-0} [ "$query_count" -eq "$json_query_count" ] || ret=1 - json_txt_count=`awk '/qtype TXT/ { print $NF }' json.fmtstats` + json_txt_count=`awk '/qtype TXT/ { print $NF }' json.fmtstats` json_txt_count=${json_txt_count:-0} [ "$txt_count" -eq "$json_txt_count" ] || ret=1 fi diff --git a/configure b/configure index f82adf893a..26129c4ee2 100755 --- a/configure +++ b/configure @@ -807,6 +807,8 @@ IRIX_DNSSEC_WARNINGS_HACK MKDEPPROG MKDEPCFLAGS MKDEPCC +JSONSTATS +XMLSTATS PKCS11_TEST PKCS11_GOST PKCS11_ECDSA @@ -16591,11 +16593,13 @@ rm -f core conftest.err conftest.$ac_objext \ $as_echo "#define HAVE_LIBXML2 1" >>confdefs.h + XMLSTATS=1 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi + # # was --with-libjson specified? # @@ -16740,8 +16744,10 @@ $as_echo "#define HAVE_JSON 1" >>confdefs.h $as_echo "#define HAVE_JSON_C 1" >>confdefs.h fi + JSONSTATS=1 fi + # # In solaris 10, SMF can manage named service # @@ -24572,8 +24578,8 @@ if test "$enable_full_report" = "yes"; then test "X$CRYPTO" = "X" -o "$want_native_pkcs11" = "yes" || \ echo " OpenSSL cryptography/DNSSEC (--with-openssl)" test "X$PYTHON" = "X" || echo " Python tools (--with-python)" - test "X$libxml2_libs" = "X" || echo " XML statistics (--with-libxml2)" - test "X$have_libjson" = "X" || echo " JSON statistics (--with-libjson)" + test "X$XMLSTATS" = "X" || echo " XML statistics (--with-libxml2)" + test "X$JSONSTATS" = "X" || echo " JSON statistics (--with-libjson)" fi if test "$use_pkcs11" != "no"; then @@ -24663,8 +24669,8 @@ test "$use_libtool" = "yes" || echo " Use GNU libtool (--with-libtool)" test "$atf" = "no" && echo " Automated Testing Framework (--with-atf)" test "X$PYTHON" = "X" && echo " Python tools (--with-python)" -test "X$libxml2_libs" = "X" && echo " XML statistics (--with-libxml2)" -test "X$have_libjson" = "X" && echo " JSON statistics (--with-libjson)" +test "X$XMLSTATS" = "X" && echo " XML statistics (--with-libxml2)" +test "X$JSONSTATS" = "X" && echo " JSON statistics (--with-libjson)" if test "X$ac_unrecognized_opts" != "X"; then echo diff --git a/configure.in b/configure.in index 1ff5c1b164..e8307f6466 100644 --- a/configure.in +++ b/configure.in @@ -2143,9 +2143,11 @@ then AC_MSG_RESULT(yes), AC_MSG_ERROR(xml2-config returns badness)) AC_DEFINE(HAVE_LIBXML2, 1, [Define if libxml2 was found]) + XMLSTATS=1 else AC_MSG_RESULT(no) fi +AC_SUBST(XMLSTATS) # # was --with-libjson specified? @@ -2223,7 +2225,9 @@ then then AC_DEFINE(HAVE_JSON_C, 1, [Define if json-c was found]) fi + JSONSTATS=1 fi +AC_SUBST(JSONSTATS) # # In solaris 10, SMF can manage named service @@ -4841,8 +4845,8 @@ if test "$enable_full_report" = "yes"; then test "X$CRYPTO" = "X" -o "$want_native_pkcs11" = "yes" || \ echo " OpenSSL cryptography/DNSSEC (--with-openssl)" test "X$PYTHON" = "X" || echo " Python tools (--with-python)" - test "X$libxml2_libs" = "X" || echo " XML statistics (--with-libxml2)" - test "X$have_libjson" = "X" || echo " JSON statistics (--with-libjson)" + test "X$XMLSTATS" = "X" || echo " XML statistics (--with-libxml2)" + test "X$JSONSTATS" = "X" || echo " JSON statistics (--with-libjson)" fi if test "$use_pkcs11" != "no"; then @@ -4932,8 +4936,8 @@ test "$use_libtool" = "yes" || echo " Use GNU libtool (--with-libtool)" test "$atf" = "no" && echo " Automated Testing Framework (--with-atf)" test "X$PYTHON" = "X" && echo " Python tools (--with-python)" -test "X$libxml2_libs" = "X" && echo " XML statistics (--with-libxml2)" -test "X$have_libjson" = "X" && echo " JSON statistics (--with-libjson)" +test "X$XMLSTATS" = "X" && echo " XML statistics (--with-libxml2)" +test "X$JSONSTATS" = "X" && echo " JSON statistics (--with-libjson)" if test "X$ac_unrecognized_opts" != "X"; then echo