Bläddra i källkod

ENH: Improve coverage on systems with multiple gcov commands

Andy Cedilnik 22 år sedan
förälder
incheckning
403f220d25
3 ändrade filer med 16 tillägg och 4 borttagningar
  1. 2 0
      Modules/Dart.cmake
  2. 1 0
      Modules/DartConfiguration.tcl.in
  3. 13 4
      Source/cmCTest.cxx

+ 2 - 0
Modules/Dart.cmake

@@ -74,6 +74,7 @@ IF(BUILD_TESTING)
     DOC "Path to Rational purify command, used for memory error detection."
     )
   FIND_PROGRAM(SCPCOMMAND scp DOC "Path to scp command, used by some Dart clients for submitting results to a Dart server (when not using ftp for submissions)")
+  FIND_PROGRAM(COVERAGE_COMMAND gcov DOC "Path to the coverage program that Dart client uses for performing coverage inspection")
 
   # find a tcl shell command
   INCLUDE(${CMAKE_ROOT}/Modules/FindTclsh.cmake)
@@ -121,6 +122,7 @@ IF(BUILD_TESTING)
     CVS_UPDATE_OPTIONS
     DART_TESTING_TIMEOUT
     SCPCOMMAND
+    COVERAGE_COMMAND
     DELIVER_CONTINUOUS_EMAIL
     )
   #  BUILDNAME 

+ 1 - 0
Modules/DartConfiguration.tcl.in

@@ -40,6 +40,7 @@ ScpCommand: @SCPCOMMAND@
 PurifyCommand: @PURIFYCOMMAND@
 ValgrindCommand: @VALGRIND_COMMAND@
 ValgrindCommandOptions: @VALGRIND_COMMAND_OPTIONS@
+CoverageCommand: @COVERAGE_COMMAND@
 # Compression commands
 GunzipCommand: @GUNZIPCOMMAND@
 CompressionCommand: @COMPRESSIONCOMMAND@

+ 13 - 4
Source/cmCTest.cxx

@@ -1143,7 +1143,14 @@ int cmCTest::CoverageDirectory()
   std::string sourceDirectory = m_DartConfiguration["SourceDirectory"];
   if ( sourceDirectory.size() == 0 )
     {
-    std::cerr << "Cannot find SourceDirectory  key in the DartConfiguration.tcl" << std::endl;
+    std::cerr << "Cannot find SourceDirectory key in the DartConfiguration.tcl" << std::endl;
+    return 1;
+    }
+
+  std::string coverageCommand = m_DartConfiguration["CoverageCommand"];
+  if ( coverageCommand.size() == 0 )
+    {
+    std::cerr << "Coverage command not defined in DartConfiguration.tcl" << std::endl;
     return 1;
     }
   cdirs.push_back(sourceDirectory);
@@ -1237,10 +1244,10 @@ int cmCTest::CoverageDirectory()
 
   std::string opath = m_ToplevelPath + "/Testing/Temporary/Coverage";
   cmSystemTools::MakeDirectory(opath.c_str());
-  
+
   for ( cc = 0; cc < files.size(); cc ++ )
     {
-    std::string command = "gcov -l \"" + files[cc] + "\"";
+    std::string command = coverageCommand + " -l \"" + files[cc] + "\"";
     std::string output;
     int retVal = 0;
     //std::cout << "Run gcov on " << files[cc] << std::flush;
@@ -1258,7 +1265,9 @@ int cmCTest::CoverageDirectory()
       }
     else
       {
-      //std::cout << " - fail" << std::endl;
+      std::cout << "Run gcov on " << files[cc] << std::flush;
+      std::cout << " [" << command << "]" << std::endl;
+      std::cout << " - fail" << std::endl;
       }
     }