From 5038538820ff2a121367e0bf19beadc55ec59a09 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Mon, 26 Jan 2015 15:50:33 +0000 Subject: [PATCH] GRIB-527: prepare for parallel test runs --- tests/bitsPerValue.sh | 2 -- tests/change_scanning.sh | 1 - tests/compare.sh | 2 +- tests/concept.sh | 29 +++++++++++++---------------- tests/decimalPrecision.sh | 21 +++++++++------------ tests/filter.sh | 8 ++++---- tests/get_fail.sh | 3 --- tests/grib1to2.sh | 16 +++++++++------- tests/grib2to1.sh | 17 ++++++++--------- tests/gridType.sh | 6 ++---- tests/level.sh | 9 ++++----- tests/list.sh | 6 +++--- tests/local.sh | 7 +++---- tests/ls.sh | 25 +++++++++++++------------ tests/missing.sh | 2 -- tests/multi.sh | 5 +---- tests/padding.sh | 7 ++++--- tests/second_order.sh | 1 - tests/set.sh | 4 +++- tests/step.sh | 2 +- 20 files changed, 78 insertions(+), 95 deletions(-) diff --git a/tests/bitsPerValue.sh b/tests/bitsPerValue.sh index 8da443886..dc7bcbf5c 100755 --- a/tests/bitsPerValue.sh +++ b/tests/bitsPerValue.sh @@ -65,7 +65,6 @@ spectral_complex.grib1 spherical_model_level.grib1 spherical_pressure_level.grib1 test.grib1 -with_bitmap.grib1 gep10.t12z.pgrb2af78.grib2 gfs.c255.grib2 jpeg.grib2 @@ -117,4 +116,3 @@ done # Extra test for grid_complex_spatial_differencing res=`${tools_dir}grib_get -p decimalScaleFactor,bitsPerValue ${data_dir}/gfs.c255.grib2` [ "$res" = "1 20" ] - diff --git a/tests/change_scanning.sh b/tests/change_scanning.sh index 7769237f8..3697c5547 100755 --- a/tests/change_scanning.sh +++ b/tests/change_scanning.sh @@ -13,7 +13,6 @@ editions="1 2" gridTypes="regular_ll rotated_ll" -outfile=out.grib Ni_list="5 8" Nj_list="7 4" diff --git a/tests/compare.sh b/tests/compare.sh index 841309669..92ad6914e 100755 --- a/tests/compare.sh +++ b/tests/compare.sh @@ -14,7 +14,7 @@ REDIRECT=/dev/null infile="${data_dir}/regular_latlon_surface.grib1" -outfile=${infile}.1 +outfile=${infile}.compare.$$ rm -f $outfile || true diff --git a/tests/concept.sh b/tests/concept.sh index cf7053617..71ee67fec 100755 --- a/tests/concept.sh +++ b/tests/concept.sh @@ -11,24 +11,21 @@ . ./include.sh data="${data_dir}/*grib1 ${data_dir}/*grib2" -tmp="tmp.out" +tmp="tmp.concept.out" for d in $data do - -set -e -${tools_dir}grib_ls -p gridType,packingType -w dataRepresentationType!=192 $d > $tmp - -set +e -grep unknown $tmp - -if [ $? -eq 0 ] -then - false - exit -fi - -rm -f $tmp | true + set -e + ${tools_dir}grib_ls -p gridType,packingType -w dataRepresentationType!=192 $d > $tmp + + set +e + grep unknown $tmp + + if [ $? -eq 0 ] + then + false + exit + fi + rm -f $tmp | true done - diff --git a/tests/decimalPrecision.sh b/tests/decimalPrecision.sh index f0eccb7a1..0d1a041ef 100755 --- a/tests/decimalPrecision.sh +++ b/tests/decimalPrecision.sh @@ -15,19 +15,16 @@ REDIRECT=/dev/null files="regular_latlon_surface.grib2 \ regular_latlon_surface.grib1" - - - for file in `echo $files` do - infile=${data_dir}/$file - outfile1=${infile}_decimalPrecision_1 - outfile2=${infile}_decimalPrecision_2 - ${tools_dir}grib_set -r -s decimalScaleFactor=1,bitsPerValue=0 $infile $outfile1 - ${tools_dir}grib_compare -b totalLength,section4Length,section7Length,dataLength,decimalScaleFactor,binaryScaleFactor,referenceValue,bitsPerValue $infile $outfile1 > $REDIRECT - ${tools_dir}grib_set -s changeDecimalPrecision=1 $infile $outfile2 - ${tools_dir}grib_compare -b totalLength,section4Length,section7Length,dataLength,decimalScaleFactor,binaryScaleFactor,referenceValue,bitsPerValue $infile $outfile2 > $REDIRECT - ${tools_dir}grib_compare $outfile1 $outfile2 - rm -f $outfile1 $outfile2 || true + infile=${data_dir}/$file + outfile1=${infile}_decimalPrecision_1 + outfile2=${infile}_decimalPrecision_2 + ${tools_dir}grib_set -r -s decimalScaleFactor=1,bitsPerValue=0 $infile $outfile1 + ${tools_dir}grib_compare -b totalLength,section4Length,section7Length,dataLength,decimalScaleFactor,binaryScaleFactor,referenceValue,bitsPerValue $infile $outfile1 > $REDIRECT + ${tools_dir}grib_set -s changeDecimalPrecision=1 $infile $outfile2 + ${tools_dir}grib_compare -b totalLength,section4Length,section7Length,dataLength,decimalScaleFactor,binaryScaleFactor,referenceValue,bitsPerValue $infile $outfile2 > $REDIRECT + ${tools_dir}grib_compare $outfile1 $outfile2 + rm -f $outfile1 $outfile2 || true done diff --git a/tests/filter.sh b/tests/filter.sh index 6a00499c8..f26fec0d5 100755 --- a/tests/filter.sh +++ b/tests/filter.sh @@ -14,7 +14,7 @@ REDIRECT=/dev/null if [ -f ${data_dir}/geavg.t12z.pgrbaf108 ] then - tmpdata=grib_api.grib + tmpdata=grib_api.$$.grib rm -f $tmpdata || true ${tools_dir}grib_filter ${data_dir}/filter_rules ${data_dir}/geavg.t12z.pgrbaf108 > $REDIRECT rm -f $tmpdata @@ -68,8 +68,8 @@ set nlev=41.0; write; EOF -${tools_dir}/grib_filter -o temp.grib2 temp.filt $ECCODES_SAMPLES_PATH/sh_ml_grib1.tmpl -result=`${tools_dir}/grib_get -p typeOfFirstFixedSurface,NV,nlev temp.grib2` +${tools_dir}/grib_filter -o temp_filt.grib2 temp.filt $ECCODES_SAMPLES_PATH/sh_ml_grib1.tmpl +result=`${tools_dir}/grib_get -p typeOfFirstFixedSurface,NV,nlev temp_filt.grib2` [ "$result" = "150 6 41" ] # GRIB-394: grib_filter arithmetic operators not correct for floating point values @@ -117,5 +117,5 @@ EOF ${tools_dir}/grib_filter temp.filt $ECCODES_SAMPLES_PATH/GRIB1.tmpl -rm -f temp.grib2 temp.filt +rm -f temp_filt.grib2 temp.filt rm -f ${data_dir}/formatint.rules ${data_dir}/binop.rules diff --git a/tests/get_fail.sh b/tests/get_fail.sh index 6de8694c1..cdff1a23d 100755 --- a/tests/get_fail.sh +++ b/tests/get_fail.sh @@ -8,7 +8,6 @@ # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # - . ./include.sh REDIRECT=/dev/null @@ -21,5 +20,3 @@ if [ $? -eq 0 ] then exit 1; fi - - diff --git a/tests/grib1to2.sh b/tests/grib1to2.sh index 5a6181c55..5e8e312cd 100755 --- a/tests/grib1to2.sh +++ b/tests/grib1to2.sh @@ -32,19 +32,21 @@ files="constant_field\ for f in `echo $files` do file=${data_dir}/$f - rm -f ${file}.grib2 || true - ${tools_dir}grib_set -s editionNumber=2 ${file}.grib1 ${file}.grib2 2> $REDIRECT > $REDIRECT + output=${file}.grib2_ + rm -f ${output} + ${tools_dir}grib_set -s editionNumber=2 ${file}.grib1 ${output} 2> $REDIRECT > $REDIRECT grib1Statistics=`${tools_dir}grib_get -fp numberOfValues,numberOfPoints,max,min,average,numberOfMissing ${file}.grib1` - grib2Statistics=`${tools_dir}grib_get -fp numberOfValues,numberOfPoints,max,min,average,numberOfMissing ${file}.grib2` + grib2Statistics=`${tools_dir}grib_get -fp numberOfValues,numberOfPoints,max,min,average,numberOfMissing ${output}` - if [ "$grib1Statistics" != "$grib2Statistics" ] - then + if [ "$grib1Statistics" != "$grib2Statistics" ]; then exit 1 fi - #${tools_dir}grib_compare -A1.0e-8 -c values ${file}.grib1 ${file}.grib2 2> /dev/null > /dev/null - ${tools_dir}grib_compare -P -c values ${file}.grib1 ${file}.grib2 2> $REDIRECT > $REDIRECT + #${tools_dir}grib_compare -A1.0e-8 -c values ${file}.grib1 ${output} 2> /dev/null > /dev/null + ${tools_dir}grib_compare -P -c values ${file}.grib1 ${output} 2> $REDIRECT > $REDIRECT + + rm -f ${output} done diff --git a/tests/grib2to1.sh b/tests/grib2to1.sh index e29d51d98..b028a39ef 100755 --- a/tests/grib2to1.sh +++ b/tests/grib2to1.sh @@ -7,7 +7,6 @@ # 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 REDIRECT=/dev/null @@ -29,22 +28,22 @@ files="constant_field\ spherical_pressure_level \ spherical_model_level " -for f in `echo $files` +for f in $files do file=${data_dir}/$f - rm -f ${file}.grib1_ || true - ${tools_dir}grib_set -s editionNumber=1 ${file}.grib2 ${file}.grib1_ 2> $REDIRECT > $REDIRECT + output=${file}.grib1_ + rm -f ${output} || true + ${tools_dir}grib_set -s editionNumber=1 ${file}.grib2 ${output} 2> $REDIRECT > $REDIRECT - grib1Statistics=`${tools_dir}grib_get -fp numberOfValues,numberOfPoints,max,min,average,numberOfMissing ${file}.grib1_` + grib1Statistics=`${tools_dir}grib_get -fp numberOfValues,numberOfPoints,max,min,average,numberOfMissing ${output}` grib2Statistics=`${tools_dir}grib_get -fp numberOfValues,numberOfPoints,max,min,average,numberOfMissing ${file}.grib2` - if [ "$grib1Statistics" != "$grib2Statistics" ] - then + if [ "$grib1Statistics" != "$grib2Statistics" ]; then exit 1 fi - #${tools_dir}grib_compare -A1.0e-8 -c values ${file}.grib1_ ${file}.grib2 2> /dev/null > /dev/null - rm -f ${file}.grib1_ || true + #${tools_dir}grib_compare -A1.0e-8 -c values ${output} ${file}.grib2 2> /dev/null > /dev/null + rm -f ${output} done # GRIB-262 Conversion works without error for L137 data diff --git a/tests/gridType.sh b/tests/gridType.sh index ae6dfff6c..a463001d3 100755 --- a/tests/gridType.sh +++ b/tests/gridType.sh @@ -13,9 +13,8 @@ REDIRECT=/dev/null -tmpdata=grib_api.grib - -rm -f $tmpdata || true +tmpdata=grib_api.gridType.grib +rm -f $tmpdata ${tools_dir}grib_set -s gridType=regular_gg ${data_dir}/reduced_latlon_surface.grib1 ${tmpdata} > $REDIRECT @@ -40,4 +39,3 @@ then fi rm -f $tmpdata || true - diff --git a/tests/level.sh b/tests/level.sh index 27955c33a..ece0a30ff 100755 --- a/tests/level.sh +++ b/tests/level.sh @@ -11,14 +11,13 @@ . ./include.sh #set -x -outfile=out.grib sample_g1=$ECCODES_SAMPLES_PATH/GRIB1.tmpl sample_g2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl -temp=temp.grib +temp=temp.level.grib file=${data_dir}/regular_gaussian_pressure_level.grib1 -cat >good<temp.level.good< test.dump -diff good test.dump +diff temp.level.good test.dump # GRIB-492 ${tools_dir}grib_set -s indicatorOfTypeOfLevel=110 $sample_g1 $temp @@ -75,4 +74,4 @@ input=${data_dir}/tigge_pf_ecmwf.grib2 res=`${tools_dir}grib_get -wcount=7 -F%.20f -p level:d $input` [ "$res" = "2.00000000000000000000" ] -rm -f level.filter good test.dump $temp +rm -f level.filter temp.level.good test.dump $temp diff --git a/tests/list.sh b/tests/list.sh index d32b275ad..89ebf3149 100755 --- a/tests/list.sh +++ b/tests/list.sh @@ -18,7 +18,7 @@ set satelliteNumber={4,4,4,5}; set instrumentType={591,591,591,592}; set scaleFactorOfCentralWaveNumber={3,3,3,4}; set scaledValueOfCentralWaveNumber={26870,9272,8377,22334}; -write "test.grib"; +write "test.list.grib"; EOF file="${data_dir}/reduced_gaussian_model_level.grib2" @@ -35,7 +35,7 @@ print("x.out") "scaleFactorOfCentralWaveNumber={[scaleFactorOfCentralWaveNumber' print("x.out") "scaledValueOfCentralWaveNumber={[scaledValueOfCentralWaveNumber',']}"; EOF -${tools_dir}grib_filter list.filter test.grib +${tools_dir}grib_filter list.filter test.list.grib cat >list.ref<2 +# conversion 1->2 for localDefinitionNumber in 1 15 26 30 do ${tools_dir}grib_set -s localDefinitionNumber=$localDefinitionNumber,perturbationNumber=2,numberOfForecastsInEnsemble=50 loc.grib1 eps.grib1 diff --git a/tests/ls.sh b/tests/ls.sh index 1e49fbd25..8ca99c439 100755 --- a/tests/ls.sh +++ b/tests/ls.sh @@ -10,19 +10,20 @@ . ./include.sh -rm -f log | true +tempLog=temp.ls.log +rm -f $tempLog workdir=`pwd` cd ${data_dir} infile=regular_gaussian_model_level.grib1 -${tools_dir}grib_ls -P count $infile > log -${tools_dir}grib_ls -p count,step $infile >> log -${tools_dir}grib_ls $infile >> log -${tools_dir}grib_ls -l 0,0,1 $infile >> log -${tools_dir}grib_get -l 0,0,1 $infile >> log -${tools_dir}grib_get -p count,step $infile >> log -${tools_dir}grib_get -P count $infile >> log +${tools_dir}grib_ls -P count $infile > $tempLog +${tools_dir}grib_ls -p count,step $infile >> $tempLog +${tools_dir}grib_ls $infile >> $tempLog +${tools_dir}grib_ls -l 0,0,1 $infile >> $tempLog +${tools_dir}grib_get -l 0,0,1 $infile >> $tempLog +${tools_dir}grib_get -p count,step $infile >> $tempLog +${tools_dir}grib_get -P count $infile >> $tempLog files=" reduced_gaussian_lsm.grib1 reduced_gaussian_model_level.grib1 @@ -52,12 +53,12 @@ regular_latlon_surface.grib2 for file in $files do [ -f "$file" ] - echo $file >> log - ${tools_dir}grib_ls -l 40,28 $file | grep index | awk '{print $4;}' >> log + echo $file >> $tempLog + ${tools_dir}grib_ls -l 40,28 $file | grep index | awk '{print $4;}' >> $tempLog done -diff log ls.log -rm -f log +diff $tempLog ls.log +rm -f $tempLog # Test for bug GRIB-56 ${tools_dir}grib_set -s typeOfLevel=depthBelowLandLayer,topLevel=missing regular_latlon_surface.grib1 tmp_rlls.grib1 diff --git a/tests/missing.sh b/tests/missing.sh index 08cbbdcef..25f051d63 100755 --- a/tests/missing.sh +++ b/tests/missing.sh @@ -8,7 +8,6 @@ # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # - . ./include.sh REDIRECT=/dev/null @@ -37,4 +36,3 @@ ${tools_dir}grib_set -s centre=missing $infile $outfile 2> $REDIRECT > $REDIRECT [ $? -ne 0 ] rm -f $outfile - diff --git a/tests/multi.sh b/tests/multi.sh index e9663da03..5bb49e1f3 100755 --- a/tests/multi.sh +++ b/tests/multi.sh @@ -8,7 +8,6 @@ # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # - . ./include.sh if [ ! -f ${data_dir}/multi.grib2 ] @@ -18,8 +17,7 @@ then fi tmpdata=grib_api.$$.grib - -rm -f $tmpdata || true +rm -f $tmpdata parameterNumber=`${tools_dir}grib_get -p parameterNumber -w parameterCategory=2,parameterNumber=3 ${data_dir}/multi.grib2` if [ -z "$parameterNumber" ] @@ -45,4 +43,3 @@ then fi rm -f $tmpdata.1 $tmpdata.rules || true - diff --git a/tests/padding.sh b/tests/padding.sh index 44b991f7b..2d66f998e 100755 --- a/tests/padding.sh +++ b/tests/padding.sh @@ -11,8 +11,9 @@ . ./include.sh REDIRECT=/dev/null +temp=loc.padding.grib1 -${tools_dir}grib_set -s setLocalDefinition=1 ${data_dir}/regular_latlon_surface.grib1 loc.grib1 +${tools_dir}grib_set -s setLocalDefinition=1 ${data_dir}/regular_latlon_surface.grib1 $temp cat > $$_f < $REDIRECT > $REDIRECT [ $? -ne 0 ] - +rm -f $outfile || true diff --git a/tests/step.sh b/tests/step.sh index 9997dacb3..e16215650 100755 --- a/tests/step.sh +++ b/tests/step.sh @@ -13,7 +13,7 @@ REDIRECT=/dev/null templog=${data_dir}/log.step.$$ -rm -f ${templog} | true +rm -f ${templog} || true for i in 0 10 do for s in 0 1200 600 6000