mirror of https://github.com/ecmwf/eccodes.git
Add bufr_compare test ECC-24
This commit is contained in:
parent
9ed0dccd97
commit
92df819d3e
|
@ -41,20 +41,18 @@ ${tools_dir}/bufr_compare $f $f >> $fLog
|
||||||
# Test: comparing two completely different files
|
# Test: comparing two completely different files
|
||||||
#----------------------------------------------------
|
#----------------------------------------------------
|
||||||
|
|
||||||
#TODO: enable this test when ECC-42 is fixed
|
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
|
|
||||||
f1="syno_1.bufr"
|
f1="syno_1.bufr"
|
||||||
f2="aaen_55.bufr"
|
f2="aaen_55.bufr"
|
||||||
echo "Test: comparing two completely different files" >> $fLog
|
echo "Test: comparing two completely different files" >> $fLog
|
||||||
echo "file: $f" >> $fLog
|
echo "file: $f" >> $fLog
|
||||||
#${tools_dir}/bufr_compare $f1 $f2 >> $fLog
|
${tools_dir}/bufr_compare $f1 $f2 >> $fLog
|
||||||
|
|
||||||
#if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
# echo "bufr_compare should have failed if files are completely different" >&2
|
echo "bufr_compare should have failed if files are completely different" >&2
|
||||||
# exit 1
|
exit 1
|
||||||
#fi
|
fi
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
@ -62,47 +60,41 @@ set -e
|
||||||
# Test: comparing with and witout the -b switch
|
# Test: comparing with and witout the -b switch
|
||||||
#----------------------------------------------------
|
#----------------------------------------------------
|
||||||
|
|
||||||
#TODO: enable this test when ECC-42 is fixed
|
|
||||||
|
|
||||||
f="syno_1.bufr"
|
f="syno_1.bufr"
|
||||||
echo "Test: comparing with and witout the -b switch" >> $fLog
|
echo "Test: comparing with and witout the -b switch" >> $fLog
|
||||||
echo "file: $f" >> $fLog
|
echo "file: $f" >> $fLog
|
||||||
|
|
||||||
#Alter a key in the file
|
#Alter a key in the file
|
||||||
${tools_dir}/bufr_set -s centre=222 $f ${fBufrTmp} >> $fLog
|
${tools_dir}/bufr_set -s dataCategory=2 $f ${fBufrTmp} >> $fLog
|
||||||
|
|
||||||
#TODO: enable this test when ECC-42 is fixed
|
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
#${tools_dir}/bufr_compare $f ${fBufrTmp}>> $fLog
|
${tools_dir}/bufr_compare $f ${fBufrTmp}>> $fLog
|
||||||
|
|
||||||
#if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
# echo "bufr_compare should have failed if files are different" >&2
|
echo "bufr_compare should have failed if files are different" >&2
|
||||||
# exit 1
|
exit 1
|
||||||
#fi
|
fi
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
#Now compare with -b switch. No difference should be found.
|
#Now compare with -b switch. No difference should be found.
|
||||||
${tools_dir}/bufr_compare -b centre $f ${fBufrTmp}>> $fLog
|
${tools_dir}/bufr_compare -b dataCategory $f ${fBufrTmp}>> $fLog
|
||||||
|
|
||||||
#----------------------------------------------------
|
#----------------------------------------------------
|
||||||
# Test: comparing with the -r switch
|
# Test: comparing with the -r switch
|
||||||
#----------------------------------------------------
|
#----------------------------------------------------
|
||||||
|
|
||||||
#TODO: enable this test when ECC-42 is fixed
|
|
||||||
|
|
||||||
#Create a bufr file with various message types
|
#Create a bufr file with various message types
|
||||||
cat syno_multi.bufr temp_101.bufr > $fBufrInput1
|
cat syno_multi.bufr temp_101.bufr > $fBufrInput1
|
||||||
cat temp_101.bufr syno_multi.bufr > $fBufrInput2
|
cat temp_101.bufr syno_multi.bufr > $fBufrInput2
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
#${tools_dir}/bufr_compare {fBufrInput1} ${fBufrInput2} >> $fLog
|
${tools_dir}/bufr_compare ${fBufrInput1} ${fBufrInput2} >> $fLog
|
||||||
|
|
||||||
#if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
# echo "bufr_compare should have failed if the message order in the files is different" >&2
|
echo "bufr_compare should have failed if the message order in the files is different" >&2
|
||||||
# exit 1
|
exit 1
|
||||||
#fi
|
fi
|
||||||
|
|
||||||
${tools_dir}/bufr_compare -r ${fBufrInput1} ${fBufrInput2}>> $fLog
|
${tools_dir}/bufr_compare -r ${fBufrInput1} ${fBufrInput2}>> $fLog
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ ${tools_dir}/bufr_get -p totalLength,centre,subCentre,masterTableNumber,masterTa
|
||||||
cat $fTmp | awk '{split($0,a," "); for (i=1; i<=8; i++) print a[i]}' > $res_get
|
cat $fTmp | awk '{split($0,a," "); for (i=1; i<=8; i++) print a[i]}' > $res_get
|
||||||
diff $ref_get $res_get >$REDIRECT 2> $REDIRECT
|
diff $ref_get $res_get >$REDIRECT 2> $REDIRECT
|
||||||
|
|
||||||
|
#Clean up
|
||||||
rm -f $fLog
|
rm -f $fLog
|
||||||
rm -f $fTmp | true
|
rm -f $fTmp | true
|
||||||
rm -f $res_get | true
|
rm -f $res_get | true
|
||||||
|
|
|
@ -92,6 +92,51 @@ echo "file: $f" >> $fLog
|
||||||
# [ $centre = "234.5" ]
|
# [ $centre = "234.5" ]
|
||||||
#done
|
#done
|
||||||
|
|
||||||
|
#-----------------------------------------------------------
|
||||||
|
# Test: with nonexistent keys.
|
||||||
|
#-----------------------------------------------------------
|
||||||
|
|
||||||
|
#Key "center" does not exist!!
|
||||||
|
|
||||||
|
# Invoke without -f i.e. should fail if error encountered
|
||||||
|
set +e
|
||||||
|
|
||||||
|
f="syno_1.bufr"
|
||||||
|
echo "Test: nonexistent keys" >> $fLog
|
||||||
|
echo "file: $f" >> $fLog
|
||||||
|
${tools_dir}/bufr_set -s center=98 $f $fBufrTmp 2>> $fLog 1>> $fLog
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "bufr_set should have failed if key not found" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Now repeat with -f option (do not exit on error)
|
||||||
|
${tools_dir}/bufr_set -f -s center=98 $f $fBufrTmp 2>>$fLog 1>>$fLog
|
||||||
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------
|
||||||
|
# Test: with not allowed key values
|
||||||
|
#-----------------------------------------------------------
|
||||||
|
|
||||||
|
#Here 1024 is out of range for centre (it is 8-bit only for edition=4 files)
|
||||||
|
|
||||||
|
# Invoke without -f i.e. should fail if error encountered
|
||||||
|
set +e
|
||||||
|
|
||||||
|
f="syno_1.bufr"
|
||||||
|
echo "Test: nonexistent keys" >> $fLog
|
||||||
|
echo "file: $f" >> $fLog
|
||||||
|
${tools_dir}/bufr_set -s centre=1024 $f $fBufrTmp 2>> $fLog 1>> $fLog
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "bufr_set should have failed if key not found" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Now repeat with -f option (do not exit on error)
|
||||||
|
${tools_dir}/bufr_set -f -s centre=1024 -f $f $fBufrTmp 2>>$fLog 1>>$fLog
|
||||||
|
|
||||||
|
|
||||||
#Clean up
|
#Clean up
|
||||||
rm -f $fLog
|
rm -f $fLog
|
||||||
|
|
Loading…
Reference in New Issue