pgbackrest.git / summary / log / commit / refs

commit    f7fc8422f780d18d045f42124dc40aa0920fe416
Author:   David Steele <david@pgmasters.net>
Date:     Fri Sep 07 23:50:01 2018 +0000

    Make Valgrind return an error even when a non-fatal issue is detected.
    
    By default Valgrind does not exit with an error code when a non-fatal error is detected, e.g. unfreed memory.  Use the --error-exitcode option to enabled this behavior.
    
    Update some minor issues discovered in the tests as a result.  Luckily, no issues were missed in the core code.


doc/xml/release.xml | 4 ++++ test/lib/pgBackRestTest/Common/JobTest.pm | 2 +- test/src/module/archive/getTest.c | 1 + test/src/module/common/logTest.c | 2 +- test/src/module/compress/gzipTest.c | 1 + test/src/module/postgres/infoTest.c | 1 + test/src/valgrind.suppress | 9 +++++++++ 7 files changed, 18 insertions(+), 2 deletions(-) diff --git a/doc/xml/release.xml b/doc/xml/release.xml index e53112ff0..a7aebbb67 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -51,6 +51,10 @@ <release-test-list> <release-development-list> + <release-item> + <p>Make Valgrind return an error even when a non-fatal issue is detected. Update some minor issues discovered in the tests as a result.</p> + </release-item> + <release-item> <p>Fix typo in unit test error messages, EXECTED => EXPECTED.</p> </release-item> diff --git a/test/lib/pgBackRestTest/Common/JobTest.pm b/test/lib/pgBackRestTest/Common/JobTest.pm index 6f6e2067e..12b7c70bc 100644 --- a/test/lib/pgBackRestTest/Common/JobTest.pm +++ b/test/lib/pgBackRestTest/Common/JobTest.pm @@ -239,7 +239,7 @@ sub run "make -s 2>&1 && " . ($self->{oTest}->{&TEST_VM} ne VM_CO6 ? " valgrind -q --gen-suppressions=all --suppressions=$self->{strBackRestBase}/test/src/valgrind.suppress" . - " --leak-check=full --leak-resolution=high" : '') . + " --leak-check=full --leak-resolution=high --error-exitcode=25" : '') . " ./test 2>&1'"; } else diff --git a/test/src/module/archive/getTest.c b/test/src/module/archive/getTest.c index 0304c040a..21c04cf7b 100644 --- a/test/src/module/archive/getTest.c +++ b/test/src/module/archive/getTest.c @@ -117,6 +117,7 @@ testRun(void) String *controlFile = strNew("db/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL); PgControlFile control = {.systemId = 0xFACEFACE, .controlVersion = 1002, .catalogVersion = 201707211}; Buffer *controlBuffer = bufNew(512); + memset(bufPtr(controlBuffer), 0, bufSize(controlBuffer)); memcpy(bufPtr(controlBuffer), &control, sizeof(PgControlFile)); bufUsedSet(controlBuffer, bufSize(controlBuffer)); storagePutNP(storageNewWriteNP(storageTest, controlFile), controlBuffer); diff --git a/test/src/module/common/logTest.c b/test/src/module/common/logTest.c index 19d76f7d3..ea784302d 100644 --- a/test/src/module/common/logTest.c +++ b/test/src/module/common/logTest.c @@ -36,7 +36,7 @@ testLogLoad(const char *logFile, char *buffer, size_t bufferSize) { FUNCTION_HARNESS_BEGIN(); FUNCTION_HARNESS_PARAM(STRINGZ, logFile); - FUNCTION_HARNESS_PARAM(STRINGZ, buffer); + FUNCTION_HARNESS_PARAM(CHARP, buffer); FUNCTION_HARNESS_PARAM(SIZE, bufferSize); FUNCTION_HARNESS_ASSERT(logFile != NULL); diff --git a/test/src/module/compress/gzipTest.c b/test/src/module/compress/gzipTest.c index 4c8e7b703..a74579512 100644 --- a/test/src/module/compress/gzipTest.c +++ b/test/src/module/compress/gzipTest.c @@ -175,6 +175,7 @@ testRun(void) decompress->inputSame = true; decompress->done = true; + inflateEnd(decompress->stream); decompress->stream = NULL; TEST_RESULT_INT(gzipDecompressToLog(decompress, buffer, STACK_TRACE_PARAM_MAX), 41, "format object"); TEST_RESULT_STR(buffer, "{inputSame: true, done: true, availIn: 0}", " check format"); diff --git a/test/src/module/postgres/infoTest.c b/test/src/module/postgres/infoTest.c index e543072d7..81ebab6d4 100644 --- a/test/src/module/postgres/infoTest.c +++ b/test/src/module/postgres/infoTest.c @@ -66,6 +66,7 @@ testRun(void) String *controlFile = strNew(PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL); PgControlFile control = {.systemId = 0xFACEFACE, .controlVersion = 833, .catalogVersion = 200711281}; Buffer *controlBuffer = bufNew(512); + memset(bufPtr(controlBuffer), 0, bufSize(controlBuffer)); memcpy(bufPtr(controlBuffer), &control, sizeof(PgControlFile)); bufUsedSet(controlBuffer, bufSize(controlBuffer)); storagePutNP(storageNewWriteNP(storageTest, controlFile), controlBuffer); diff --git a/test/src/valgrind.suppress b/test/src/valgrind.suppress index 4629542bf..d495e0fd1 100644 --- a/test/src/valgrind.suppress +++ b/test/src/valgrind.suppress @@ -16,3 +16,12 @@ ... obj:*/libperl.so* } + +# This only seems to be an issue on Ubuntu 12.04 -- probably due to the old version of Valgrind +{ + ignore_libz_uninit_cond_jump + Memcheck:Cond + fun:inflateReset2 + ... + obj:*/libz.so* +} [parent: faaa9a91fda7]