Commit aa9b6406 authored by Evan Hunt's avatar Evan Hunt

[master] fix statschannel with no libjson

4246.	[test]		Ensure the statschannel system test runs when BIND
			is not built with libjson. [RT #40944]
parent eadee666
4246. [test] Ensure the statschannel system test runs when BIND
is not built with libjson. [RT #40944]
4245. [placeholder]
4244. [bug] The parser was not reporting that use-ixfr is obsolete.
......
......@@ -101,6 +101,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 \
......
......@@ -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
......@@ -143,10 +151,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
......@@ -154,10 +162,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
......@@ -165,13 +173,18 @@ if [ $ret != 0 ]; then echo "I: failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
ret=0
echo "I:checking consistency between regular and compressed output ($n)"
$CURL -D regular.headers \
http://10.53.0.2:8853/xml/v3/server 2>/dev/null | \
if [ "$XMLSTATS" ];
then
URL=http://10.53.0.2:8853/xml/v3/server
else
URL=http://10.53.0.2:8853/json/v1/server
fi
$CURL -D regular.headers $URL 2>/dev/null | \
sed -e "s#<current-time>.*</current-time>##g" > regular.out
$CURL -D compressed.headers --compressed \
http://10.53.0.2:8853/xml/v3/server 2>/dev/null | \
$CURL -D compressed.headers --compressed $URL 2>/dev/null | \
sed -e "s#<current-time>.*</current-time>##g" > compressed.out
diff regular.out compressed.out >/dev/null || ret=1
if [ $ret != 0 ]; then echo "I: failed"; fi
......@@ -180,14 +193,18 @@ n=`expr $n + 1`
ret=0
echo "I:checking if compressed output is really compressed ($n)"
REGSIZE=`cat regular.headers | \
if [ "$ZLIB" ];
then
REGSIZE=`cat regular.headers | \
grep -i Content-Length | sed -e "s/.*: \([0-9]*\).*/\1/"`
COMPSIZE=`cat compressed.headers | \
COMPSIZE=`cat compressed.headers | \
grep -i Content-Length | sed -e "s/.*: \([0-9]*\).*/\1/"`
if [ ! `expr $REGSIZE / $COMPSIZE` -gt 2 ]; then
if [ ! `expr $REGSIZE / $COMPSIZE` -gt 2 ]; then
ret=1
fi
else
echo "I:skipped"
fi
if [ $ret != 0 ]; then echo "I: failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
......
......@@ -814,6 +814,9 @@ IRIX_DNSSEC_WARNINGS_HACK
MKDEPPROG
MKDEPCFLAGS
MKDEPCC
ZLIB
JSONSTATS
XMLSTATS
PKCS11_TEST
PKCS11_GOST
PKCS11_ECDSA
......@@ -16547,11 +16550,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?
#
......@@ -16696,8 +16701,10 @@ $as_echo "#define HAVE_JSON 1" >>confdefs.h
$as_echo "#define HAVE_JSON_C 1" >>confdefs.h
fi
JSONSTATS=1
fi
#
# was --with-zlib specified?
#
......@@ -16814,15 +16821,18 @@ else
$as_echo "no" >&6; }
fi
ZLIB=
if test "X${have_zlib}" != "X"
then
CFLAGS="$CFLAGS $zlib_cflags"
$as_echo "#define HAVE_ZLIB 1" >>confdefs.h
ZLIB=1
fi
#
# In solaris 10, SMF can manage named service
#
......@@ -24915,9 +24925,9 @@ 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$have_zlib" = "X" || echo " HTTP zlib compression (--with-zlib)"
test "X$XMLSTATS" = "X" || echo " XML statistics (--with-libxml2)"
test "X$JSONSTATS" = "X" || echo " JSON statistics (--with-libjson)"
test "X$ZLIB" = "X" || echo " HTTP zlib compression (--with-zlib)"
fi
if test "$use_pkcs11" != "no"; then
......@@ -25006,8 +25016,9 @@ 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)"
test "X$ZLIB" = "X" && echo " HTTP zlib compression (--with-zlib)"
if test "X$ac_unrecognized_opts" != "X"; then
echo
......
......@@ -2097,9 +2097,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?
......@@ -2177,7 +2179,9 @@ then
then
AC_DEFINE(HAVE_JSON_C, 1, [Define if json-c was found])
fi
JSONSTATS=1
fi
AC_SUBST(JSONSTATS)
#
# was --with-zlib specified?
......@@ -2231,11 +2235,14 @@ else
AC_MSG_RESULT(no)
fi
ZLIB=
if test "X${have_zlib}" != "X"
then
CFLAGS="$CFLAGS $zlib_cflags"
AC_DEFINE(HAVE_ZLIB, 1, [Define if zlib was found])
ZLIB=1
fi
AC_SUBST(ZLIB)
#
......@@ -4913,9 +4920,9 @@ 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$have_zlib" = "X" || echo " HTTP zlib compression (--with-zlib)"
test "X$XMLSTATS" = "X" || echo " XML statistics (--with-libxml2)"
test "X$JSONSTATS" = "X" || echo " JSON statistics (--with-libjson)"
test "X$ZLIB" = "X" || echo " HTTP zlib compression (--with-zlib)"
fi
if test "$use_pkcs11" != "no"; then
......@@ -5004,8 +5011,9 @@ 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)"
test "X$ZLIB" = "X" && echo " HTTP zlib compression (--with-zlib)"
if test "X$ac_unrecognized_opts" != "X"; then
echo
......
......@@ -2056,7 +2056,7 @@
./bin/tests/system/statschannel/prereq.sh SH 2015
./bin/tests/system/statschannel/server-json.pl PERL 2015
./bin/tests/system/statschannel/server-xml.pl PERL 2015
./bin/tests/system/statschannel/tests.sh SH 2015
./bin/tests/system/statschannel/tests.sh.in SH 2015
./bin/tests/system/statschannel/traffic-json.pl PERL 2015
./bin/tests/system/statschannel/traffic-xml.pl PERL 2015
./bin/tests/system/statschannel/traffic.expect.1 X 2015
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment