Testing: grib_repair/grib_read_any_from_memory

This commit is contained in:
Shahram Najm 2024-01-07 15:26:58 +00:00
parent 5eb9379428
commit 28b7d13eea
4 changed files with 28 additions and 2 deletions

View File

@ -428,6 +428,8 @@ grib_handle* codes_handle_new_from_file(grib_context* c, FILE* f, ProductKind pr
return metar_new_from_file(c, f, error);
if (product == PRODUCT_GTS)
return gts_new_from_file(c, f, error);
//if (product == PRODUCT_TAF)
// return taf_new_from_file(c, f, error);
if (product == PRODUCT_ANY)
return any_new_from_file(c, f, error);

View File

@ -1274,7 +1274,6 @@ int wmo_read_gts_from_file(FILE* f, void* buffer, size_t* len)
// reader r;
// u.user_buffer = buffer;
// u.buffer_size = *len;
// r.read_data = f;
// r.read = &stdio_read;
// r.alloc_data = &u;
@ -1724,7 +1723,6 @@ int grib_read_any_from_memory(grib_context* ctx, unsigned char** data, size_t* d
err = read_any(&r, /*no_alloc=*/0, 1, ECCODES_READS_BUFR, ECCODES_READS_HDF5, ECCODES_READS_WRAP);
*len = r.message_size;
*data_length = m.data_len;
*data = m.data;

View File

@ -160,6 +160,7 @@ 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

25
tests/grib_repair.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/sh
# (C) Copyright 2005- 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.ctest.sh
label="grib_repair_test"
tempText=temp.$label.txt
tempGrib=temp.$label.grib
export ECCODES_GRIB_REPAIR_MAX_NUM_MESSAGES=3
${tools_dir}/grib_repair $data_dir/bad.grib $tempGrib > $tempText 2>&1
${tools_dir}/grib_ls $tempGrib
grep -q "Wrong message length" $tempText
# Clean up
rm -f $tempText $tempGrib