diff --git a/data/bufr/CMakeLists.txt b/data/bufr/CMakeLists.txt index 0c9b077d1..5ea004b1e 100644 --- a/data/bufr/CMakeLists.txt +++ b/data/bufr/CMakeLists.txt @@ -401,6 +401,8 @@ set(bufr_refs_to_download tmr7_129.bufr.desc.ref tros_31.bufr.desc.ref wavb_134.bufr.desc.ref + + aaen_55.bufr.ls.ref ) foreach( f ${bufr_files_to_download} ${bufr_refs_to_download} ) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a1df940fd..b0f987332 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -13,6 +13,7 @@ list( APPEND test_bins read_index unit_tests gauss_sub + bufr_read_header ) foreach( tool ${test_bins} ) @@ -33,6 +34,8 @@ list( APPEND tests bufrdc_desc_ref bufrdc_ref bufr_json + bufr_ls + bufr_read_header ieee grib1to2 grib2to1 diff --git a/tests/bufr_ls.sh b/tests/bufr_ls.sh new file mode 100755 index 000000000..8f8fdb8ff --- /dev/null +++ b/tests/bufr_ls.sh @@ -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