Testing: Error conditions

This commit is contained in:
Shahram Najm 2024-01-03 16:31:07 +00:00
parent 7e9a6b4078
commit 4ac5774626
2 changed files with 40 additions and 0 deletions

View File

@ -50,6 +50,36 @@ set -e
grep -q "Key Nj cannot be 0" $tempText
set +e
${tools_dir}/grib_get -l 0,0,5 $ECCODES_SAMPLES_PATH/reduced_ll_sfc_grib1.tmpl > $tempText 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "Wrong mode given" $tempText
set +e
${tools_dir}/grib_get -l 0,0,1,nonexistingmask $ECCODES_SAMPLES_PATH/reduced_ll_sfc_grib1.tmpl > $tempText 2>&1
status=$?
set -e
[ $status -ne 0 ]
cat $tempText
grep -q "unable to open mask file" $tempText
# ------------------------
# Unreadable message
# ------------------------
outfile=temp.$label.out
echo GRIB > $outfile
set +e
${tools_dir}/grib_get -p edition $outfile /dev/null > $tempText 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "unreadable message" $tempText
rm -f $outfile
# Clean up
rm -f $tempText

View File

@ -225,6 +225,8 @@ grib_check_key_equals $file 'expver:s' '0001'
${tools_dir}/grib_ls -j -l0,0 -p referenceValue:d $data_dir/sample.grib2
${tools_dir}/grib_ls -j -l0,0 -p referenceValue:i $data_dir/sample.grib2
${tools_dir}/grib_get -l0,0,4 $data_dir/sample.grib2
set +e
${tools_dir}/grib_ls -l0,0,666 $data_dir/sample.grib2 > $tempText 2>&1
status=$?
@ -233,5 +235,13 @@ set -e
grep -q "Wrong mode given" $tempText
set +e
${tools_dir}/grib_ls -l0,0,1,nonexistingmask $data_dir/sample.grib2 > $tempText 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "unable to open mask file" $tempText
# Clean up
rm -f $temp1 $temp2 $tempText $tempLog