diff --git a/data/bufr/CMakeLists.txt b/data/bufr/CMakeLists.txt index 786cf27b5..ddeee3863 100644 --- a/data/bufr/CMakeLists.txt +++ b/data/bufr/CMakeLists.txt @@ -13,6 +13,7 @@ string(REGEX REPLACE "\n" ";" bufr_refs_to_download "${bufr_refs_to_download}") # Exceptional case: download bufr files which have to be treated specially list(APPEND bufr_files_to_download "vos308014_v3_26.bufr") # See test ecc-197 +list(APPEND bufr_files_to_download "bad.bufr") # See ECC-1938 if( ENABLE_EXTRA_TESTS ) ecbuild_get_test_multidata( diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index fa685fd44..87fa0c8d4 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -258,6 +258,7 @@ if( HAVE_BUILD_TOOLS ) bufr_ecc-1476 bufr_ecc-1623 bufr_ecc-1785 + bufr_ecc-1938 grib_ecc-490 grib_ecc-756 grib_ecc-806 diff --git a/tests/bufr_ecc-1938.sh b/tests/bufr_ecc-1938.sh new file mode 100755 index 000000000..1b7c98a70 --- /dev/null +++ b/tests/bufr_ecc-1938.sh @@ -0,0 +1,37 @@ +#!/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 + +REDIRECT=/dev/null + +label="bufr_ecc-1938_test" + +tempBufr=temp.$label.bufr +tempLog=temp.$label.log +tempOut=temp.$label.txt + +sample_bufr4=$ECCODES_SAMPLES_PATH/BUFR4.tmpl + +infile=${data_dir}/bufr/bad.bufr +if [ -f "$infile" ]; then + count=$( ${tools_dir}/bufr_count -f $infile ) + [ $count -eq 24 ] + set +e + ${tools_dir}/bufr_copy $infile $tempBufr + status=$? + set -e + [ $status -ne 0 ] + count=$( ${tools_dir}/bufr_count $tempBufr ) + [ $count -eq 24 ] +fi + +# Clean up +rm -f $tempBufr $tempLog $tempOut