From: Sebastien GODARD Date: Sun, 14 Oct 2018 15:02:28 +0000 (+0200) Subject: Add new non regression tests for XML output X-Git-Tag: v12.1.2~30 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cfceb47d55dcb6f1292a40838c62af668f2b5dc0;p=sysstat Add new non regression tests for XML output Add two new non regression tests that check the XML output of sadf -x against DTD and XSD documents. The tests are run only if the xmllint command exists. Signed-off-by: Sebastien GODARD --- diff --git a/.gitignore b/.gitignore index 4c7fe50..bb38ce7 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,5 @@ TAGS nls/*.gmo tests/*.tmp tests/0230 +tests/0240 +tests/0250 diff --git a/Makefile.in b/Makefile.in index eedb7e1..564fa9e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -600,7 +600,7 @@ almost-distclean: clean nls/sysstat.pot rm -f cron/sysstat-collect.service cron/sysstat-collect.timer cron/sysstat-summary.service cron/sysstat-summary.timer rm -f cron/sysstat.cron.hourly cron/sysstat.crond.sample cron/sysstat.crond.sample.in rm -f man/sa1.8 man/sa2.8 man/sadc.8 man/sadf.1 man/sar.1 man/iostat.1 man/sysstat.5 - rm -f tests/0230 + rm -f tests/0230 tests/0240 tests/0250 rm -f man/cifsiostat.1 rm -f *.log config.status rm -rf autom4te.cache diff --git a/configure b/configure index b8077fe..9a5424c 100755 --- a/configure +++ b/configure @@ -673,6 +673,7 @@ INSTALL_BIN INSTALL_DATA ZIP VER_JSON +VER_XML MSGMERGE XGETTEXT MSGFMT @@ -3784,6 +3785,43 @@ $as_echo "no" >&6; } fi +# Extract the first word of "xmllint", so it can be a program name with args. +set dummy xmllint; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_VER_XML+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$VER_XML"; then + ac_cv_prog_VER_XML="$VER_XML" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_VER_XML="xmllint" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +VER_XML=$ac_cv_prog_VER_XML +if test -n "$VER_XML"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $VER_XML" >&5 +$as_echo "$VER_XML" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + for ac_prog in json_verify json_pp do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -3877,6 +3915,7 @@ INSTALL_BIN="\${INSTALL} -m 755" + # Extract the first word of "cp", so it can be a program name with args. set dummy cp; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -5462,6 +5501,10 @@ ac_config_files="$ac_config_files man/cifsiostat.1:man/cifsiostat.in" # File must be renamed ac_config_files="$ac_config_files tests/0230" +ac_config_files="$ac_config_files tests/0240" + +ac_config_files="$ac_config_files tests/0250" + ac_config_files="$ac_config_files Makefile" @@ -6195,6 +6238,8 @@ do "man/iostat.1") CONFIG_FILES="$CONFIG_FILES man/iostat.1:man/iostat.in" ;; "man/cifsiostat.1") CONFIG_FILES="$CONFIG_FILES man/cifsiostat.1:man/cifsiostat.in" ;; "tests/0230") CONFIG_FILES="$CONFIG_FILES tests/0230" ;; + "tests/0240") CONFIG_FILES="$CONFIG_FILES tests/0240" ;; + "tests/0250") CONFIG_FILES="$CONFIG_FILES tests/0250" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; diff --git a/configure.in b/configure.in index acf869e..bff63fd 100644 --- a/configure.in +++ b/configure.in @@ -30,6 +30,7 @@ AC_CHECK_PROG(INSTALL, install, install) AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt) AC_CHECK_PROG(XGETTEXT, xgettext, xgettext) AC_CHECK_PROG(MSGMERGE, msgmerge, msgmerge) +AC_CHECK_PROG(VER_XML, xmllint, xmllint) AC_CHECK_PROGS(VER_JSON, json_verify json_pp, true) AC_CHECK_PROGS(ZIP, xz bzip2 gzip, gzip) INSTALL_DATA="\${INSTALL} -m 644" @@ -38,6 +39,7 @@ INSTALL_BIN="\${INSTALL} -m 755" AC_SUBST(INSTALL_BIN) AC_SUBST(VER_JSON) +AC_SUBST(VER_XML) AC_PATH_PROG(PATH_CP, cp) AC_PATH_PROG(PATH_CHKCONFIG, chkconfig) @@ -602,6 +604,8 @@ AC_CONFIG_FILES([man/sysstat.5:man/sysstat.in]) # File must be renamed AC_CONFIG_FILES([man/iostat.1:man/iostat.in]) # File must be renamed AC_CONFIG_FILES([man/cifsiostat.1:man/cifsiostat.in]) # File must be renamed AC_CONFIG_FILES([tests/0230]) +AC_CONFIG_FILES([tests/0240]) +AC_CONFIG_FILES([tests/0250]) AC_OUTPUT(Makefile) diff --git a/tests/0240.in b/tests/0240.in new file mode 100644 index 0000000..52915d3 --- /dev/null +++ b/tests/0240.in @@ -0,0 +1,4 @@ +VER_XML=@VER_XML@ +if [ ! -z "$VER_XML" ]; then + ./sadf -x tests/data.tmp -C -- -A | $VER_XML --schema xml/sysstat.xsd - >/dev/null; +fi diff --git a/tests/0250.in b/tests/0250.in new file mode 100644 index 0000000..e028cb2 --- /dev/null +++ b/tests/0250.in @@ -0,0 +1,4 @@ +VER_XML=@VER_XML@ +if [ ! -z "$VER_XML" ]; then + ./sadf -x tests/data.tmp -C -- -A | $VER_XML --dtdvalid xml/sysstat-*.dtd - >/dev/null; +fi