diff --git a/tests/bufr_copy.sh b/tests/bufr_copy.sh index e2dcffcbc..eb3b877fb 100755 --- a/tests/bufr_copy.sh +++ b/tests/bufr_copy.sh @@ -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 diff --git a/tests/bufr_dump_data.sh b/tests/bufr_dump_data.sh index 1eacbb1f8..4f8594755 100755 --- a/tests/bufr_dump_data.sh +++ b/tests/bufr_dump_data.sh @@ -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) #============================================== diff --git a/tests/bufr_ls.sh b/tests/bufr_ls.sh index 2d8e2d157..2879ed36f 100755 --- a/tests/bufr_ls.sh +++ b/tests/bufr_ls.sh @@ -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 diff --git a/tests/grib_copy.sh b/tests/grib_copy.sh index c66fcef61..09b0c50f1 100755 --- a/tests/grib_copy.sh +++ b/tests/grib_copy.sh @@ -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