diff options
author | Brad King <brad.king@kitware.com> | 2006-01-05 20:49:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-01-05 20:49:34 (GMT) |
commit | bdbb7f84bc85c27aa49133f060e3407aa3990eea (patch) | |
tree | 597014e43d23ab827e7060a57bebb2f98637c232 | |
parent | b9c4cff45a8cc24ce4d18ba66d57b713be08ccfc (diff) | |
download | CMake-bdbb7f84bc85c27aa49133f060e3407aa3990eea.zip CMake-bdbb7f84bc85c27aa49133f060e3407aa3990eea.tar.gz CMake-bdbb7f84bc85c27aa49133f060e3407aa3990eea.tar.bz2 |
ENH: Added special test 0 to just run a given command line.
-rw-r--r-- | Source/kwsys/testProcess.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/Source/kwsys/testProcess.c b/Source/kwsys/testProcess.c index 9f58e66..96db251 100644 --- a/Source/kwsys/testProcess.c +++ b/Source/kwsys/testProcess.c @@ -330,18 +330,14 @@ int main(int argc, const char* argv[]) { n = atoi(argv[1]); } - else if(argc == 3) + else if(argc == 3 && strcmp(argv[1], "run") == 0) { n = atoi(argv[2]); } /* Check arguments. */ - if(n < 1 || n > 7 || (argc == 3 && strcmp(argv[1], "run") != 0)) - { - fprintf(stdout, "Usage: %s <test number>\n", argv[0]); - return 1; - } - if(argc == 3) + if(n >= 1 && n <= 7 && argc == 3) { + /* This is the child process for a requested test number. */ switch (n) { case 1: return test1(argc, argv); @@ -355,9 +351,9 @@ int main(int argc, const char* argv[]) fprintf(stderr, "Invalid test number %d.\n", n); return 1; } - - if(n >= 0 && n <= 7) + else if(n >= 1 && n <= 7) { + /* This is the parent process for a requested test number. */ int states[7] = { kwsysProcess_State_Exited, @@ -427,9 +423,22 @@ int main(int argc, const char* argv[]) #endif 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 { - fprintf(stderr, "Test number out of range\n"); + /* Improper usage. */ + fprintf(stdout, "Usage: %s <test number>\n", argv[0]); return 1; - } + } } |