From 8a0cd606e8fb00128ef53cdaae789044e663980b Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Thu, 15 Jun 2017 17:56:58 +0100 Subject: [PATCH] Clang issue with local_MeteoFrance.c test with -fsanitize=memory --- tests/bufr_dump_decode_C.sh | 1 + tests/bufr_dump_encode_C.sh | 2 +- tests/local_MeteoFrance.c | 9 +++++++-- tests/local_MeteoFrance.sh | 3 ++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/bufr_dump_decode_C.sh b/tests/bufr_dump_decode_C.sh index 9f38c5c80..22889cdcb 100755 --- a/tests/bufr_dump_decode_C.sh +++ b/tests/bufr_dump_decode_C.sh @@ -36,6 +36,7 @@ if command -v pkg-config >/dev/null 2>&1; then FLAGS_LINKER=`pkg-config --libs $PKGCONFIG_FILE` #CMAKE_C_FLAGS=`grep CMAKE_C_FLAGS:STRING $CACHE_FILE | cut -d'=' -f2-` #FLAGS_COMPILER="$FLAGS_COMPILER $CMAKE_C_FLAGS" + #FLAGS_COMPILER="$FLAGS_COMPILER -fsanitize=memory" # The pkgconfig variables refer to the install directory. Change to build dir BUILD_DIR=`grep -w eccodes_BINARY_DIR $CACHE_FILE | cut -d'=' -f2` diff --git a/tests/bufr_dump_encode_C.sh b/tests/bufr_dump_encode_C.sh index cffc57ae4..935dce24a 100755 --- a/tests/bufr_dump_encode_C.sh +++ b/tests/bufr_dump_encode_C.sh @@ -36,7 +36,7 @@ if command -v pkg-config >/dev/null 2>&1; then FLAGS_COMPILER=`pkg-config --cflags $PKGCONFIG_FILE` FLAGS_LINKER=`pkg-config --libs $PKGCONFIG_FILE` #CMAKE_C_FLAGS=`grep CMAKE_C_FLAGS:STRING $CACHE_FILE | cut -d'=' -f2-` - #FLAGS_COMPILER="$FLAGS_COMPILER $CMAKE_C_FLAGS" + #FLAGS_COMPILER="$FLAGS_COMPILER -fsanitize=memory" # The pkgconfig variables refer to the install directory. Change to build dir BUILD_DIR=`grep -w eccodes_BINARY_DIR $CACHE_FILE | cut -d'=' -f2` diff --git a/tests/local_MeteoFrance.c b/tests/local_MeteoFrance.c index 97baa2621..602a0e034 100644 --- a/tests/local_MeteoFrance.c +++ b/tests/local_MeteoFrance.c @@ -848,9 +848,11 @@ int main (int argc, char * argv[]) grib_handle* h = NULL; size_t len = 0; - GRIB_CHECK (((h = grib_handle_new_from_samples (NULL, "reduced_gg_ml_grib2")) == NULL), 0); + GRIB_CHECK (((h = grib_handle_new_from_samples (NULL, "regular_ll_pl_grib2")) == NULL), 0); + /*GRIB_CHECK (((h = grib_handle_new_from_samples (NULL, "reduced_gg_ml_grib2")) == NULL), 0);*/ len = strlen ("lambert"); GRIB_CHECK (grib_set_string (h, "gridType", "lambert", &len), 0); + GRIB_CHECK (grib_set_long (h, "centre", 85), 0); GRIB_CHECK (grib_set_long (h, "grib2LocalSectionPresent", 1), 0); @@ -884,6 +886,9 @@ int main (int argc, char * argv[]) GRIB_CHECK (grib_set_long (h, "second", 0), 0); len = strlen ("s"); GRIB_CHECK (grib_set_string (h, "indicatorOfUnitOfTimeRange", "s", &len), 0); + + GRIB_CHECK (grib_set_long (h, "scaledValueOfFirstFixedSurface", 0), 0); + len = strlen ("s"); GRIB_CHECK (grib_set_string (h, "stepUnits", "s", &len), 0); GRIB_CHECK (grib_set_long (h, "endStep", 3600), 0); @@ -900,7 +905,7 @@ int main (int argc, char * argv[]) GRIB_CHECK (grib_set_long (h, "LLCOSP", 0), 0); GRIB_CHECK (grib_set_long (h, "INBITS", 16), 0); - /*GRIB_CHECK(grib_write_message(h, "output.meteoFrance.grib", "w"), 0);*/ + GRIB_CHECK(grib_write_message(h, "output.local_MeteoFrance.grib", "w"), 0); GRIB_CHECK (grib_handle_delete (h), 0); diff --git a/tests/local_MeteoFrance.sh b/tests/local_MeteoFrance.sh index 7fdd445ef..24a906385 100755 --- a/tests/local_MeteoFrance.sh +++ b/tests/local_MeteoFrance.sh @@ -10,4 +10,5 @@ . ./include.sh -exec ${test_dir}/local_MeteoFrance +${test_dir}/local_MeteoFrance +rm -f output.local_MeteoFrance.grib