ENH: Extended test 0 to run the executable twice using the same process object. This tests the reusability of the objects.
This commit is contained in:
parent
7e7249cbd1
commit
3f14dae716
|
@ -31,7 +31,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int runChild(const char* cmd[], int state, int exception, int value,
|
int runChild(const char* cmd[], int state, int exception, int value,
|
||||||
int share, int output, int delay, double timeout, int poll);
|
int share, int output, int delay, double timeout, int poll,
|
||||||
|
int repeat);
|
||||||
|
|
||||||
int test1(int argc, const char* argv[])
|
int test1(int argc, const char* argv[])
|
||||||
{
|
{
|
||||||
|
@ -97,7 +98,7 @@ int test5(int argc, const char* argv[])
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
r = runChild(cmd, kwsysProcess_State_Exception,
|
r = runChild(cmd, kwsysProcess_State_Exception,
|
||||||
kwsysProcess_Exception_Fault, 1, 1, 1, 0, 15, 0);
|
kwsysProcess_Exception_Fault, 1, 1, 1, 0, 15, 0, 1);
|
||||||
fprintf(stdout, "Output on stdout after recursive test.\n");
|
fprintf(stdout, "Output on stdout after recursive test.\n");
|
||||||
fprintf(stderr, "Output on stderr after recursive test.\n");
|
fprintf(stderr, "Output on stderr after recursive test.\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
@ -150,7 +151,8 @@ int test7(int argc, const char* argv[])
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int runChild(const char* cmd[], int state, int exception, int value,
|
int runChild2(kwsysProcess* kp,
|
||||||
|
const char* cmd[], int state, int exception, int value,
|
||||||
int share, int output, int delay, double timeout,
|
int share, int output, int delay, double timeout,
|
||||||
int poll)
|
int poll)
|
||||||
{
|
{
|
||||||
|
@ -159,13 +161,6 @@ int runChild(const char* cmd[], int state, int exception, int value,
|
||||||
int length = 0;
|
int length = 0;
|
||||||
double userTimeout = 0;
|
double userTimeout = 0;
|
||||||
double* pUserTimeout = 0;
|
double* pUserTimeout = 0;
|
||||||
kwsysProcess* kp = kwsysProcess_New();
|
|
||||||
if(!kp)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "kwsysProcess_New returned NULL!\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
kwsysProcess_SetCommand(kp, cmd);
|
kwsysProcess_SetCommand(kp, cmd);
|
||||||
if(timeout >= 0)
|
if(timeout >= 0)
|
||||||
{
|
{
|
||||||
|
@ -289,6 +284,25 @@ int runChild(const char* cmd[], int state, int exception, int value,
|
||||||
result = 1;
|
result = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int runChild(const char* cmd[], int state, int exception, int value,
|
||||||
|
int share, int output, int delay, double timeout,
|
||||||
|
int poll, int repeat)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
kwsysProcess* kp = kwsysProcess_New();
|
||||||
|
if(!kp)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "kwsysProcess_New returned NULL!\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
while(repeat-- > 0)
|
||||||
|
{
|
||||||
|
result = runChild2(kp, cmd, state, exception, value, share,
|
||||||
|
output, delay, timeout, poll);
|
||||||
|
}
|
||||||
kwsysProcess_Delete(kp);
|
kwsysProcess_Delete(kp);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -369,6 +383,7 @@ int main(int argc, const char* argv[])
|
||||||
int delays[7] = {0, 0, 0, 0, 0, 1, 0};
|
int delays[7] = {0, 0, 0, 0, 0, 1, 0};
|
||||||
double timeouts[7] = {10, 10, 10, 10, 30, 10, -1};
|
double timeouts[7] = {10, 10, 10, 10, 30, 10, -1};
|
||||||
int polls[7] = {0, 0, 0, 0, 0, 0, 1};
|
int polls[7] = {0, 0, 0, 0, 0, 0, 1};
|
||||||
|
int repeat[7] = {2, 1, 1, 1, 1, 1, 1};
|
||||||
int r;
|
int r;
|
||||||
const char* cmd[4];
|
const char* cmd[4];
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -402,7 +417,7 @@ int main(int argc, const char* argv[])
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
r = runChild(cmd, states[n-1], exceptions[n-1], values[n-1], 0,
|
r = runChild(cmd, states[n-1], exceptions[n-1], values[n-1], 0,
|
||||||
outputs[n-1], delays[n-1], timeouts[n-1],
|
outputs[n-1], delays[n-1], timeouts[n-1],
|
||||||
polls[n-1]);
|
polls[n-1], repeat[n-1]);
|
||||||
fprintf(stdout, "Output on stdout after test %d.\n", n);
|
fprintf(stdout, "Output on stdout after test %d.\n", n);
|
||||||
fprintf(stderr, "Output on stderr after test %d.\n", n);
|
fprintf(stderr, "Output on stderr after test %d.\n", n);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
Loading…
Reference in New Issue