Create a test for BUFR bad data ECC-110

This commit is contained in:
Sandor Kertesz 2015-05-06 16:34:03 +01:00
parent 473a2fec20
commit 35d14705ab
3 changed files with 37 additions and 0 deletions

View File

@ -35,6 +35,7 @@ b005_87.bufr
b005_89.bufr
b006_96.bufr
b007_31.bufr
bad.bufr
bssh_170.bufr
bssh_176.bufr
bssh_178.bufr

View File

@ -269,3 +269,4 @@ synop_multi_subset.bufr.desc.ref
aaen_55.bufr.ls.ref
syno_multi.bufr.header.ref
syno_multi.bufr
bad.bufr.json.ref

View File

@ -10,6 +10,21 @@
. ./include.sh
#Define a common label for all the tmp files
label="bufr_dump_test"
#Create log file
fLog=${label}".log"
rm -f $fLog | true
touch $fLog
#Define tmp bufr files
fJsonTmp=${label}".json.tmp"
#==============================================
# Testing bufr_dump -O
#==============================================
bufr_files=`cat ${data_dir}/bufr/bufr_data_files.txt`
REDIRECT=/dev/null
@ -17,3 +32,23 @@ for file in ${bufr_files}
do
${tools_dir}bufr_dump -O ${data_dir}/bufr/$file 2> $REDIRECT > $REDIRECT
done
#==============================================
# Testing a malformed bufr file (see ECC-110)
#==============================================
echo "Test: malformed bufr file " >> $fLog
rm -f $fJsonTmp | true
fBufr=${data_dir}/bufr/"bad.bufr"
fJsonRef=${data_dir}/bufr/"bad.bufr.json.ref"
${tools_dir}bufr_dump -js $fBufr > $fJsonTmp
diff $fJsonTmp $fJsonRef >$REDIRECT 2> $REDIRECT
#Clean up
rm -f $fLog
rm -f $fJsonTmp | true