Skip to content
Snippets Groups Projects
Commit d5363c6a authored by Brad King's avatar Brad King
Browse files

ENH: Added special test 0 to just run a given command line.

parent 646c2011
No related branches found
No related tags found
No related merge requests found
...@@ -330,18 +330,14 @@ int main(int argc, const char* argv[]) ...@@ -330,18 +330,14 @@ int main(int argc, const char* argv[])
{ {
n = atoi(argv[1]); n = atoi(argv[1]);
} }
else if(argc == 3) else if(argc == 3 && strcmp(argv[1], "run") == 0)
{ {
n = atoi(argv[2]); n = atoi(argv[2]);
} }
/* Check arguments. */ /* Check arguments. */
if(n < 1 || n > 7 || (argc == 3 && strcmp(argv[1], "run") != 0)) if(n >= 1 && n <= 7 && argc == 3)
{
fprintf(stdout, "Usage: %s <test number>\n", argv[0]);
return 1;
}
if(argc == 3)
{ {
/* This is the child process for a requested test number. */
switch (n) switch (n)
{ {
case 1: return test1(argc, argv); case 1: return test1(argc, argv);
...@@ -355,9 +351,9 @@ int main(int argc, const char* argv[]) ...@@ -355,9 +351,9 @@ int main(int argc, const char* argv[])
fprintf(stderr, "Invalid test number %d.\n", n); fprintf(stderr, "Invalid test number %d.\n", n);
return 1; return 1;
} }
else if(n >= 1 && n <= 7)
if(n >= 0 && n <= 7)
{ {
/* This is the parent process for a requested test number. */
int states[7] = int states[7] =
{ {
kwsysProcess_State_Exited, kwsysProcess_State_Exited,
...@@ -427,9 +423,22 @@ int main(int argc, const char* argv[]) ...@@ -427,9 +423,22 @@ int main(int argc, const char* argv[])
#endif #endif
return r; return r;
} }
else if(argc > 2 && strcmp(argv[1], "0") == 0)
{
/* This is the special debugging test to run a given command
line. */
const char** cmd = argv+2;
int state = kwsysProcess_State_Exited;
int exception = kwsysProcess_Exception_None;
int value = 0;
double timeout = 0;
int r = runChild(cmd, state, exception, value, 0, 1, 0, timeout, 0, 1);
return r;
}
else else
{ {
fprintf(stderr, "Test number out of range\n"); /* Improper usage. */
fprintf(stdout, "Usage: %s <test number>\n", argv[0]);
return 1; return 1;
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment