From 73fb7fe5499f3bc9ac4a54c653012cb934f8a45f Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Wed, 24 Oct 2018 17:08:43 +0100 Subject: [PATCH] ECC-767: Added test --- tests/grib_dump_json.sh | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/tests/grib_dump_json.sh b/tests/grib_dump_json.sh index 2579e5164..8d2250ce0 100755 --- a/tests/grib_dump_json.sh +++ b/tests/grib_dump_json.sh @@ -10,6 +10,9 @@ . ./include.sh +label="grib_dump_json" +temp=${label}".temp.json" + REDIRECT=/dev/null if [ $HAVE_MEMFS -eq 1 ]; then @@ -72,7 +75,24 @@ v.grib2 " for file in $files; do - if [ -f ${data_dir}/$file ]; then - ${tools_dir}/grib_dump -j ${data_dir}/$file 2> $REDIRECT > $REDIRECT - fi + if [ -f ${data_dir}/$file ]; then + ${tools_dir}/grib_dump -j ${data_dir}/$file 2> $REDIRECT > $REDIRECT + fi done + +# Decide if we have the JSON verifier commandline utility +JSON_VERIF="json_xs" +JSON_CHECK="" +if command -v $JSON_VERIF >/dev/null 2>&1; then + JSON_CHECK=$JSON_VERIF +fi + +# Check the JSON output on single-message and multi-message files +if test "x$JSON_CHECK" != "x"; then + ${tools_dir}/grib_dump -j ${data_dir}/sample.grib2 > $temp + json_xs < $temp >$REDIRECT 2> $REDIRECT + ${tools_dir}/grib_dump -j ${data_dir}/tigge_af_ecmwf.grib2 > $temp + json_xs < $temp >$REDIRECT 2> $REDIRECT +fi + +rm -f $temp