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

This commit is contained in:
Bill Hoffman 2007-09-11 11:21:36 -04:00
parent 4835f8303b
commit f262298bb0
5 changed files with 34 additions and 19 deletions

View File

@ -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");
}
}

View File

@ -1898,14 +1898,6 @@ int cmCTest::Run(std::vector<std::string> &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)

View File

@ -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);
}
}

View File

@ -339,6 +339,12 @@ public:
static bool ExtractTar(const char* inFileName,
const std::vector<cmStdString>& 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;

View File

@ -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;