1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-01-18 04:58:51 +02:00

Improve HRN_FORK*() macros.

Simplify HRN_FORK_CHILD_BEGIN() by adding optional parameters with the common defaults.

Add _FD() to macros that retrieve file descriptors to make their purpose clearer.
This commit is contained in:
David Steele 2021-07-13 14:22:53 -04:00
parent 76cfbf833d
commit 1ace1ac938
26 changed files with 161 additions and 178 deletions

View File

@ -440,7 +440,7 @@ Sometimes it is useful to use a child process for testing. Below is a simple exa
```
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, false)
HRN_FORK_CHILD_BEGIN()
{
TEST_RESULT_INT_NE(
lockAcquire(cfgOptionStr(cfgOptLockPath), STRDEF("stanza1"), STRDEF("999-ffffffff"), lockTypeBackup, 0, true),

View File

@ -499,7 +499,7 @@ TEST_RESULT_LOG(
<code-block>
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, false)
HRN_FORK_CHILD_BEGIN()
{
TEST_RESULT_INT_NE(
lockAcquire(cfgOptionStr(cfgOptLockPath), STRDEF("stanza1"), STRDEF("999-ffffffff"), lockTypeBackup, 0, true),

View File

@ -15,7 +15,7 @@ HRN_FORK_BEGIN()
//
// The second parameter specifies whether pipes should be setup between the parent and child processes. These can be accessed
// with the HRN_FORK_*() macros;
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
// Child test code goes here
}
@ -69,31 +69,19 @@ Return the pipe for the child process
#define HRN_FORK_PIPE(processIdx) \
HRN_FORK_pipe[processIdx]
/***********************************************************************************************************************************
Is the pipe required for this child process?
***********************************************************************************************************************************/
#define HRN_FORK_PIPE_REQUIRED(processIdx) \
HRN_FORK_pipeRequired[processIdx]
/***********************************************************************************************************************************
Get read/write pipe file descriptors
***********************************************************************************************************************************/
#define HRN_FORK_CHILD_READ_PROCESS(processIdx) \
HRN_FORK_PIPE(processIdx)[1][0]
#define HRN_FORK_CHILD_READ_FD() \
HRN_FORK_PIPE(HRN_FORK_PROCESS_IDX())[1][0]
#define HRN_FORK_CHILD_READ() \
HRN_FORK_CHILD_READ_PROCESS(HRN_FORK_PROCESS_IDX())
#define HRN_FORK_CHILD_WRITE_FD() \
HRN_FORK_PIPE(HRN_FORK_PROCESS_IDX())[0][1]
#define HRN_FORK_CHILD_WRITE_PROCESS(processIdx) \
HRN_FORK_PIPE(processIdx)[0][1]
#define HRN_FORK_CHILD_WRITE() \
HRN_FORK_CHILD_WRITE_PROCESS(HRN_FORK_PROCESS_IDX())
#define HRN_FORK_PARENT_READ_PROCESS(processIdx) \
#define HRN_FORK_PARENT_READ_FD(processIdx) \
HRN_FORK_PIPE(processIdx)[0][0]
#define HRN_FORK_PARENT_WRITE_PROCESS(processIdx) \
#define HRN_FORK_PARENT_WRITE_FD(processIdx) \
HRN_FORK_PIPE(processIdx)[1][1]
/***********************************************************************************************************************************
@ -112,29 +100,32 @@ Begin the fork block
unsigned int HRN_FORK_PROCESS_TOTAL() = 0; \
pid_t HRN_FORK_PROCESS_ID(HRN_FORK_CHILD_MAX) = {0}; \
int HRN_FORK_CHILD_EXPECTED_EXIT_STATUS(HRN_FORK_CHILD_MAX) = {0}; \
bool HRN_FORK_PIPE_REQUIRED(HRN_FORK_CHILD_MAX) = {0}; \
int HRN_FORK_PIPE(HRN_FORK_CHILD_MAX)[2][2] = {{{0}}};
/***********************************************************************************************************************************
Create a child process
***********************************************************************************************************************************/
#define HRN_FORK_CHILD_BEGIN(expectedExitStatus, pipeRequired) \
typedef struct HrnForkChildParam
{
VAR_PARAM_HEADER;
int expectedExitStatus;
} HrnForkChildParam;
#define HRN_FORK_CHILD_BEGIN(...) \
do \
{ \
HRN_FORK_CHILD_EXPECTED_EXIT_STATUS(HRN_FORK_PROCESS_TOTAL()) = expectedExitStatus; \
const HrnForkChildParam param = {VAR_PARAM_INIT, __VA_ARGS__}; \
HRN_FORK_CHILD_EXPECTED_EXIT_STATUS(HRN_FORK_PROCESS_TOTAL()) = param.expectedExitStatus; \
\
if (pipeRequired) \
{ \
HRN_FORK_PIPE_REQUIRED(HRN_FORK_PROCESS_TOTAL()) = true; \
\
THROW_ON_SYS_ERROR_FMT( \
pipe(HRN_FORK_PIPE(HRN_FORK_PROCESS_TOTAL())[0]) == -1, KernelError, \
"unable to create read pipe for child process %u", HRN_FORK_PROCESS_TOTAL()); \
THROW_ON_SYS_ERROR_FMT( \
pipe(HRN_FORK_PIPE(HRN_FORK_PROCESS_TOTAL())[1]) == -1, KernelError, \
"unable to create write pipe for child process %u", HRN_FORK_PROCESS_TOTAL()); \
} \
/* Create pipe for parent/child communication */ \
THROW_ON_SYS_ERROR_FMT( \
pipe(HRN_FORK_PIPE(HRN_FORK_PROCESS_TOTAL())[0]) == -1, KernelError, \
"unable to create read pipe for child process %u", HRN_FORK_PROCESS_TOTAL()); \
THROW_ON_SYS_ERROR_FMT( \
pipe(HRN_FORK_PIPE(HRN_FORK_PROCESS_TOTAL())[1]) == -1, KernelError, \
"unable to create write pipe for child process %u", HRN_FORK_PROCESS_TOTAL()); \
\
/* Fork child process */ \
HRN_FORK_PROCESS_ID(HRN_FORK_PROCESS_TOTAL()) = fork(); \
\
if (HRN_FORK_PROCESS_ID(HRN_FORK_PROCESS_TOTAL()) == 0) \
@ -142,20 +133,16 @@ Create a child process
unsigned int HRN_FORK_PROCESS_IDX() = HRN_FORK_PROCESS_TOTAL(); \
\
/* Change log process id to aid in debugging */ \
hrnLogProcessIdSet(HRN_FORK_PROCESS_IDX() + 1); \
hrnLogProcessIdSet(HRN_FORK_PROCESS_IDX() + 1); \
\
if (pipeRequired) \
{ \
close(HRN_FORK_PARENT_READ_PROCESS(HRN_FORK_PROCESS_IDX())); \
close(HRN_FORK_PARENT_WRITE_PROCESS(HRN_FORK_PROCESS_IDX())); \
}
/* Close parent side of pipe */ \
close(HRN_FORK_PARENT_READ_FD(HRN_FORK_PROCESS_IDX())); \
close(HRN_FORK_PARENT_WRITE_FD(HRN_FORK_PROCESS_IDX())); \
#define HRN_FORK_CHILD_END() \
if (HRN_FORK_PIPE_REQUIRED(HRN_FORK_PROCESS_IDX())) \
{ \
close(HRN_FORK_CHILD_READ()); \
close(HRN_FORK_CHILD_WRITE()); \
} \
/* Close child side of pipe */ \
close(HRN_FORK_CHILD_READ_FD()); \
close(HRN_FORK_CHILD_WRITE_FD()); \
\
exit(0); \
} \
@ -172,21 +159,17 @@ Process in the parent
{ \
for (unsigned int processIdx = 0; processIdx < HRN_FORK_PROCESS_TOTAL(); processIdx++) \
{ \
if (HRN_FORK_PIPE_REQUIRED(processIdx)) \
{ \
close(HRN_FORK_CHILD_READ_PROCESS(processIdx)); \
close(HRN_FORK_CHILD_WRITE_PROCESS(processIdx)); \
} \
/* Close child side of pipe */ \
close(HRN_FORK_PIPE(processIdx)[1][0]); \
close(HRN_FORK_PIPE(processIdx)[0][1]); \
}
#define HRN_FORK_PARENT_END() \
for (unsigned int processIdx = 0; processIdx < HRN_FORK_PROCESS_TOTAL(); processIdx++) \
{ \
if (HRN_FORK_PIPE_REQUIRED(processIdx)) \
{ \
close(HRN_FORK_PARENT_READ_PROCESS(processIdx)); \
close(HRN_FORK_PARENT_WRITE_PROCESS(processIdx)); \
} \
/* Close parent side of pipe */ \
close(HRN_FORK_PARENT_READ_FD(processIdx)); \
close(HRN_FORK_PARENT_WRITE_FD(processIdx)); \
} \
} \
while (0)

View File

@ -254,7 +254,7 @@ testRun(void)
// Check timeout by making the wal segment appear after 250ms
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, false)
HRN_FORK_CHILD_BEGIN()
{
sleepMSec(250);

View File

@ -733,10 +733,10 @@ testRun(void)
// Make sure the process times out when it can't get a lock
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
IoRead *read = ioFdReadNewOpen(STRDEF("child read"), HRN_FORK_CHILD_READ(), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("child write"), HRN_FORK_CHILD_WRITE(), 2000);
IoRead *read = ioFdReadNewOpen(STRDEF("child read"), HRN_FORK_CHILD_READ_FD(), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("child write"), HRN_FORK_CHILD_WRITE_FD(), 2000);
TEST_RESULT_VOID(
lockAcquire(
@ -755,8 +755,8 @@ testRun(void)
HRN_FORK_PARENT_BEGIN()
{
IoRead *read = ioFdReadNewOpen(STRDEF("parent read"), HRN_FORK_PARENT_READ_PROCESS(0), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("parent write"), HRN_FORK_PARENT_WRITE_PROCESS(0), 2000);
IoRead *read = ioFdReadNewOpen(STRDEF("parent read"), HRN_FORK_PARENT_READ_FD(0), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("parent write"), HRN_FORK_PARENT_WRITE_FD(0), 2000);
// Wait for the child to acquire the lock
ioReadLine(read);

View File

@ -711,10 +711,10 @@ testRun(void)
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
IoRead *read = ioFdReadNewOpen(STRDEF("child read"), HRN_FORK_CHILD_READ(), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("child write"), HRN_FORK_CHILD_WRITE(), 2000);
IoRead *read = ioFdReadNewOpen(STRDEF("child read"), HRN_FORK_CHILD_READ_FD(), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("child write"), HRN_FORK_CHILD_WRITE_FD(), 2000);
lockAcquire(
cfgOptionStr(cfgOptLockPath), cfgOptionStr(cfgOptStanza), STRDEF("555-fefefefe"), cfgLockType(), 30000, true);
@ -730,8 +730,8 @@ testRun(void)
HRN_FORK_PARENT_BEGIN()
{
IoRead *read = ioFdReadNewOpen(STRDEF("parent read"), HRN_FORK_PARENT_READ_PROCESS(0), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("parent write"), HRN_FORK_PARENT_WRITE_PROCESS(0), 2000);
IoRead *read = ioFdReadNewOpen(STRDEF("parent read"), HRN_FORK_PARENT_READ_FD(0), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("parent write"), HRN_FORK_PARENT_WRITE_FD(0), 2000);
// Wait for the child to acquire the lock
ioReadLine(read);

View File

@ -162,10 +162,10 @@ testRun(void)
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
IoRead *read = ioFdReadNewOpen(STRDEF("child read"), HRN_FORK_CHILD_READ(), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("child write"), HRN_FORK_CHILD_WRITE(), 2000);
IoRead *read = ioFdReadNewOpen(STRDEF("child read"), HRN_FORK_CHILD_READ_FD(), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("child write"), HRN_FORK_CHILD_WRITE_FD(), 2000);
int lockFd = open(HRN_PATH "/lock/empty" LOCK_FILE_EXT, O_RDONLY, 0);
TEST_RESULT_BOOL(lockFd != -1, true, "file descriptor acquired");
@ -185,8 +185,8 @@ testRun(void)
HRN_FORK_PARENT_BEGIN()
{
IoRead *read = ioFdReadNewOpen(STRDEF("parent read"), HRN_FORK_PARENT_READ_PROCESS(0), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("parent write"), HRN_FORK_PARENT_WRITE_PROCESS(0), 2000);
IoRead *read = ioFdReadNewOpen(STRDEF("parent read"), HRN_FORK_PARENT_READ_FD(0), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("parent write"), HRN_FORK_PARENT_WRITE_FD(0), 2000);
// Wait for the child to acquire the lock
ioReadLine(read);
@ -212,10 +212,10 @@ testRun(void)
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
IoRead *read = ioFdReadNewOpen(STRDEF("child read"), HRN_FORK_CHILD_READ(), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("child write"), HRN_FORK_CHILD_WRITE(), 2000);
IoRead *read = ioFdReadNewOpen(STRDEF("child read"), HRN_FORK_CHILD_READ_FD(), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("child write"), HRN_FORK_CHILD_WRITE_FD(), 2000);
int lockFd = open(HRN_PATH "/lock/empty" LOCK_FILE_EXT, O_RDONLY, 0);
TEST_RESULT_BOOL(lockFd != -1, true, "file descriptor acquired");
@ -235,8 +235,8 @@ testRun(void)
HRN_FORK_PARENT_BEGIN()
{
IoRead *read = ioFdReadNewOpen(STRDEF("parent read"), HRN_FORK_PARENT_READ_PROCESS(0), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("parent write"), HRN_FORK_PARENT_WRITE_PROCESS(0), 2000);
IoRead *read = ioFdReadNewOpen(STRDEF("parent read"), HRN_FORK_PARENT_READ_FD(0), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("parent write"), HRN_FORK_PARENT_WRITE_FD(0), 2000);
// Wait for the child to acquire the lock
ioReadLine(read);
@ -260,10 +260,10 @@ testRun(void)
HRN_STORAGE_REMOVE(hrnStorage, "lock/db" STOP_FILE_EXT, .errorOnMissing = true, .comment = "remove stanza stop file");
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
IoRead *read = ioFdReadNewOpen(STRDEF("child read"), HRN_FORK_CHILD_READ(), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("child write"), HRN_FORK_CHILD_WRITE(), 2000);
IoRead *read = ioFdReadNewOpen(STRDEF("child read"), HRN_FORK_CHILD_READ_FD(), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("child write"), HRN_FORK_CHILD_WRITE_FD(), 2000);
TEST_RESULT_BOOL(
lockAcquire(STRDEF(HRN_PATH "/lock"), cfgOptionStr(cfgOptStanza), cfgOptionStr(cfgOptExecId), 0, 30000, true),
@ -280,7 +280,7 @@ testRun(void)
HRN_FORK_PARENT_BEGIN()
{
IoRead *read = ioFdReadNewOpen(STRDEF("parent read"), HRN_FORK_PARENT_READ_PROCESS(0), 2000);
IoRead *read = ioFdReadNewOpen(STRDEF("parent read"), HRN_FORK_PARENT_READ_FD(0), 2000);
// Wait for the child to acquire the lock
ioReadLine(read);
@ -302,10 +302,10 @@ testRun(void)
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
IoRead *read = ioFdReadNewOpen(STRDEF("child read"), HRN_FORK_CHILD_READ(), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("child write"), HRN_FORK_CHILD_WRITE(), 2000);
IoRead *read = ioFdReadNewOpen(STRDEF("child read"), HRN_FORK_CHILD_READ_FD(), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("child write"), HRN_FORK_CHILD_WRITE_FD(), 2000);
int lockFd = open(HRN_PATH "/lock/badpid" LOCK_FILE_EXT, O_RDONLY, 0);
TEST_RESULT_BOOL(lockFd != -1, true, "file descriptor acquired");
@ -326,8 +326,8 @@ testRun(void)
HRN_FORK_PARENT_BEGIN()
{
IoRead *read = ioFdReadNewOpen(STRDEF("parent read"), HRN_FORK_PARENT_READ_PROCESS(0), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("parent write"), HRN_FORK_PARENT_WRITE_PROCESS(0), 2000);
IoRead *read = ioFdReadNewOpen(STRDEF("parent read"), HRN_FORK_PARENT_READ_FD(0), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("parent write"), HRN_FORK_PARENT_WRITE_FD(0), 2000);
// Wait for the child to acquire the lock
ioReadLine(read);

View File

@ -228,7 +228,7 @@ testRun(void)
// backup.info. Execute while a backup lock is held.
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, false)
HRN_FORK_CHILD_BEGIN()
{
TEST_RESULT_INT_NE(
lockAcquire(cfgOptionStr(cfgOptLockPath), STRDEF("stanza1"), STRDEF("999-ffffffff"), lockTypeBackup, 0, true),
@ -411,7 +411,7 @@ testRun(void)
// Execute while a backup lock is held
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, false)
HRN_FORK_CHILD_BEGIN()
{
TEST_RESULT_INT_NE(
lockAcquire(cfgOptionStr(cfgOptLockPath), STRDEF("stanza1"), STRDEF("777-afafafaf"), lockTypeBackup, 0, true),
@ -991,7 +991,7 @@ testRun(void)
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, false)
HRN_FORK_CHILD_BEGIN()
{
TEST_RESULT_INT_NE(
lockAcquire(cfgOptionStr(cfgOptLockPath), STRDEF("stanza2"), STRDEF("999-ffffffff"), lockTypeBackup, 0, true),
@ -1409,7 +1409,7 @@ testRun(void)
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, false)
HRN_FORK_CHILD_BEGIN()
{
TEST_RESULT_INT_NE(
lockAcquire(cfgOptionStr(cfgOptLockPath), STRDEF("stanza2"), STRDEF("999-ffffffff"), lockTypeBackup, 0, true),

View File

@ -28,7 +28,7 @@ testRun(void)
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
StringList *argList = strLstNew();
strLstAddZ(argList, "--stanza=test1");
@ -37,7 +37,7 @@ testRun(void)
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .role = cfgCmdRoleLocal);
cmdLocal(HRN_FORK_CHILD_READ(), HRN_FORK_CHILD_WRITE());
cmdLocal(HRN_FORK_CHILD_READ_FD(), HRN_FORK_CHILD_WRITE_FD());
}
HRN_FORK_CHILD_END();
@ -45,8 +45,8 @@ testRun(void)
{
ProtocolClient *client = protocolClientNew(
STRDEF("test"), PROTOCOL_SERVICE_LOCAL_STR,
ioFdReadNewOpen(STRDEF("server read"), HRN_FORK_PARENT_READ_PROCESS(0), 2000),
ioFdWriteNewOpen(STRDEF("server write"), HRN_FORK_PARENT_WRITE_PROCESS(0), 2000));
ioFdReadNewOpen(STRDEF("server read"), HRN_FORK_PARENT_READ_FD(0), 2000),
ioFdWriteNewOpen(STRDEF("server write"), HRN_FORK_PARENT_WRITE_FD(0), 2000));
protocolClientNoOp(client);
protocolClientFree(client);
}

View File

@ -29,7 +29,7 @@ testRun(void)
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
StringList *argList = strLstNew();
strLstAddZ(argList, "--stanza=test1");
@ -37,7 +37,7 @@ testRun(void)
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
HRN_CFG_LOAD(cfgCmdInfo, argList, .role = cfgCmdRoleRemote);
cmdRemote(HRN_FORK_CHILD_READ(), HRN_FORK_CHILD_WRITE());
cmdRemote(HRN_FORK_CHILD_READ_FD(), HRN_FORK_CHILD_WRITE_FD());
}
HRN_FORK_CHILD_END();
@ -45,8 +45,8 @@ testRun(void)
{
ProtocolClient *client = protocolClientNew(
STRDEF("test"), PROTOCOL_SERVICE_REMOTE_STR,
ioFdReadNewOpen(STRDEF("server read"), HRN_FORK_PARENT_READ_PROCESS(0), 2000),
ioFdWriteNewOpen(STRDEF("server write"), HRN_FORK_PARENT_WRITE_PROCESS(0), 2000));
ioFdReadNewOpen(STRDEF("server read"), HRN_FORK_PARENT_READ_FD(0), 2000),
ioFdWriteNewOpen(STRDEF("server write"), HRN_FORK_PARENT_WRITE_FD(0), 2000));
protocolClientNoOp(client);
protocolClientFree(client);
}
@ -59,7 +59,7 @@ testRun(void)
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
StringList *argList = strLstNew();
strLstAddZ(argList, "--process=0");
@ -69,7 +69,7 @@ testRun(void)
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .role = cfgCmdRoleRemote, .noStd = true);
cmdRemote(HRN_FORK_CHILD_READ(), HRN_FORK_CHILD_WRITE());
cmdRemote(HRN_FORK_CHILD_READ_FD(), HRN_FORK_CHILD_WRITE_FD());
}
HRN_FORK_CHILD_END();
@ -79,8 +79,8 @@ testRun(void)
TEST_ASSIGN(
client,
protocolClientNew(STRDEF("test"), PROTOCOL_SERVICE_REMOTE_STR,
ioFdReadNewOpen(STRDEF("server read"), HRN_FORK_PARENT_READ_PROCESS(0), 2000),
ioFdWriteNewOpen(STRDEF("server write"), HRN_FORK_PARENT_WRITE_PROCESS(0), 2000)),
ioFdReadNewOpen(STRDEF("server read"), HRN_FORK_PARENT_READ_FD(0), 2000),
ioFdWriteNewOpen(STRDEF("server write"), HRN_FORK_PARENT_WRITE_FD(0), 2000)),
"create client");
protocolClientNoOp(client);
protocolClientFree(client);
@ -94,7 +94,7 @@ testRun(void)
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
StringList *argList = strLstNew();
strLstAddZ(argList, "--stanza=test");
@ -103,7 +103,7 @@ testRun(void)
strLstAddZ(argList, "--lock-path=/bogus");
HRN_CFG_LOAD(cfgCmdArchivePush, argList, .role = cfgCmdRoleRemote, .noStd = true);
cmdRemote(HRN_FORK_CHILD_READ(), HRN_FORK_CHILD_WRITE());
cmdRemote(HRN_FORK_CHILD_READ_FD(), HRN_FORK_CHILD_WRITE_FD());
}
HRN_FORK_CHILD_END();
@ -112,8 +112,8 @@ testRun(void)
TEST_ERROR(
protocolClientNew(
STRDEF("test"), PROTOCOL_SERVICE_REMOTE_STR,
ioFdReadNewOpen(STRDEF("server read"), HRN_FORK_PARENT_READ_PROCESS(0), 2000),
ioFdWriteNewOpen(STRDEF("server write"), HRN_FORK_PARENT_WRITE_PROCESS(0), 2000)),
ioFdReadNewOpen(STRDEF("server read"), HRN_FORK_PARENT_READ_FD(0), 2000),
ioFdWriteNewOpen(STRDEF("server write"), HRN_FORK_PARENT_WRITE_FD(0), 2000)),
PathCreateError, "raised from test: unable to create path '/bogus': [13] Permission denied");
}
HRN_FORK_PARENT_END();
@ -125,7 +125,7 @@ testRun(void)
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
StringList *argList = strLstNew();
strLstAddZ(argList, "--stanza=test");
@ -134,7 +134,7 @@ testRun(void)
hrnCfgArgRawZ(argList, cfgOptRepo, "1");
HRN_CFG_LOAD(cfgCmdArchivePush, argList, .role = cfgCmdRoleRemote);
cmdRemote(HRN_FORK_CHILD_READ(), HRN_FORK_CHILD_WRITE());
cmdRemote(HRN_FORK_CHILD_READ_FD(), HRN_FORK_CHILD_WRITE_FD());
}
HRN_FORK_CHILD_END();
@ -145,8 +145,8 @@ testRun(void)
client,
protocolClientNew(
STRDEF("test"), PROTOCOL_SERVICE_REMOTE_STR,
ioFdReadNewOpen(STRDEF("server read"), HRN_FORK_PARENT_READ_PROCESS(0), 2000),
ioFdWriteNewOpen(STRDEF("server write"), HRN_FORK_PARENT_WRITE_PROCESS(0), 2000)),
ioFdReadNewOpen(STRDEF("server read"), HRN_FORK_PARENT_READ_FD(0), 2000),
ioFdWriteNewOpen(STRDEF("server write"), HRN_FORK_PARENT_WRITE_FD(0), 2000)),
"create client");
protocolClientNoOp(client);
@ -165,7 +165,7 @@ testRun(void)
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
StringList *argList = strLstNew();
strLstAddZ(argList, "--stanza=test");
@ -173,7 +173,7 @@ testRun(void)
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
HRN_CFG_LOAD(cfgCmdArchivePush, argList, .role = cfgCmdRoleRemote);
cmdRemote(HRN_FORK_CHILD_READ(), HRN_FORK_CHILD_WRITE());
cmdRemote(HRN_FORK_CHILD_READ_FD(), HRN_FORK_CHILD_WRITE_FD());
}
HRN_FORK_CHILD_END();
@ -184,8 +184,8 @@ testRun(void)
TEST_ERROR(
protocolClientNew(
STRDEF("test"), PROTOCOL_SERVICE_REMOTE_STR,
ioFdReadNewOpen(STRDEF("server read"), HRN_FORK_PARENT_READ_PROCESS(0), 2000),
ioFdWriteNewOpen(STRDEF("server write"), HRN_FORK_PARENT_WRITE_PROCESS(0), 2000)),
ioFdReadNewOpen(STRDEF("server read"), HRN_FORK_PARENT_READ_FD(0), 2000),
ioFdWriteNewOpen(STRDEF("server write"), HRN_FORK_PARENT_WRITE_FD(0), 2000)),
StopError, "raised from test: stop file exists for all stanzas");
storageRemoveP(hrnStorage, STRDEF("lock/all" STOP_FILE_EXT));

View File

@ -380,7 +380,7 @@ testRun(void)
// Test in a fork so the process does not actually exit
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(UnhandledError.code, false)
HRN_FORK_CHILD_BEGIN(.expectedExitStatus = UnhandledError.code)
{
THROW(TestChildError, "does not get caught!");
}

View File

@ -70,7 +70,7 @@ testRun(void)
// -------------------------------------------------------------------------------------------------------------------------
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, false)
HRN_FORK_CHILD_BEGIN()
{
// This is not really fd max but for the purposes of testing is fine -- we won't have more than 64 fds open
for (int fd = 0; fd < 64; fd++)

View File

@ -34,7 +34,7 @@ testRun(void)
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(errorTypeCode(&TermError), false)
HRN_FORK_CHILD_BEGIN(.expectedExitStatus = errorTypeCode(&TermError))
{
exitInit();
raise(SIGTERM);

View File

@ -18,7 +18,7 @@ testRun(void)
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, false)
HRN_FORK_CHILD_BEGIN()
{
char buffer[1024];

View File

@ -281,12 +281,12 @@ testRun(void)
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
// Start HTTP test server
TEST_RESULT_VOID(
hrnServerRunP(
ioFdReadNew(STRDEF("test server read"), HRN_FORK_CHILD_READ(), 5000), hrnServerProtocolSocket),
ioFdReadNew(STRDEF("test server read"), HRN_FORK_CHILD_READ_FD(), 5000), hrnServerProtocolSocket),
"http server run");
}
HRN_FORK_CHILD_END();
@ -294,7 +294,7 @@ testRun(void)
HRN_FORK_PARENT_BEGIN()
{
IoWrite *http = hrnServerScriptBegin(
ioFdWriteNew(STRDEF("test client write"), HRN_FORK_PARENT_WRITE_PROCESS(0), 2000));
ioFdWriteNew(STRDEF("test client write"), HRN_FORK_PARENT_WRITE_FD(0), 2000));
// -----------------------------------------------------------------------------------------------------------------
TEST_TITLE("create client");

View File

@ -539,11 +539,11 @@ testRun(void)
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
IoWrite *write = NULL;
TEST_ASSIGN(write, ioFdWriteNewOpen(STRDEF("write test"), HRN_FORK_CHILD_WRITE(), 1000), "move write");
TEST_ASSIGN(write, ioFdWriteNewOpen(STRDEF("write test"), HRN_FORK_CHILD_WRITE_FD(), 1000), "move write");
TEST_RESULT_BOOL(ioWriteReadyP(write), true, "write is ready");
TEST_RESULT_INT(ioWriteFd(write), ((IoFdWrite *)write->driver)->fd, "check write fd");
@ -567,7 +567,7 @@ testRun(void)
HRN_FORK_PARENT_BEGIN()
{
IoRead *read = ioFdReadNewOpen(STRDEF("read test"), HRN_FORK_PARENT_READ_PROCESS(0), 1000);
IoRead *read = ioFdReadNewOpen(STRDEF("read test"), HRN_FORK_PARENT_READ_FD(0), 1000);
TEST_RESULT_INT(ioReadFd(read), ((IoFdRead *)ioReadDriver(read))->fd, "check fd");
TEST_RESULT_PTR(ioReadInterface(read), &read->pub.interface, "check interface");

View File

@ -247,12 +247,12 @@ testRun(void)
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
// Start server to test various certificate errors
TEST_RESULT_VOID(
hrnServerRunP(
ioFdReadNew(STRDEF("test server read"), HRN_FORK_CHILD_READ(), 5000), hrnServerProtocolTls,
ioFdReadNew(STRDEF("test server read"), HRN_FORK_CHILD_READ_FD(), 5000), hrnServerProtocolTls,
.certificate = STRDEF(HRN_PATH_REPO "/" HRN_SERVER_CERT_PREFIX "-alt-name.crt"),
.key = STRDEF(HRN_PATH_REPO "/" HRN_SERVER_CERT_PREFIX ".key")),
"tls alt name server run");
@ -262,7 +262,7 @@ testRun(void)
HRN_FORK_PARENT_BEGIN()
{
IoWrite *tls = hrnServerScriptBegin(
ioFdWriteNew(STRDEF("test client write"), HRN_FORK_PARENT_WRITE_PROCESS(0), 1000));
ioFdWriteNew(STRDEF("test client write"), HRN_FORK_PARENT_WRITE_FD(0), 1000));
// -----------------------------------------------------------------------------------------------------------------
TEST_TITLE("certificate error on invalid ca path");
@ -365,11 +365,11 @@ testRun(void)
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
TEST_RESULT_VOID(
hrnServerRunP(
ioFdReadNew(STRDEF("test server read"), HRN_FORK_CHILD_READ(), 5000), hrnServerProtocolTls),
ioFdReadNew(STRDEF("test server read"), HRN_FORK_CHILD_READ_FD(), 5000), hrnServerProtocolTls),
"tls server run");
}
HRN_FORK_CHILD_END();
@ -377,7 +377,7 @@ testRun(void)
HRN_FORK_PARENT_BEGIN()
{
IoWrite *tls =
hrnServerScriptBegin(ioFdWriteNew(STRDEF("test client write"), HRN_FORK_PARENT_WRITE_PROCESS(0), 1000));
hrnServerScriptBegin(ioFdWriteNew(STRDEF("test client write"), HRN_FORK_PARENT_WRITE_FD(0), 1000));
ioBufferSizeSet(12);
TEST_ASSIGN(

View File

@ -93,7 +93,7 @@ testRun(void)
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, false)
HRN_FORK_CHILD_BEGIN()
{
TEST_RESULT_INT_NE(lockAcquireFile(backupLock, STRDEF("1-test"), 0, true), -1, "lock on fork");
sleepMSec(500);

View File

@ -22,7 +22,7 @@ testRun(void)
{
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
StringList *argList = strLstNew();
strLstAddZ(argList, "--stanza=test1");
@ -32,8 +32,8 @@ testRun(void)
HRN_CFG_LOAD(cfgCmdArchiveGet, argList);
ProtocolServer *server = protocolServerNew(
STRDEF("test"), STRDEF("config"), ioFdReadNewOpen(STRDEF("client read"), HRN_FORK_CHILD_READ(), 2000),
ioFdWriteNewOpen(STRDEF("client write"), HRN_FORK_CHILD_WRITE(), 2000));
STRDEF("test"), STRDEF("config"), ioFdReadNewOpen(STRDEF("client read"), HRN_FORK_CHILD_READ_FD(), 2000),
ioFdWriteNewOpen(STRDEF("client write"), HRN_FORK_CHILD_WRITE_FD(), 2000));
static const ProtocolServerHandler commandHandler[] = {PROTOCOL_SERVER_HANDLER_OPTION_LIST};
protocolServerProcess(server, NULL, commandHandler, PROTOCOL_SERVER_HANDLER_LIST_SIZE(commandHandler));
@ -44,8 +44,8 @@ testRun(void)
{
ProtocolClient *client = protocolClientNew(
STRDEF("test"), STRDEF("config"),
ioFdReadNewOpen(STRDEF("server read"), HRN_FORK_PARENT_READ_PROCESS(0), 2000),
ioFdWriteNewOpen(STRDEF("server write"), HRN_FORK_PARENT_WRITE_PROCESS(0), 2000));
ioFdReadNewOpen(STRDEF("server read"), HRN_FORK_PARENT_READ_FD(0), 2000),
ioFdWriteNewOpen(STRDEF("server write"), HRN_FORK_PARENT_WRITE_FD(0), 2000));
VariantList *list = varLstNew();
varLstAdd(list, varNewStr(STRDEF("repo1-host")));

View File

@ -61,7 +61,7 @@ testRun(void)
{
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
// Set options
StringList *argList = strLstNew();
@ -98,8 +98,8 @@ testRun(void)
server,
protocolServerNew(
STRDEF("db test server"), STRDEF("test"),
ioFdReadNewOpen(STRDEF("client read"), HRN_FORK_CHILD_READ(), 2000),
ioFdWriteNewOpen(STRDEF("client write"), HRN_FORK_CHILD_WRITE(), 2000)),
ioFdReadNewOpen(STRDEF("client read"), HRN_FORK_CHILD_READ_FD(), 2000),
ioFdWriteNewOpen(STRDEF("client write"), HRN_FORK_CHILD_WRITE_FD(), 2000)),
"create server");
static const ProtocolServerHandler commandHandler[] = {PROTOCOL_SERVER_HANDLER_DB_LIST};
@ -121,8 +121,8 @@ testRun(void)
client,
protocolClientNew(
STRDEF("db test client"), STRDEF("test"),
ioFdReadNewOpen(STRDEF("server read"), HRN_FORK_PARENT_READ_PROCESS(0), 2000),
ioFdWriteNewOpen(STRDEF("server write"), HRN_FORK_PARENT_WRITE_PROCESS(0), 2000)),
ioFdReadNewOpen(STRDEF("server read"), HRN_FORK_PARENT_READ_FD(0), 2000),
ioFdWriteNewOpen(STRDEF("server write"), HRN_FORK_PARENT_WRITE_FD(0), 2000)),
"create client");
TRY_BEGIN()

View File

@ -149,7 +149,7 @@ testRun(void)
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
// Create a basic configuration so the remote storage driver can determine the storage type
StringList *argList = strLstNew();
@ -174,8 +174,8 @@ 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(), 60000),
ioFdWriteNewOpen(STRDEF("storage server write"), HRN_FORK_CHILD_WRITE(), 1000));
ioFdReadNewOpen(STRDEF("storage server read"), HRN_FORK_CHILD_READ_FD(), 60000),
ioFdWriteNewOpen(STRDEF("storage server write"), HRN_FORK_CHILD_WRITE_FD(), 1000));
static const ProtocolServerHandler commandHandler[] = {PROTOCOL_SERVER_HANDLER_STORAGE_REMOTE_LIST};
protocolServerProcess(server, NULL, commandHandler, PROTOCOL_SERVER_HANDLER_LIST_SIZE(commandHandler));
@ -188,8 +188,8 @@ testRun(void)
// Create client
ProtocolClient *client = protocolClientNew(
STRDEF("storage test client"), STRDEF("test"),
ioFdReadNewOpen(STRDEF("storage client read"), HRN_FORK_PARENT_READ_PROCESS(0), 60000),
ioFdWriteNewOpen(STRDEF("storage client write"), HRN_FORK_PARENT_WRITE_PROCESS(0), 1000));
ioFdReadNewOpen(STRDEF("storage client read"), HRN_FORK_PARENT_READ_FD(0), 60000),
ioFdWriteNewOpen(STRDEF("storage client write"), HRN_FORK_PARENT_WRITE_FD(0), 1000));
// Create remote storage
Storage *storageRemote = storageRemoteNew(

View File

@ -435,10 +435,10 @@ testRun(void)
{
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
IoRead *read = ioFdReadNewOpen(STRDEF("server read"), HRN_FORK_CHILD_READ(), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("server write"), HRN_FORK_CHILD_WRITE(), 2000);
IoRead *read = ioFdReadNewOpen(STRDEF("server read"), HRN_FORK_CHILD_READ_FD(), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("server write"), HRN_FORK_CHILD_WRITE_FD(), 2000);
// Various bogus greetings
// -----------------------------------------------------------------------------------------------------------------
@ -492,8 +492,8 @@ testRun(void)
HRN_FORK_PARENT_BEGIN()
{
IoRead *read = ioFdReadNewOpen(STRDEF("client read"), HRN_FORK_PARENT_READ_PROCESS(0), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("client write"), HRN_FORK_PARENT_WRITE_PROCESS(0), 2000);
IoRead *read = ioFdReadNewOpen(STRDEF("client read"), HRN_FORK_PARENT_READ_FD(0), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("client write"), HRN_FORK_PARENT_WRITE_FD(0), 2000);
// -----------------------------------------------------------------------------------------------------------------
TEST_TITLE("bogus greetings");
@ -659,15 +659,15 @@ testRun(void)
HRN_FORK_BEGIN()
{
// Local 1
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
ProtocolServer *server = NULL;
TEST_ASSIGN(
server,
protocolServerNew(
STRDEF("local server 1"), STRDEF("test"),
ioFdReadNewOpen(STRDEF("local server 1 read"), HRN_FORK_CHILD_READ(), 10000),
ioFdWriteNewOpen(STRDEF("local server 1 write"), HRN_FORK_CHILD_WRITE(), 2000)),
ioFdReadNewOpen(STRDEF("local server 1 read"), HRN_FORK_CHILD_READ_FD(), 10000),
ioFdWriteNewOpen(STRDEF("local server 1 write"), HRN_FORK_CHILD_WRITE_FD(), 2000)),
"local server 1");
TEST_RESULT_UINT(protocolServerCommandGet(server).id, PROTOCOL_COMMAND_NOOP, "noop command get");
@ -687,15 +687,15 @@ testRun(void)
HRN_FORK_CHILD_END();
// Local 2
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
ProtocolServer *server = NULL;
TEST_ASSIGN(
server,
protocolServerNew(
STRDEF("local server 2"), STRDEF("test"),
ioFdReadNewOpen(STRDEF("local server 2 read"), HRN_FORK_CHILD_READ(), 10000),
ioFdWriteNewOpen(STRDEF("local server 2 write"), HRN_FORK_CHILD_WRITE(), 2000)),
ioFdReadNewOpen(STRDEF("local server 2 read"), HRN_FORK_CHILD_READ_FD(), 10000),
ioFdWriteNewOpen(STRDEF("local server 2 write"), HRN_FORK_CHILD_WRITE_FD(), 2000)),
"local server 2");
TEST_RESULT_UINT(protocolServerCommandGet(server).id, PROTOCOL_COMMAND_NOOP, "noop command get");
@ -736,9 +736,9 @@ testRun(void)
protocolClientNew(
strNewFmt("local client %u", clientIdx), STRDEF("test"),
ioFdReadNewOpen(
strNewFmt("local client %u read", clientIdx), HRN_FORK_PARENT_READ_PROCESS(clientIdx), 2000),
strNewFmt("local client %u read", clientIdx), HRN_FORK_PARENT_READ_FD(clientIdx), 2000),
ioFdWriteNewOpen(
strNewFmt("local client %u write", clientIdx), HRN_FORK_PARENT_WRITE_PROCESS(clientIdx), 2000)),
strNewFmt("local client %u write", clientIdx), HRN_FORK_PARENT_WRITE_FD(clientIdx), 2000)),
strZ(strNewFmt("local client %u new", clientIdx)));
TEST_RESULT_VOID(
protocolParallelClientAdd(parallel, client[clientIdx]), strZ(strNewFmt("local client %u add", clientIdx)));

View File

@ -267,10 +267,10 @@ testRun(void)
{
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
TEST_RESULT_VOID(
hrnServerRunP(ioFdReadNew(STRDEF("azure server read"), HRN_FORK_CHILD_READ(), 5000), hrnServerProtocolTls),
hrnServerRunP(ioFdReadNew(STRDEF("azure server read"), HRN_FORK_CHILD_READ_FD(), 5000), hrnServerProtocolTls),
"azure server run");
}
HRN_FORK_CHILD_END();
@ -278,7 +278,7 @@ testRun(void)
HRN_FORK_PARENT_BEGIN()
{
IoWrite *service = hrnServerScriptBegin(
ioFdWriteNew(STRDEF("azure client write"), HRN_FORK_PARENT_WRITE_PROCESS(0), 2000));
ioFdWriteNew(STRDEF("azure client write"), HRN_FORK_PARENT_WRITE_FD(0), 2000));
// -----------------------------------------------------------------------------------------------------------------
TEST_TITLE("test against local host");

View File

@ -279,31 +279,31 @@ testRun(void)
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
TEST_RESULT_VOID(
hrnServerRunP(
ioFdReadNew(STRDEF("gcs server read"), HRN_FORK_CHILD_READ(), 5000), hrnServerProtocolTls,
ioFdReadNew(STRDEF("gcs server read"), HRN_FORK_CHILD_READ_FD(), 5000), hrnServerProtocolTls,
.port = testPort),
"gcs server run");
}
HRN_FORK_CHILD_END();
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
TEST_RESULT_VOID(
hrnServerRunP(
ioFdReadNew(STRDEF("auth server read"), HRN_FORK_CHILD_READ(), 5000), hrnServerProtocolTls,
ioFdReadNew(STRDEF("auth server read"), HRN_FORK_CHILD_READ_FD(), 5000), hrnServerProtocolTls,
.port = testPortAuth),
"auth server run");
}
HRN_FORK_CHILD_END();
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
TEST_RESULT_VOID(
hrnServerRunP(
ioFdReadNew(STRDEF("meta server read"), HRN_FORK_CHILD_READ(), 10000), hrnServerProtocolSocket,
ioFdReadNew(STRDEF("meta server read"), HRN_FORK_CHILD_READ_FD(), 10000), hrnServerProtocolSocket,
.port = testPortMeta),
"meta server run");
}
@ -312,11 +312,11 @@ testRun(void)
HRN_FORK_PARENT_BEGIN()
{
IoWrite *service = hrnServerScriptBegin(
ioFdWriteNew(STRDEF("gcs client write"), HRN_FORK_PARENT_WRITE_PROCESS(0), 2000));
ioFdWriteNew(STRDEF("gcs client write"), HRN_FORK_PARENT_WRITE_FD(0), 2000));
IoWrite *auth = hrnServerScriptBegin(
ioFdWriteNew(STRDEF("auth client write"), HRN_FORK_PARENT_WRITE_PROCESS(1), 2000));
ioFdWriteNew(STRDEF("auth client write"), HRN_FORK_PARENT_WRITE_FD(1), 2000));
IoWrite *meta = hrnServerScriptBegin(
ioFdWriteNew(STRDEF("meta client write"), HRN_FORK_PARENT_WRITE_PROCESS(2), 2000));
ioFdWriteNew(STRDEF("meta client write"), HRN_FORK_PARENT_WRITE_FD(2), 2000));
// -----------------------------------------------------------------------------------------------------------------
TEST_TITLE("test service auth");

View File

@ -145,7 +145,7 @@ testRun(void)
// -------------------------------------------------------------------------------------------------------------------------
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, false)
HRN_FORK_CHILD_BEGIN()
{
sleepMSec(250);
HRN_SYSTEM_FMT("touch %s", strZ(fileExists));

View File

@ -353,20 +353,20 @@ testRun(void)
{
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
TEST_RESULT_VOID(
hrnServerRunP(
ioFdReadNew(STRDEF("s3 server read"), HRN_FORK_CHILD_READ(), 5000), hrnServerProtocolTls, .port = port),
ioFdReadNew(STRDEF("s3 server read"), HRN_FORK_CHILD_READ_FD(), 5000), hrnServerProtocolTls, .port = port),
"s3 server run");
}
HRN_FORK_CHILD_END();
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
TEST_RESULT_VOID(
hrnServerRunP(
ioFdReadNew(STRDEF("auth server read"), HRN_FORK_CHILD_READ(), 5000), hrnServerProtocolSocket,
ioFdReadNew(STRDEF("auth server read"), HRN_FORK_CHILD_READ_FD(), 5000), hrnServerProtocolSocket,
.port = authPort),
"auth server run");
}
@ -375,9 +375,9 @@ testRun(void)
HRN_FORK_PARENT_BEGIN()
{
IoWrite *service = hrnServerScriptBegin(
ioFdWriteNew(STRDEF("s3 client write"), HRN_FORK_PARENT_WRITE_PROCESS(0), 2000));
ioFdWriteNew(STRDEF("s3 client write"), HRN_FORK_PARENT_WRITE_FD(0), 2000));
IoWrite *auth = hrnServerScriptBegin(
ioFdWriteNew(STRDEF("auth client write"), HRN_FORK_PARENT_WRITE_PROCESS(1), 2000));
ioFdWriteNew(STRDEF("auth client write"), HRN_FORK_PARENT_WRITE_FD(1), 2000));
// -----------------------------------------------------------------------------------------------------------------
TEST_TITLE("config with keys, token, and host with custom port");