[Cmake-commits] CMake branch, next, updated. v2.8.4-1724-ge9a6f56

Brad King brad.king at kitware.com
Fri Jun 10 10:55:52 EDT 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  e9a6f56d9fd1d70c063ae54d7a3473b2a5a4b9a3 (commit)
       via  a4ec24269b32a28104e1d5681e718024b28bb4e7 (commit)
       via  77ddb6a0cd35996f1329d727a25de3460f6aa899 (commit)
      from  86d987a02fc659a840fc4d01c641c301d99ea1c8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e9a6f56d9fd1d70c063ae54d7a3473b2a5a4b9a3
commit e9a6f56d9fd1d70c063ae54d7a3473b2a5a4b9a3
Merge: 86d987a a4ec242
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Jun 10 10:55:48 2011 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Jun 10 10:55:48 2011 -0400

    Merge topic 'ctest-no-config-report-notrun' into next
    
    a4ec242 CTest: Report tests not run due to unknown configuration
    77ddb6a Use cascading-if for per-config test and install code


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a4ec24269b32a28104e1d5681e718024b28bb4e7
commit a4ec24269b32a28104e1d5681e718024b28bb4e7
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Jun 10 09:29:30 2011 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Jun 10 09:52:18 2011 -0400

    CTest: Report tests not run due to unknown configuration
    
    When add_test(NAME) is called without the CONFIGURATIONS argument then
    the test is intended to run in any configuration.  In multi-config
    generators like the VS IDE and Xcode tests created by add_test(NAME) can
    only be run when testing a known configuration (otherwise there is no
    way to generate the test command line).  If no test command line is
    known for a particular configuration, or if no configuration is given to
    ctest, report the test as not run instead of silently skipping it.
    
    Also fix CMake's own TestsWorkingDirectory test invocation to correct a
    previously silent failure exposed by this change.

diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index b5b46f6..60695da 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -412,6 +412,30 @@ bool cmCTestRunTest::StartTest(size_t total)
   this->TestResult.TestCount = this->TestProperties->Index;  
   this->TestResult.Name = this->TestProperties->Name;
   this->TestResult.Path = this->TestProperties->Directory.c_str();
+
+  if(args.size() >= 2 && args[1] == "NOT_AVAILABLE")
+    {
+    this->TestProcess = new cmProcess;
+    std::string msg;
+    if(this->CTest->GetConfigType().empty())
+      {
+      msg = "Test not available without configuration.";
+      msg += "  (Missing \"-C <config>\"?)";
+      }
+    else
+      {
+      msg = "Test not available in configuration \"";
+      msg += this->CTest->GetConfigType();
+      msg += "\".";
+      }
+    *this->TestHandler->LogFile << msg << std::endl;
+    cmCTestLog(this->CTest, ERROR_MESSAGE, msg << std::endl);
+    this->TestResult.Output = msg;
+    this->TestResult.FullCommandLine = "";
+    this->TestResult.CompletionStatus = "Not Run";
+    this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
+    return false;
+    }
   
   // Check if all required files exist
   for(std::vector<std::string>::iterator i =
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 56f6630..e3b81df 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -1320,6 +1320,10 @@ std::string cmCTestTestHandler::FindTheExecutable(const char *exe)
   std::string resConfig;
   std::vector<std::string> extraPaths;
   std::vector<std::string> failedPaths;
+  if(strcmp(exe, "NOT_AVAILABLE") == 0)
+    {
+    return exe;
+    }
   return cmCTestTestHandler::FindExecutable(this->CTest,
                                             exe, resConfig,
                                             extraPaths,
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 39f8638..e0892b2 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -130,6 +130,22 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
 }
 
 //----------------------------------------------------------------------------
+void cmTestGenerator::GenerateScriptNoConfig(std::ostream& os,
+                                             Indent const& indent)
+{
+  os << indent << "ADD_TEST(" << this->Test->GetName() << " NOT_AVAILABLE)\n";
+}
+
+//----------------------------------------------------------------------------
+bool cmTestGenerator::NeedsScriptNoConfig() const
+{
+  return (this->TestGenerated && // test generated for at least one config
+          this->ActionsPerConfig && // test is config-aware
+          this->Configurations.empty() && // test runs in all configs
+          !this->ConfigurationTypes->empty()); // config-dependent command
+}
+
+//----------------------------------------------------------------------------
 void cmTestGenerator::GenerateOldStyle(std::ostream& fout,
                                        Indent const& indent)
 {
diff --git a/Source/cmTestGenerator.h b/Source/cmTestGenerator.h
index 85d9091..2c69fc3 100644
--- a/Source/cmTestGenerator.h
+++ b/Source/cmTestGenerator.h
@@ -34,6 +34,8 @@ protected:
   virtual void GenerateScriptForConfig(std::ostream& os,
                                        const char* config,
                                        Indent const& indent);
+  virtual void GenerateScriptNoConfig(std::ostream& os, Indent const& indent);
+  virtual bool NeedsScriptNoConfig() const;
   void GenerateOldStyle(std::ostream& os, Indent const& indent);
 
   cmTest* Test;
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 1be2a24..2ad9a77 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1310,7 +1310,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
     --build-exe-dir "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory"
     --force-new-ctest-process
-    --test-command ${CMAKE_CTEST_COMMAND} -V
+    --test-command ${CMAKE_CTEST_COMMAND} -V -C \${CTEST_CONFIGURATION_TYPE}
     )
   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory")
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=77ddb6a0cd35996f1329d727a25de3460f6aa899
commit 77ddb6a0cd35996f1329d727a25de3460f6aa899
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Jun 10 08:48:20 2011 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Jun 10 09:25:46 2011 -0400

    Use cascading-if for per-config test and install code
    
    When generating per-config blocks in test and install scripts replace
    the form
    
      IF()
        # config == A
      ENDIF()
      IF()
        # config == B
      ENDIF()
    
    with
    
      IF()
        # config == A
      ELSEIF()
        # config == B
      ELSE()
        # no config matches
      ENDIF()
    
    for clarity and to support the else() case cleanly.

diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx
index 86ecebe..cabe98a 100644
--- a/Source/cmScriptGenerator.cxx
+++ b/Source/cmScriptGenerator.cxx
@@ -209,6 +209,7 @@ void cmScriptGenerator::GenerateScriptActionsPerConfig(std::ostream& os,
     // In a multi-configuration generator we produce a separate rule
     // in a block for each configuration that is built.  We restrict
     // the list of configurations to those to which this rule applies.
+    bool first = true;
     for(std::vector<std::string>::const_iterator i =
           this->ConfigurationTypes->begin();
         i != this->ConfigurationTypes->end(); ++i)
@@ -218,10 +219,19 @@ void cmScriptGenerator::GenerateScriptActionsPerConfig(std::ostream& os,
         {
         // Generate a per-configuration block.
         std::string config_test = this->CreateConfigTest(config);
-        os << indent << "IF(" << config_test << ")\n";
+        os << indent << (first? "IF(" : "ELSEIF(") << config_test << ")\n";
         this->GenerateScriptForConfig(os, config, indent.Next());
-        os << indent << "ENDIF(" << config_test << ")\n";
+        first = false;
         }
       }
+    if(!first)
+      {
+      if(this->NeedsScriptNoConfig())
+        {
+        os << indent << "ELSE()\n";
+        this->GenerateScriptNoConfig(os, indent.Next());
+        }
+      os << indent << "ENDIF()\n";
+      }
     }
 }
diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h
index e2a0da5..8b2ca33 100644
--- a/Source/cmScriptGenerator.h
+++ b/Source/cmScriptGenerator.h
@@ -65,6 +65,8 @@ protected:
   virtual void GenerateScriptForConfig(std::ostream& os,
                                        const char* config,
                                        Indent const& indent);
+  virtual void GenerateScriptNoConfig(std::ostream&, Indent const&) {}
+  virtual bool NeedsScriptNoConfig() const { return false; }
 
   // Test if this generator does something for a given configuration.
   bool GeneratesForConfig(const char*);

-----------------------------------------------------------------------

Summary of changes:
 Source/CTest/cmCTestRunTest.cxx     |   24 ++++++++++++++++++++++++
 Source/CTest/cmCTestTestHandler.cxx |    4 ++++
 Source/cmScriptGenerator.cxx        |   14 ++++++++++++--
 Source/cmScriptGenerator.h          |    2 ++
 Source/cmTestGenerator.cxx          |   16 ++++++++++++++++
 Source/cmTestGenerator.h            |    2 ++
 Tests/CMakeLists.txt                |    2 +-
 7 files changed, 61 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list