mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-14 10:13:05 +02:00
Use ASSERT() or TEST_RESULT*() instead of CHECK() in test modules.
This commit is contained in:
parent
a3d7a23a9d
commit
7e35245dc3
@ -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((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");
|
THROW_ON_SYS_ERROR(fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1, ProtocolError, "unable to set O_NONBLOCK");
|
||||||
|
|
||||||
// Attempt connection
|
// Make sure the bad address does not work before using it for testing
|
||||||
CHECK(connect(fd, hostBadAddress->ai_addr, hostBadAddress->ai_addrlen) == -1);
|
ASSERT(connect(fd, hostBadAddress->ai_addr, hostBadAddress->ai_addrlen) == -1);
|
||||||
|
|
||||||
// Create file descriptor write and wait for timeout
|
// Create file descriptor write and wait for timeout
|
||||||
IoWrite *write = NULL;
|
IoWrite *write = NULL;
|
||||||
|
@ -255,8 +255,8 @@ testRun(void)
|
|||||||
// ---------------------------------------------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("connect to non-blocking socket to test write ready");
|
TEST_TITLE("connect to non-blocking socket to test write ready");
|
||||||
|
|
||||||
// Attempt connection
|
// Make sure the bad address does not work before using it for testing
|
||||||
CHECK(connect(fd, hostBadAddress->ai_addr, hostBadAddress->ai_addrlen) == -1);
|
ASSERT(connect(fd, hostBadAddress->ai_addr, hostBadAddress->ai_addrlen) == -1);
|
||||||
|
|
||||||
// Create socket session and wait for timeout
|
// Create socket session and wait for timeout
|
||||||
IoSession *session = NULL;
|
IoSession *session = NULL;
|
||||||
|
@ -203,7 +203,7 @@ testRun(void)
|
|||||||
for (int listIdx = 0; listIdx < testMax; listIdx++)
|
for (int listIdx = 0; listIdx < testMax; listIdx++)
|
||||||
lstAdd(list, &listIdx);
|
lstAdd(list, &listIdx);
|
||||||
|
|
||||||
CHECK(lstSize(list) == (unsigned int)testMax);
|
ASSERT(lstSize(list) == (unsigned int)testMax);
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("search ascending sort");
|
TEST_TITLE("search ascending sort");
|
||||||
@ -211,7 +211,7 @@ testRun(void)
|
|||||||
lstSort(list, sortOrderAsc);
|
lstSort(list, sortOrderAsc);
|
||||||
|
|
||||||
for (int listIdx = 0; listIdx < testMax; listIdx++)
|
for (int listIdx = 0; listIdx < testMax; listIdx++)
|
||||||
CHECK(*(int *)lstFind(list, &listIdx) == listIdx);
|
ASSERT(*(int *)lstFind(list, &listIdx) == listIdx);
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("search descending sort");
|
TEST_TITLE("search descending sort");
|
||||||
@ -219,7 +219,7 @@ testRun(void)
|
|||||||
lstSort(list, sortOrderDesc);
|
lstSort(list, sortOrderDesc);
|
||||||
|
|
||||||
for (int listIdx = 0; listIdx < testMax; listIdx++)
|
for (int listIdx = 0; listIdx < testMax; listIdx++)
|
||||||
CHECK(*(int *)lstFind(list, &listIdx) == listIdx);
|
ASSERT(*(int *)lstFind(list, &listIdx) == listIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_HARNESS_RETURN_VOID();
|
FUNCTION_HARNESS_RETURN_VOID();
|
||||||
|
@ -950,7 +950,7 @@ testRun(void)
|
|||||||
TEST_RESULT_VOID(protocolServerError(server, 39, STRDEF("very serious error"), STRDEF("stack")), "error put");
|
TEST_RESULT_VOID(protocolServerError(server, 39, STRDEF("very serious error"), STRDEF("stack")), "error put");
|
||||||
|
|
||||||
// Wait for exit
|
// 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();
|
HRN_FORK_CHILD_END();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user