Просмотр исходного кода

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

Bill Hoffman 18 лет назад
Родитель
Сommit
f262298bb0
5 измененных файлов с 34 добавлено и 19 удалено
  1. 10 10
      Source/CTest/cmCTestTestHandler.cxx
  2. 0 8
      Source/cmCTest.cxx
  3. 17 0
      Source/cmSystemTools.cxx
  4. 6 0
      Source/cmSystemTools.h
  5. 1 1
      Source/ctest.cxx

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

+ 0 - 8
Source/cmCTest.cxx

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

+ 17 - 0
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);
+  }
+}

+ 6 - 0
Source/cmSystemTools.h

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

+ 1 - 1
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;