From: Sebastien GODARD Date: Sun, 14 Oct 2018 08:30:19 +0000 (+0200) Subject: Improve non regression test for JSON output X-Git-Tag: v12.1.2~31^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1578f2890461159ab631b465c85f6ebf98e9611a;p=sysstat Improve non regression test for JSON output Look for two possible commands to test JSON output: json_verify and json_pp. Also make sure that one of them exists to run the non regression test. Signed-off-by: Sebastien GODARD --- diff --git a/.gitignore b/.gitignore index 918cc4c..4c7fe50 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,4 @@ core TAGS nls/*.gmo tests/*.tmp +tests/0230 diff --git a/Makefile.in b/Makefile.in index 333f6e2..eedb7e1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -600,6 +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 man/cifsiostat.1 rm -f *.log config.status rm -rf autom4te.cache diff --git a/configure b/configure index 8517831..b8077fe 100755 --- a/configure +++ b/configure @@ -672,6 +672,7 @@ PATH_CP INSTALL_BIN INSTALL_DATA ZIP +VER_JSON MSGMERGE XGETTEXT MSGFMT @@ -3783,6 +3784,49 @@ $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. +set dummy $ac_prog; 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_JSON+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$VER_JSON"; then + ac_cv_prog_VER_JSON="$VER_JSON" # 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_JSON="$ac_prog" + $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_JSON=$ac_cv_prog_VER_JSON +if test -n "$VER_JSON"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $VER_JSON" >&5 +$as_echo "$VER_JSON" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$VER_JSON" && break +done +test -n "$VER_JSON" || VER_JSON="true" + for ac_prog in xz bzip2 gzip do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -3831,6 +3875,8 @@ INSTALL_DATA="\${INSTALL} -m 644" 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 @@ -5414,6 +5460,8 @@ ac_config_files="$ac_config_files man/iostat.1:man/iostat.in" # File must be renamed 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 Makefile" @@ -6146,6 +6194,7 @@ do "man/sysstat.5") CONFIG_FILES="$CONFIG_FILES man/sysstat.5:man/sysstat.in" ;; "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" ;; "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 3b64f75..acf869e 100644 --- a/configure.in +++ b/configure.in @@ -30,12 +30,15 @@ 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_PROGS(VER_JSON, json_verify json_pp, true) AC_CHECK_PROGS(ZIP, xz bzip2 gzip, gzip) INSTALL_DATA="\${INSTALL} -m 644" AC_SUBST(INSTALL_DATA) INSTALL_BIN="\${INSTALL} -m 755" AC_SUBST(INSTALL_BIN) +AC_SUBST(VER_JSON) + AC_PATH_PROG(PATH_CP, cp) AC_PATH_PROG(PATH_CHKCONFIG, chkconfig) @@ -598,6 +601,7 @@ AC_CONFIG_FILES([man/sar.1:man/sar.in]) # File must be renamed 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_OUTPUT(Makefile) diff --git a/tests/0230 b/tests/0230 deleted file mode 100644 index 38f406c..0000000 --- a/tests/0230 +++ /dev/null @@ -1 +0,0 @@ -./sadf -j tests/data.tmp -C -- -A | json_pp >/dev/null diff --git a/tests/0230.in b/tests/0230.in new file mode 100644 index 0000000..a43e9f5 --- /dev/null +++ b/tests/0230.in @@ -0,0 +1,4 @@ +VER_JSON=@VER_JSON@ +if [ ! -z "$VER_JSON" ]; then + ./sadf -j tests/data.tmp -C -- -A | $VER_JSON >/dev/null; +fi