BUFR: added test for bufr_ls ECC-24

This commit is contained in:
Sandor Kertesz 2015-01-22 09:25:57 +00:00
parent e776f90afd
commit ab30ce734f
3 changed files with 62 additions and 0 deletions

View File

@ -401,6 +401,8 @@ set(bufr_refs_to_download
tmr7_129.bufr.desc.ref tmr7_129.bufr.desc.ref
tros_31.bufr.desc.ref tros_31.bufr.desc.ref
wavb_134.bufr.desc.ref wavb_134.bufr.desc.ref
aaen_55.bufr.ls.ref
) )
foreach( f ${bufr_files_to_download} ${bufr_refs_to_download} ) foreach( f ${bufr_files_to_download} ${bufr_refs_to_download} )

View File

@ -13,6 +13,7 @@ list( APPEND test_bins
read_index read_index
unit_tests unit_tests
gauss_sub gauss_sub
bufr_read_header
) )
foreach( tool ${test_bins} ) foreach( tool ${test_bins} )
@ -33,6 +34,8 @@ list( APPEND tests
bufrdc_desc_ref bufrdc_desc_ref
bufrdc_ref bufrdc_ref
bufr_json bufr_json
bufr_ls
bufr_read_header
ieee ieee
grib1to2 grib1to2
grib2to1 grib2to1

57
tests/bufr_ls.sh Executable file
View File

@ -0,0 +1,57 @@
#!/bin/sh
# Copyright 2005-2015 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
#
. ./include.sh
set -x
#Remember work dir
dWork=`pwd`
#Enter data dir
cd ${data_dir}/bufr
fLog="log"
rm -f $fLog | true
fTmp="tmp.txt"
rm -f $fTmp | true
#Create log filemore lev
touch $fLog
#----------------------------------------------
# Test default "ls" on all the bufr data files
#----------------------------------------------
for f in `ls *.bufr` ; do
echo $f >> log
${tools_dir}/bufr_ls $f >> $fLog
done
#-------------------------------------------
# Test "-p" switch
#-------------------------------------------
f="aaen_55.bufr"
ref_ls=$f".ls.ref"
res_ls=$f".ls.test"
REDIRECT=/dev/null
${tools_dir}/bufr_ls -p totalLength,centre,subCentre,masterTableNumber,masterTablesVersionNumber,localTablesVersionNumber,numberOfSubsets,numberOfObservations $f 2> $REDIRECT > $fTmp
#Write the values into a file and compare to ref
awk NR==3 $fTmp | awk '{split($0,a," "); for (i=1; i<=8; i++) print a[i]}' > $res_ls
diff $ref_ls $res_ls >$REDIRECT 2> $REDIRECT
[ $? -eq 0 ]
#Go back to workdir
cd $dWork