From 45dd0378d4b3bf33a56a6e6cc6028b3e67d1778a Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Sat, 23 Dec 2023 18:23:42 +0000 Subject: [PATCH] Tools: Test metar_filter --- tests/CMakeLists.txt | 1 + tests/gts_ls.sh | 10 +++++++++- tests/metar_filter.sh | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100755 tests/metar_filter.sh diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0db9fa8af..426ed02e2 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -255,6 +255,7 @@ if( HAVE_BUILD_TOOLS ) taf pseudo_diag metar_ls + metar_filter metar_get metar_dump metar_compare diff --git a/tests/gts_ls.sh b/tests/gts_ls.sh index ca6fbf29e..ce6683ea1 100755 --- a/tests/gts_ls.sh +++ b/tests/gts_ls.sh @@ -52,10 +52,18 @@ echo 'print "[theMessage]";' | ${tools_dir}/gts_filter - $gts_file ${tools_dir}/gts_ls -wcount=1 -p theMessage $f - gts_file=${data_dir}/gts.grib result=$( ${tools_dir}/grib_ls -wcount=1 -p gts_CCCC -g $gts_file ) +# Bad filter +set +e +${tools_dir}/gts_filter a_non_existent_filter_file $gts_file > $fLog 2>&1 +status=$? +set -e +[ $status -ne 0 ] +grep -q "Cannot include file" $fLog + + # Clean up rm -f $fLog $res_ls diff --git a/tests/metar_filter.sh b/tests/metar_filter.sh new file mode 100755 index 000000000..9699b1ec8 --- /dev/null +++ b/tests/metar_filter.sh @@ -0,0 +1,38 @@ +#!/bin/sh +# (C) Copyright 2005- ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# + +. ./include.ctest.sh + +label="metar_filter_test" + +tempFilt="temp.$label.filt" +tempMetar="temp.$label.metar" +tempOut="temp.$label.txt" +tempRef="temp.$label.ref" + +input=${data_dir}/metar/metar.txt + +cat > $tempFilt < $tempOut 2>&1 +status=$? +set -e +[ $status -ne 0 ] +grep -q "Cannot include file" $tempOut + + +# Clean up +rm -f $tempMetar $tempFilt $tempOut $tempRef