diff --git a/examples/C/bufr_set_keys.sh b/examples/C/bufr_set_keys.sh index 96fd48416..3131463cf 100755 --- a/examples/C/bufr_set_keys.sh +++ b/examples/C/bufr_set_keys.sh @@ -10,37 +10,33 @@ . ./include.ctest.sh - -#Define a common label for all the tmp files +# Define a common label for all the tmp files label="bufr_set_keys_test_c" - -#Define tmp file +REDIRECT=/dev/null fBufrTmp=${label}.tmp.bufr rm -f $fBufrTmp -#We check "syno_multi.bufr". The path is -#hardcoded in the example +# We check "syno_multi.bufr". The path is hard coded in the example f=${data_dir}/bufr/syno_multi.bufr -REDIRECT=/dev/null +set +e +${examples_dir}/c_bufr_set_keys +status=$? +set -e +[ $status -ne 0 ] -# +# Run ${examples_dir}/c_bufr_set_keys $fBufrTmp 2> $REDIRECT > $REDIRECT -#Compare modified to the original +# Compare modified to the original set +e ${tools_dir}/bufr_compare $f $fBufrTmp >$REDIRECT 2> $REDIRECT - -#Check if modified is different -if [ $? -eq 0 ]; then - echo "setting keys produced identical files " >&2 - exit 1 -fi - +status=$? set -e +[ $status -ne 0 ] -#Check if modified has the same number of messages +# Check if modified has the same number of messages [ `${tools_dir}/bufr_count $f` -eq `${tools_dir}/bufr_count ${fBufrTmp}` ] -#Clean up +# Clean up rm -f $fBufrTmp diff --git a/examples/C/get_product_kind.sh b/examples/C/get_product_kind.sh index cd6ff1c5b..609274efc 100755 --- a/examples/C/get_product_kind.sh +++ b/examples/C/get_product_kind.sh @@ -15,6 +15,12 @@ fTmp=${label}.tmp fOut=${label}.tmp.out fRef=${label}.tmp.ref +set +e +${examples_dir}/c_get_product_kind +status=$? +set -e +[ $status -eq 1 ] + # Create a file containing one GRIB and three BUFR messages cat ${data_dir}/sample.grib2 ${data_dir}/bufr/syno_multi.bufr >$fTmp diff --git a/examples/C/grib_nearest_multiple.sh b/examples/C/grib_nearest_multiple.sh index d203cfe06..ee43c5881 100755 --- a/examples/C/grib_nearest_multiple.sh +++ b/examples/C/grib_nearest_multiple.sh @@ -15,6 +15,12 @@ temp1=$label.temp1.$$ temp2=$label.temp2.$$ tempRef=$label.ref.$$ +set +e +${examples_dir}/c_grib_nearest_multiple 2>/dev/null +status=$? +set -e +[ $status -eq 1 ] + cat > $temp1 <$tempFilt < $tempOut +grep -q "Ni defined: true" $tempOut + + +cat >$tempFilt < $tempOut +grep -q "N defined: false" $tempOut + +cat >$tempFilt < $tempOut +grep -q "No args: false" $tempOut + # Clean up rm -f $tempGrib $tempFilt $tempOut $tempRef diff --git a/tests/grib_step.sh b/tests/grib_step.sh index e3f90142b..2b1ca37b6 100755 --- a/tests/grib_step.sh +++ b/tests/grib_step.sh @@ -155,7 +155,14 @@ ${tools_dir}/grib_set -s julianDay=2454504 $input $temp grib_check_key_equals $input day 6 grib_check_key_equals $temp day 7 +# Seconds (ignored) +# ----------------------------------------------- +grib2_sample=$ECCODES_SAMPLES_PATH/GRIB2.tmpl +${tools_dir}/grib_ls -s second=9 -n time $grib2_sample 2>$templog +# Something should have been written to stderr +[ -s $templog ] +grep -q "Truncating time: non-zero seconds.* ignored" $templog # Clean up -rm -f $temp +rm -f $temp $templog rm -f $grib2File.p8tmp ${grib2File}.tmp x.grib