diff --git a/tests/bufr_dump_encode_filter.sh b/tests/bufr_dump_encode_filter.sh index 84bdf540b..42ccec50e 100755 --- a/tests/bufr_dump_encode_filter.sh +++ b/tests/bufr_dump_encode_filter.sh @@ -27,6 +27,13 @@ fBufrTmp=temp.${label}".bufr" # Define filter rules file fRules=temp.${label}.filter +set +u +use_valgrind=1 +if test "x$ECCODES_TEST_WITH_VALGRIND" = "x"; then + use_valgrind=0 +fi +set -u + #----------------------------------------------------------- # NOTE: not all of our BUFR files pass this test. bufr_filter is limited # in what it can do compared to Python or Fortran! @@ -59,7 +66,12 @@ do ${tools_dir}/bufr_dump -Efilter $f > $fRules - ${tools_dir}/codes_bufr_filter -o $fBufrTmp $fRules $f + if [ $use_valgrind -eq 1 ]; then + PREFIX="valgrind --error-exitcode=1 --leak-check=full " + else + PREFIX="" + fi + $PREFIX ${tools_dir}/codes_bufr_filter -o $fBufrTmp $fRules $f ${tools_dir}/bufr_compare $fBufrTmp $f