1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-12 10:04:14 +02:00

Use ASSERT() or TEST_RESULT*() instead of CHECK() in test modules.

This commit is contained in:
David Steele 2021-11-23 08:07:31 -05:00
parent a3d7a23a9d
commit 7e35245dc3
4 changed files with 8 additions and 8 deletions

View File

@ -677,8 +677,8 @@ testRun(void)
THROW_ON_SYS_ERROR((flags = fcntl(fd, F_GETFL)) == -1, ProtocolError, "unable to get flags");
THROW_ON_SYS_ERROR(fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1, ProtocolError, "unable to set O_NONBLOCK");
// Attempt connection
CHECK(connect(fd, hostBadAddress->ai_addr, hostBadAddress->ai_addrlen) == -1);
// Make sure the bad address does not work before using it for testing
ASSERT(connect(fd, hostBadAddress->ai_addr, hostBadAddress->ai_addrlen) == -1);
// Create file descriptor write and wait for timeout
IoWrite *write = NULL;

View File

@ -255,8 +255,8 @@ testRun(void)
// ---------------------------------------------------------------------------------------------------------------------
TEST_TITLE("connect to non-blocking socket to test write ready");
// Attempt connection
CHECK(connect(fd, hostBadAddress->ai_addr, hostBadAddress->ai_addrlen) == -1);
// Make sure the bad address does not work before using it for testing
ASSERT(connect(fd, hostBadAddress->ai_addr, hostBadAddress->ai_addrlen) == -1);
// Create socket session and wait for timeout
IoSession *session = NULL;

View File

@ -203,7 +203,7 @@ testRun(void)
for (int listIdx = 0; listIdx < testMax; listIdx++)
lstAdd(list, &listIdx);
CHECK(lstSize(list) == (unsigned int)testMax);
ASSERT(lstSize(list) == (unsigned int)testMax);
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("search ascending sort");
@ -211,7 +211,7 @@ testRun(void)
lstSort(list, sortOrderAsc);
for (int listIdx = 0; listIdx < testMax; listIdx++)
CHECK(*(int *)lstFind(list, &listIdx) == listIdx);
ASSERT(*(int *)lstFind(list, &listIdx) == listIdx);
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("search descending sort");
@ -219,7 +219,7 @@ testRun(void)
lstSort(list, sortOrderDesc);
for (int listIdx = 0; listIdx < testMax; listIdx++)
CHECK(*(int *)lstFind(list, &listIdx) == listIdx);
ASSERT(*(int *)lstFind(list, &listIdx) == listIdx);
}
FUNCTION_HARNESS_RETURN_VOID();

View File

@ -950,7 +950,7 @@ testRun(void)
TEST_RESULT_VOID(protocolServerError(server, 39, STRDEF("very serious error"), STRDEF("stack")), "error put");
// Wait for exit
CHECK(protocolServerCommandGet(server).id == PROTOCOL_COMMAND_EXIT);
TEST_RESULT_UINT(protocolServerCommandGet(server).id, PROTOCOL_COMMAND_EXIT, "wait for exit");
}
HRN_FORK_CHILD_END();