Testing: Increase coverage

This commit is contained in:
Shahram Najm 2023-08-24 17:32:37 +01:00
parent 9b3056571b
commit 21a37f25f5
4 changed files with 61 additions and 5 deletions

View File

@ -98,6 +98,18 @@ ${tools_dir}/bufr_copy -s unpack=1 -w stormIdentifier=none $fBufrInput $fBufrTmp
[ ! -f "$fBufrTmp" ]
#-------------------------------------------------------------------
echo "Test: corner cases ..."
#-------------------------------------------------------------------
echo BUFR > $fBufrTmp
set +e
${tools_dir}/bufr_copy $fBufrTmp /dev/null > $fLog 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -w "unreadable message" $fLog
# Clean up
#-----------
rm -f $fLog $fBufrTmp

View File

@ -13,8 +13,8 @@
# Define a common label for all the tmp files
label="bufr_dump_data_test"
fLog=${label}".log"
fJsonTmp=${label}".json.tmp"
fLog=temp.$label.log
fJsonTmp=temp.$label.json
if [ $HAVE_MEMFS -eq 1 ]; then
unset ECCODES_DEFINITION_PATH
@ -58,6 +58,26 @@ grep -q "parsing include file" $fLog
unset ECCODES_DEBUG
unset ECCODES_LOG_STREAM
# This one should fail
file=${data_dir}/bufr/vos308014_v3_26.bufr
set +e
${tools_dir}/bufr_dump -ja $file
status=$?
set -e
[ $status -ne 0 ]
set +e
${tools_dir}/bufr_dump $file
status=$?
set -e
[ $status -ne 0 ]
set +e
${tools_dir}/bufr_dump -p $file
status=$?
set -e
[ $status -ne 0 ]
#==============================================
# Testing a malformed bufr file (see ECC-110)
#==============================================

View File

@ -64,6 +64,18 @@ ${tools_dir}/bufr_ls -s satelliteID=313 -p satelliteID aaen_55.bufr > $fTmp
grep -q "313" $fTmp
# ------------------------
# Test corner cases
# ------------------------
echo BUFR > $fTmp
set +e
${tools_dir}/bufr_ls $fTmp > $fLog 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -w "unreadable message" $fLog
# Clean up
rm -f $fLog $res_ls
rm -f $fTmp

View File

@ -15,7 +15,8 @@ cd ${data_dir}
# Define a common label for all the tmp files
label="grib_copy_test"
temp=${label}".grib.tmp"
temp=temp.$label.grib
fLog=temp.$label.log
echo "Test: The -g option..."
# -----------------------------------
@ -49,7 +50,7 @@ echo "Test: ECC-1086 invalid message ..."
# This file is 179 bytes long. We chop the last byte to create
# an invalid GRIB message (Final 7777 is 777)
input=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
badGrib=${label}".bad.grib"
badGrib=temp.$label.bad.grib
head -c 178 $input > $badGrib
set +e
${tools_dir}/grib_copy $badGrib /dev/null # Only the bad GRIB
@ -89,6 +90,17 @@ status=$?
set -e
[ $status -ne 0 ]
#-------------------------------------------------------------------
echo "Test: corner cases ..."
#-------------------------------------------------------------------
echo GRIB > $badGrib
set +e
${tools_dir}/grib_copy $badGrib /dev/null > $fLog 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -w "unreadable message" $fLog
#${tools_dir}/grib_copy -w count=1 -X 57143 $input $temp #Last msg
#r1=`${tools_dir}/grib_get -w count=37 -n ls $input`
@ -107,4 +119,4 @@ set -e
# Clean up
#-----------
rm -f $temp $badGrib $combinedGrib
rm -f $temp $badGrib $combinedGrib $fLog