You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-09 00:45:49 +02:00
Automatically create IoRead/IoWrite interfaces in HRN_FORK*() macros.
This removes a lot of boiler plate where every instance needs to create these interfaces. Also add HRN_FORK_*_NOTIFY*() macros to standardize synchronizing between the parent and child processes. In both cases update the tests with the new macros.
This commit is contained in:
@ -147,7 +147,7 @@ testRun(void)
|
||||
CHECK(TEST_SCALE <= 2000);
|
||||
uint64_t fileTotal = (uint64_t)1000000 * TEST_SCALE;
|
||||
|
||||
HRN_FORK_BEGIN()
|
||||
HRN_FORK_BEGIN(.timeout = 60000)
|
||||
{
|
||||
HRN_FORK_CHILD_BEGIN()
|
||||
{
|
||||
@ -173,9 +173,7 @@ testRun(void)
|
||||
|
||||
// Setup handler for remote storage protocol
|
||||
ProtocolServer *server = protocolServerNew(
|
||||
STRDEF("storage test server"), STRDEF("test"),
|
||||
ioFdReadNewOpen(STRDEF("storage server read"), HRN_FORK_CHILD_READ_FD(), 60000),
|
||||
ioFdWriteNewOpen(STRDEF("storage server write"), HRN_FORK_CHILD_WRITE_FD(), 1000));
|
||||
STRDEF("storage test server"), STRDEF("test"), HRN_FORK_CHILD_READ(), HRN_FORK_CHILD_WRITE());
|
||||
|
||||
static const ProtocolServerHandler commandHandler[] = {PROTOCOL_SERVER_HANDLER_STORAGE_REMOTE_LIST};
|
||||
protocolServerProcess(server, NULL, commandHandler, PROTOCOL_SERVER_HANDLER_LIST_SIZE(commandHandler));
|
||||
@ -187,9 +185,7 @@ testRun(void)
|
||||
{
|
||||
// Create client
|
||||
ProtocolClient *client = protocolClientNew(
|
||||
STRDEF("storage test client"), STRDEF("test"),
|
||||
ioFdReadNewOpen(STRDEF("storage client read"), HRN_FORK_PARENT_READ_FD(0), 60000),
|
||||
ioFdWriteNewOpen(STRDEF("storage client write"), HRN_FORK_PARENT_WRITE_FD(0), 1000));
|
||||
STRDEF("storage test client"), STRDEF("test"), HRN_FORK_PARENT_READ(0), HRN_FORK_PARENT_WRITE(0));
|
||||
|
||||
// Create remote storage
|
||||
Storage *storageRemote = storageRemoteNew(
|
||||
|
Reference in New Issue
Block a user