mirror of https://github.com/ecmwf/eccodes.git
Testing: offset extraction
This commit is contained in:
parent
5031df4af9
commit
3b7adfe335
|
@ -11,31 +11,42 @@
|
||||||
. ./include.ctest.sh
|
. ./include.ctest.sh
|
||||||
|
|
||||||
# Define a common label for all the tmp files
|
# Define a common label for all the tmp files
|
||||||
label="bufr_extract_offsets_test"
|
label="extract_offsets_test"
|
||||||
temp1="temp.${label}.1"
|
temp1="temp.${label}.1"
|
||||||
temp2="temp.${label}.2"
|
temp2="temp.${label}.2"
|
||||||
|
tempLog="temp.${label}.log"
|
||||||
|
|
||||||
echo "Multi-message BUFR..."
|
echo "Multi-message BUFR..."
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
input=${data_dir}/bufr/aeolus_wmo_26.bufr
|
input=${data_dir}/bufr/aeolus_wmo_26.bufr
|
||||||
$EXEC ${test_dir}/extract_offsets $input > $temp1
|
$EXEC ${test_dir}/extract_offsets $input > $temp1
|
||||||
${tools_dir}/bufr_get -p offset:i $input > $temp2
|
${tools_dir}/bufr_get -p offset:i $input > $temp2
|
||||||
diff $temp1 $temp2
|
diff $temp1 $temp2
|
||||||
|
|
||||||
echo "Multi-message GRIB..."
|
echo "Multi-message GRIBs..."
|
||||||
# --------------------------
|
# --------------------------
|
||||||
input=${data_dir}/mixed.grib
|
inputs="${data_dir}/mixed.grib ${data_dir}/test.grib1 ${data_dir}/v.grib2"
|
||||||
$EXEC ${test_dir}/extract_offsets $input > $temp1
|
for input in $inputs; do
|
||||||
${tools_dir}/grib_get -p offset:i $input > $temp2
|
$EXEC ${test_dir}/extract_offsets $input > $temp1
|
||||||
diff $temp1 $temp2
|
${tools_dir}/grib_get -p offset:i $input > $temp2
|
||||||
|
diff $temp1 $temp2
|
||||||
|
done
|
||||||
|
|
||||||
echo "Test with invalid inputs..."
|
echo "Test with invalid inputs..."
|
||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
set +e
|
set +e
|
||||||
$EXEC ${test_dir}/extract_offsets ${data_dir}
|
$EXEC ${test_dir}/extract_offsets ${data_dir} > $tempLog 2>&1
|
||||||
status=$?
|
status=$?
|
||||||
set -e
|
set -e
|
||||||
[ $status -ne 0 ]
|
[ $status -ne 0 ]
|
||||||
|
grep -q "Input output problem" $tempLog
|
||||||
|
|
||||||
rm -f $temp1 $temp2
|
set +e
|
||||||
|
$EXEC ${test_dir}/extract_offsets ${data_dir}/bad.grib > $tempLog 2>&1
|
||||||
|
status=$?
|
||||||
|
set -e
|
||||||
|
[ $status -ne 0 ]
|
||||||
|
grep -q "Wrong message length" $tempLog
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
rm -f $temp1 $temp2 $tempLog
|
||||||
|
|
Loading…
Reference in New Issue