1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-06-25 00:16:54 +02:00

Add ASSERT_DEBUG() macro for debugging.

Replace all current assert() calls except in tests that can't use the debug code.
This commit is contained in:
David Steele
2018-03-12 14:31:22 -04:00
parent dd31ae832d
commit cced6ec03a
17 changed files with 133 additions and 25 deletions

View File

@ -1,6 +1,7 @@
/***********************************************************************************************************************************
Test Page Checksums
***********************************************************************************************************************************/
#include "common/debug.h"
/***********************************************************************************************************************************
Page data for testing -- use 8192 for page size since this is the most common value
@ -26,7 +27,7 @@ testRun()
// -----------------------------------------------------------------------------------------------------------------------------
if (testBegin("pageChecksum()"))
{
// Checksum for 0x00 fill, page 0x00
// Checksum for 0x00 fill, page 0x00
memset(testPage(0), 0, TEST_PAGE_SIZE);
TEST_RESULT_U16_HEX(pageChecksum(testPage(0), 0, TEST_PAGE_SIZE), 0xC6AA, "check for 0x00 filled page, block 0");
@ -102,7 +103,7 @@ testRun()
// Break the checksum for a page and make sure it is found
unsigned int pageInvalid = 7;
assert(pageInvalid < TEST_PAGE_TOTAL);
ASSERT_DEBUG(pageInvalid < TEST_PAGE_TOTAL);
((PageHeader)testPage(pageInvalid))->pd_checksum = 0xEEEE;
TEST_RESULT_BOOL(