From f262298bb037b683c995f239d1ca9fc00aaec3f3 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Tue, 11 Sep 2007 11:21:36 -0400 Subject: [PATCH] ENH: fix 2 ctest issues, do not use the build type of ctest to look for config types, do not inherit pipes in child procs for ctest so it can kill them --- Source/CTest/cmCTestTestHandler.cxx | 20 ++++++++++---------- Source/cmCTest.cxx | 8 -------- Source/cmSystemTools.cxx | 17 +++++++++++++++++ Source/cmSystemTools.h | 6 ++++++ Source/ctest.cxx | 2 +- 5 files changed, 34 insertions(+), 19 deletions(-) diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 8026c5ab0..580623e93 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1090,16 +1090,6 @@ void cmCTestTestHandler { // no config specified to try some options tempPath = filepath; - tempPath += "Deployment/"; - tempPath += filename; - attempted.push_back(tempPath); - attemptedConfigs.push_back("Deployment"); - tempPath = filepath; - tempPath += "Development/"; - tempPath += filename; - attempted.push_back(tempPath); - attemptedConfigs.push_back("Deployment"); - tempPath = filepath; tempPath += "Release/"; tempPath += filename; attempted.push_back(tempPath); @@ -1119,6 +1109,16 @@ void cmCTestTestHandler tempPath += filename; attempted.push_back(tempPath); attemptedConfigs.push_back("RelWithDebInfo"); + tempPath = filepath; + tempPath += "Deployment/"; + tempPath += filename; + attempted.push_back(tempPath); + attemptedConfigs.push_back("Deployment"); + tempPath = filepath; + tempPath += "Development/"; + tempPath += filename; + attempted.push_back(tempPath); + attemptedConfigs.push_back("Deployment"); } } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 84b23d1f1..8158257c9 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1898,14 +1898,6 @@ int cmCTest::Run(std::vector &args, std::string* output) } // the close of the for argument loop - // default to the build type of ctest itself if there is one -#ifdef CMAKE_INTDIR - if(this->ConfigType.size() == 0) - { - this->SetConfigType(CMAKE_INTDIR); - } -#endif - // now what sould cmake do? if --build-and-test was specified then // we run the build and test handler and return if(cmakeAndTest) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 337e60fff..7e597241c 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1976,3 +1976,20 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line, } } +void cmSystemTools::DoNotInheritStdPipes() +{ + { + HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE); + DuplicateHandle(GetCurrentProcess(), out, + GetCurrentProcess(), &out, 0, FALSE, + DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); + SetStdHandle(STD_OUTPUT_HANDLE, out); + } + { + HANDLE out = GetStdHandle(STD_ERROR_HANDLE); + DuplicateHandle(GetCurrentProcess(), out, + GetCurrentProcess(), &out, 0, FALSE, + DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); + SetStdHandle(STD_ERROR_HANDLE, out); + } +} diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 0cba39c02..ed95bdf88 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -339,6 +339,12 @@ public: static bool ExtractTar(const char* inFileName, const std::vector& files, bool gzip, bool verbose); + // This should be called first thing in main + // it will keep child processes from inheriting the + // stdin and stdout of this process. This is important + // if you want to be able to kill child processes and + // not get stuck waiting for all the output on the pipes. + static void DoNotInheritStdPipes(); private: static bool s_ForceUnixPaths; static bool s_RunCommandHideConsole; diff --git a/Source/ctest.cxx b/Source/ctest.cxx index b7d207fa7..5dedcc4ed 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -22,7 +22,6 @@ #include "cmDocumentation.h" #include "CTest/cmCTestScriptHandler.h" - //---------------------------------------------------------------------------- static const cmDocumentationEntry cmDocumentationName[] = { @@ -209,6 +208,7 @@ static const cmDocumentationEntry cmDocumentationSeeAlso[] = // this is a test driver program for cmCTest. int main (int argc, char *argv[]) { + cmSystemTools::DoNotInheritStdPipes(); cmSystemTools::EnableMSVCDebugHook(); int nocwd = 0; cmCTest inst;