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

Rename FUNCTION_DEBUG_* and consolidate ASSERT_* macros for consistency.

Rename FUNCTION_DEBUG_* macros to FUNCTION_LOG_* to more accurately reflect what they do.  Further rename FUNCTION_DEBUG_RESULT* macros to FUNCTION_LOG_RETURN* to make it clearer that they return from the function as well as logging.  Leave FUNCTION_TEST_* macros as they are.

Consolidate the various ASSERT* macros into a single ASSERT macro that is always compiled out of production builds.  It was difficult to figure out when an assert would be checked with all the different types in play.  When ASSERTs are compiled in they will always be checked regardless of the log level -- tying these two concepts together was not a good idea.
This commit is contained in:
David Steele
2019-01-21 17:41:59 +02:00
parent d245f8eb42
commit db08656537
170 changed files with 3568 additions and 3658 deletions

View File

@ -1,7 +1,6 @@
/***********************************************************************************************************************************
Test Page Checksums
***********************************************************************************************************************************/
#include "common/assert.h"
/***********************************************************************************************************************************
Page data for testing -- use 8192 for page size since this is the most common value
@ -76,7 +75,7 @@ testRun(void)
// Check that assertion fails if page buffer and page size are not divisible
TEST_ERROR(
pageChecksumBufferTest(testPage(0), TEST_PAGE_TOTAL * TEST_PAGE_SIZE - 1, 0, TEST_PAGE_SIZE, 0, 0),
AssertError, "function debug assertion 'pageBufferSize % pageSize == 0' failed");
AssertError, "assertion 'pageBufferSize % pageSize == 0' failed");
// Create pages that will pass the test (starting with block 0)
for (unsigned int pageIdx = 0; pageIdx < TEST_PAGE_TOTAL; pageIdx++)
@ -107,7 +106,7 @@ testRun(void)
// Break the checksum for a page and make sure it is found
unsigned int pageInvalid = 7;
ASSERT_DEBUG(pageInvalid < TEST_PAGE_TOTAL);
ASSERT(pageInvalid < TEST_PAGE_TOTAL);
((PageHeader)testPage(pageInvalid))->pd_checksum = 0xEEEE;
TEST_RESULT_BOOL(