1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-15 01:04:37 +02:00

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.
This commit is contained in:
David Steele
2018-09-07 16:50:01 -07:00
parent faaa9a91fd
commit f7fc8422f7
7 changed files with 18 additions and 2 deletions

View File

@ -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>

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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");

View File

@ -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);

View File

@ -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*
}