summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/testProcess.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2004-09-30 21:42:42 (GMT)
committerBrad King <brad.king@kitware.com>2004-09-30 21:42:42 (GMT)
commitf2e46cf1729a012e5fc6d59d6ef6b2d5226dc52b (patch)
treef2b0c8da64e169b3f785965a0660ae56dc70975f /Source/kwsys/testProcess.c
parent77209d371f8bad1deffd702b066967927b89a3b4 (diff)
downloadCMake-f2e46cf1729a012e5fc6d59d6ef6b2d5226dc52b.zip
CMake-f2e46cf1729a012e5fc6d59d6ef6b2d5226dc52b.tar.gz
CMake-f2e46cf1729a012e5fc6d59d6ef6b2d5226dc52b.tar.bz2
ENH: Added optional display of output for tests. Avoid printing alot of output for test 6.
Diffstat (limited to 'Source/kwsys/testProcess.c')
-rw-r--r--Source/kwsys/testProcess.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/Source/kwsys/testProcess.c b/Source/kwsys/testProcess.c
index 0a1f777..ef04268 100644
--- a/Source/kwsys/testProcess.c
+++ b/Source/kwsys/testProcess.c
@@ -22,7 +22,7 @@
#endif
int runChild(const char* cmd[], int state, int exception, int value,
- int share, int delay, double timeout);
+ int share, int output, int delay, double timeout);
int test1(int argc, const char* argv[])
{
@@ -84,7 +84,7 @@ int test5(int argc, const char* argv[])
fflush(stdout);
fflush(stderr);
r = runChild(cmd, kwsysProcess_State_Exception,
- kwsysProcess_Exception_Fault, 1, 1, 0, 2);
+ kwsysProcess_Exception_Fault, 1, 1, 1, 0, 2);
fprintf(stdout, "Output on stdout after recursive test.\n");
fprintf(stderr, "Output on stderr after recursive test.\n");
fflush(stdout);
@@ -115,7 +115,7 @@ int test6(int argc, const char* argv[])
int runChild(const char* cmd[], int state, int exception, int value,
- int share, int delay, double timeout)
+ int share, int output, int delay, double timeout)
{
int result = 0;
char* data = 0;
@@ -140,10 +140,14 @@ int runChild(const char* cmd[], int state, int exception, int value,
{
while(kwsysProcess_WaitForData(kp, &data, &length, 0))
{
- fwrite(data, 1, length, stdout);
- fflush(stdout);
+ if(output)
+ {
+ fwrite(data, 1, length, stdout);
+ fflush(stdout);
+ }
if(delay)
{
+ /* Purposely sleeping only on Win32 to let pipe fill up. */
#if defined(_WIN32)
Sleep(100);
#endif
@@ -271,6 +275,7 @@ int main(int argc, const char* argv[])
kwsysProcess_Exception_None
};
int values[6] = {0, 123, 1, 1, 0, 0};
+ int outputs[6] = {1, 1, 1, 1, 1, 0};
int delays[6] = {0, 0, 0, 0, 0, 1};
double timeouts[6] = {3, 3, 3, 3, 3, 0.1};
int r;
@@ -284,7 +289,7 @@ int main(int argc, const char* argv[])
fflush(stdout);
fflush(stderr);
r = runChild(cmd, states[n-1], exceptions[n-1], values[n-1], 0,
- delays[n-1], timeouts[n-1]);
+ outputs[n-1], delays[n-1], timeouts[n-1]);
fprintf(stdout, "Output on stdout after test %d.\n", n);
fprintf(stderr, "Output on stderr after test %d.\n", n);
fflush(stdout);