ECC-923: Mismatched count not reported as difference by grib_compare

This commit is contained in:
Shahram Najm 2019-05-10 13:05:35 +01:00
parent 1764a4645b
commit 5e0f600e0b
3 changed files with 52 additions and 5 deletions

View File

@ -99,6 +99,7 @@ list( APPEND tests_data_reqd
grib_ecc-756
grib_ecc-873
grib_ecc-600
grib_ecc-923
bufr_ecc-556
gts_get
gts_ls

45
tests/grib_ecc-923.sh Executable file
View File

@ -0,0 +1,45 @@
#!/bin/sh
# Copyright 2005-2019 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 -u
# ---------------------------------------------------------
# This is the test for the JIRA issue ECC-923.
# Mismatched count not reported as difference by grib_compare
# ---------------------------------------------------------
label="grib_ecc-923-test"
tempOut=temp.${label}.out
tempGrib1=temp.1.${label}.grib
tempGrib2=temp.2.${label}.grib
tempGrib3=temp.3.${label}.grib
input=${data_dir}/high_level_api.grib2
${tools_dir}/grib_copy -w count=1 $input $tempGrib1
${tools_dir}/grib_copy -w count=1/2 $input $tempGrib2
${tools_dir}/grib_copy -w count=1/2/3 $input $tempGrib3
# 1st file has fewer messages than 2nd file
set +e
${tools_dir}/grib_compare $tempGrib1 $tempGrib2
status=$?
set -e
[ $status -eq 1 ]
# 2nd file has fewer messages than 1st file
set +e
${tools_dir}/grib_compare $tempGrib2 $tempGrib1
status=$?
set -e
[ $status -eq 1 ]
# Clean up
rm -f $tempGrib1 $tempGrib2 $tempGrib3

View File

@ -496,17 +496,19 @@ int grib_tool_finalise_action(grib_runtime_options* options)
grib_error* e=error_summary;
int err=0;
grib_context* c=grib_context_get_default();
error+=morein1+morein2;
/*if (grib_options_on("w:")) return 0;*/
if (error) {
printf("\n## ERRORS SUMMARY #######\n");
}
while ((global_handle=grib_handle_new_from_file(c,options->infile_extra->file,&err))) {
morein1++;
if (global_handle) grib_handle_delete(global_handle);
}
error+=morein1+morein2;
if (error) {
printf("\n## ERRORS SUMMARY #######\n");
}
if (morein1>0) {
printf("##\n## Different number of messages \n");
printf("## %d more messages in %s than in %s\n",morein1,
@ -533,7 +535,6 @@ int grib_tool_finalise_action(grib_runtime_options* options)
grib_index_delete(options->index2);
}
if (error !=0) exit(1);
return 0;
}