Testing: Fix grib_repair test

This commit is contained in:
Shahram Najm 2024-01-07 16:52:57 +00:00
parent 290e1ba321
commit 1c0c10cedb
2 changed files with 11 additions and 8 deletions

View File

@ -160,7 +160,6 @@ if( HAVE_BUILD_TOOLS )
# and/or take much longer
list(APPEND tests_extra
grib_data_quality_checks
grib_repair
grib_g1monthlydate
grib_g1fcperiod
grib_bpv_limit
@ -363,6 +362,10 @@ if( HAVE_BUILD_TOOLS )
TYPE SCRIPT
CONDITION ECCODES_INSTALL_EXTRA_TOOLS
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_check_gaussian_grids.sh )
ecbuild_add_test( TARGET eccodes_t_grib_repair
TYPE SCRIPT
CONDITION ECCODES_INSTALL_EXTRA_TOOLS AND ENABLE_EXTRA_TESTS
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_repair.sh )
# Note: making the test dependent on the grib files (with DEPENDS)

View File

@ -14,14 +14,14 @@ label="grib_repair_test"
tempText=temp.$label.txt
tempGrib=temp.$label.grib
export ECCODES_GRIB_REPAIR_MAX_NUM_MESSAGES=3
if [ -e "${tools_dir}/grib_repair" ]; then
export ECCODES_GRIB_REPAIR_MAX_NUM_MESSAGES=3
${tools_dir}/grib_repair $data_dir/bad.grib $tempGrib > $tempText 2>&1
cat $tempText
${tools_dir}/grib_ls $tempGrib
ls -l $data_dir/bad.grib
${tools_dir}/grib_repair $data_dir/bad.grib $tempGrib > $tempText 2>&1
cat $tempText
${tools_dir}/grib_ls $tempGrib
grep -q "Wrong message length" $tempText
grep -q "Wrong message length" $tempText
fi
# Clean up
rm -f $tempText $tempGrib