Tools: Increase coverage

This commit is contained in:
Shahram Najm 2024-01-20 14:09:25 +00:00
parent 2be9319973
commit ecf1f5ec86
2 changed files with 38 additions and 13 deletions

View File

@ -15,20 +15,30 @@ tempText=temp.$label.txt
tempGoodGribs=temp.$label.good.grib tempGoodGribs=temp.$label.good.grib
tempBadGribs=temp.$label.bad.grib tempBadGribs=temp.$label.bad.grib
if [ -e "${tools_dir}/grib_repair" ]; then if [ ! -e "${tools_dir}/grib_repair" ]; then
export ECCODES_GRIB_REPAIR_MAX_NUM_MESSAGES=3 exit 0
${tools_dir}/grib_repair $data_dir/bad.grib $tempGoodGribs $tempBadGribs > $tempText 2>&1
grep -q "Wrong message length" $tempText
count=$( ${tools_dir}/grib_count $tempGoodGribs )
[ $count -eq 1 ]
count=$( ${tools_dir}/grib_count $tempBadGribs )
[ $count -eq 3 ]
${tools_dir}/grib_ls $tempGoodGribs
${tools_dir}/grib_ls $tempBadGribs
fi fi
set +e
${tools_dir}/grib_repair
status=$?
set -e
[ $status -ne 0 ]
export ECCODES_GRIB_REPAIR_MAX_NUM_MESSAGES=3
${tools_dir}/grib_repair $data_dir/bad.grib $tempGoodGribs $tempBadGribs > $tempText 2>&1
grep -q "Wrong message length" $tempText
count=$( ${tools_dir}/grib_count $tempGoodGribs )
[ $count -eq 1 ]
count=$( ${tools_dir}/grib_count $tempBadGribs )
[ $count -eq 3 ]
${tools_dir}/grib_ls $tempGoodGribs
${tools_dir}/grib_ls $tempBadGribs
# Clean up # Clean up
rm -f $tempText $tempGoodGribs $tempBadGribs rm -f $tempText $tempGoodGribs $tempBadGribs

View File

@ -31,6 +31,12 @@ echo "Test: comparing the same files" >> $fLog
echo "file: $gts_file" >> $fLog echo "file: $gts_file" >> $fLog
${tools_dir}/gts_compare $gts_file $gts_file ${tools_dir}/gts_compare $gts_file $gts_file
#----------------------------------------------------
# Test: comparing with skip
#----------------------------------------------------
gts_file="EGRR20150317121020_00493212.DAT"
${tools_dir}/gts_compare -w TT=SA $gts_file $gts_file
#---------------------------------------------------- #----------------------------------------------------
# Test: comparing two different files # Test: comparing two different files
#---------------------------------------------------- #----------------------------------------------------
@ -99,6 +105,15 @@ cp $gts_file $tempDir
${tools_dir}/gts_compare $gts_file $tempDir ${tools_dir}/gts_compare $gts_file $tempDir
rm -r $tempDir rm -r $tempDir
# Options
set +e
${tools_dir}/gts_compare -a $gts_file $gts_file > $fLog 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "option requires" $fLog
# Non-existence # Non-existence
set +e set +e
${tools_dir}/gts_compare non-exist1 non-exist2 > $fLog 2>&1 ${tools_dir}/gts_compare non-exist1 non-exist2 > $fLog 2>&1