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  d339cfcb54e3b0af2d24469a5189208d9e2965f8 (commit)
       via  361696ae2073b537545755e8ef765d080490d244 (commit)
       via  c77b57ba7d8198a71d8d90a4eac5bcd526050cf9 (commit)
       via  93d084c180fde5bc3c31b9945ea7ddb06d9a6007 (commit)
       via  af298480d020e814fa4537ca7d7dd44d472489b5 (commit)
       via  24ba0fd078ca1db13cdbeb51e531b0fce53f3f3f (commit)
      from  51a05582f842f0b436381017219395ee899dedd9 (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=d339cfcb54e3b0af2d24469a5189208d9e2965f8
commit d339cfcb54e3b0af2d24469a5189208d9e2965f8
Merge: 51a0558 361696a
Author:     David Cole <david.c...@kitware.com>
AuthorDate: Mon Jun 25 08:39:41 2012 -0400
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Mon Jun 25 08:39:41 2012 -0400

    Merge topic 'ctest-cmd-line-vars' into next
    
    361696a CTest: Add test to verify -D variable definitions work
    c77b57b CTest: Allow -Dvar=value with no space between the D and the var
    93d084c CTest: Extend -D command line arg handling for variable definitions
    af29848 CTest: Rename local variable for clarity
    24ba0fd CTest: Refactor error output into ErrorMessageUnknownDashDValue


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=361696ae2073b537545755e8ef765d080490d244
commit 361696ae2073b537545755e8ef765d080490d244
Author:     David Cole <david.c...@kitware.com>
AuthorDate: Mon Jun 25 08:25:51 2012 -0400
Commit:     David Cole <david.c...@kitware.com>
CommitDate: Mon Jun 25 08:25:51 2012 -0400

    CTest: Add test to verify -D variable definitions work

diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 9deb8ac..300ab09 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1822,6 +1822,19 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P 
${CMake_SOURCE_DIR}/Utilities/
   add_config_tests(Release)
   add_config_tests(RelWithDebInfo)
 
+  # Test -S script with some -D variable definition args to ctest:
+  add_test(CTestConfig.ScriptWithArgs ${CMAKE_CTEST_COMMAND}
+    -C "Release"
+    -D arg1=this
+    -D arg2=that
+    -D "arg3=the other"
+    "-Darg4=this is the fourth"
+    -Darg5=the_fifth
+    -Darg6:STRING=value-with-type
+    -S "${CMake_SOURCE_DIR}/Tests/CTestConfig/ScriptWithArgs.cmake" -VV
+    --output-log "${CMake_BINARY_DIR}/Tests/CTestConfig/ScriptWithArgs.log"
+    )
+
   ADD_TEST_MACRO(CMakeCommands.target_link_libraries target_link_libraries)
 
   CONFIGURE_FILE(
diff --git a/Tests/CTestConfig/ScriptWithArgs.cmake 
b/Tests/CTestConfig/ScriptWithArgs.cmake
new file mode 100644
index 0000000..79896a7
--- /dev/null
+++ b/Tests/CTestConfig/ScriptWithArgs.cmake
@@ -0,0 +1,16 @@
+set(CTEST_RUN_CURRENT_SCRIPT 0)
+
+macro(check_arg name expected_value)
+  message("${name}='${${name}}'")
+  if(NOT "${${name}}" STREQUAL "${expected_value}")
+    message(FATAL_ERROR "unexpected ${name} value '${${name}}', expected 
'${expected_value}'")
+  endif()
+endmacro()
+
+check_arg(arg1 "this")
+check_arg(arg2 "that")
+check_arg(arg3 "the other")
+check_arg(arg4 "this is the fourth")
+check_arg(arg5 "the_fifth")
+check_arg(arg6 "value-with-type")
+check_arg(arg7 "")

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c77b57ba7d8198a71d8d90a4eac5bcd526050cf9
commit c77b57ba7d8198a71d8d90a4eac5bcd526050cf9
Author:     David Cole <david.c...@kitware.com>
AuthorDate: Sun Jun 24 08:11:52 2012 -0400
Commit:     David Cole <david.c...@kitware.com>
CommitDate: Sun Jun 24 08:14:11 2012 -0400

    CTest: Allow -Dvar=value with no space between the D and the var
    
    Similar to CMake's handling of -D command line arguments, for
    consistency and to avoid silent ignoring of "unknown command
    line" args.

diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 05e8237..b5687e3 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -2289,6 +2289,17 @@ int cmCTest::Run(std::vector<std::string> &args, 
std::string* output)
         }
       }
 
+    // If it's not exactly -D, but it starts with -D, then try to parse out
+    // a variable definition from it, same as CMake does. Unsuccessful
+    // attempts are simply ignored since previous ctest versions ignore
+    // this too. (As well as many other unknown command line args.)
+    //
+    if(arg != "-D" && cmSystemTools::StringStartsWith(arg.c_str(), "-D"))
+      {
+      std::string input = arg.substr(2);
+      this->AddVariableDefinition(input);
+      }
+
     if(this->CheckArgument(arg, "-T", "--test-action") &&
       (i < args.size() -1) )
       {

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=93d084c180fde5bc3c31b9945ea7ddb06d9a6007
commit 93d084c180fde5bc3c31b9945ea7ddb06d9a6007
Author:     David Cole <david.c...@kitware.com>
AuthorDate: Sun Jun 24 06:16:32 2012 -0400
Commit:     David Cole <david.c...@kitware.com>
CommitDate: Sun Jun 24 08:03:24 2012 -0400

    CTest: Extend -D command line arg handling for variable definitions
    
    If the argument following -D is not a valid dashboard type string,
    then try to parse it as a "var:type=value" string just like cmake
    already does.

diff --git a/Source/CTest/cmCTestScriptHandler.cxx 
b/Source/CTest/cmCTestScriptHandler.cxx
index d3ab2ef..8643cb3 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -435,6 +435,15 @@ int cmCTestScriptHandler::ReadInScript(const std::string& 
total_script_arg)
     return 2;
     }
 
+  // Add definitions of variables passed in on the command line:
+  const std::map<std::string, std::string> &defs =
+    this->CTest->GetDefinitions();
+  for (std::map<std::string, std::string>::const_iterator it = defs.begin();
+       it != defs.end(); ++it)
+    {
+    this->Makefile->AddDefinition(it->first.c_str(), it->second.c_str());
+    }
+
   // finally read in the script
   if (!this->Makefile->ReadListFile(0, script.c_str()) ||
     cmSystemTools::GetErrorOccuredFlag())
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index cc4a341..05e8237 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -2230,6 +2230,22 @@ void cmCTest::HandleScriptArguments(size_t &i,
 }
 
 //----------------------------------------------------------------------
+bool cmCTest::AddVariableDefinition(const std::string &arg)
+{
+  std::string name;
+  std::string value;
+  cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED;
+
+  if (cmCacheManager::ParseEntry(arg.c_str(), name, value, type))
+    {
+    this->Definitions[name] = value;
+    return true;
+    }
+
+  return false;
+}
+
+//----------------------------------------------------------------------
 // the main entry point of ctest, called from main
 int cmCTest::Run(std::vector<std::string> &args, std::string* output)
 {
@@ -2265,8 +2281,11 @@ int cmCTest::Run(std::vector<std::string> &args, 
std::string* output)
       // into the separate stages
       if (!this->AddTestsForDashboardType(targ))
         {
-        this->ErrorMessageUnknownDashDValue(targ);
-        executeTests = false;
+        if (!this->AddVariableDefinition(targ))
+          {
+          this->ErrorMessageUnknownDashDValue(targ);
+          executeTests = false;
+          }
         }
       }
 
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index 68811f8..beffe9e 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -418,6 +418,11 @@ public:
 
   std::string GetCostDataFile();
 
+  const std::map<std::string, std::string> &GetDefinitions()
+    {
+    return this->Definitions;
+    }
+
 private:
   std::string ConfigType;
   std::string ScheduleType;
@@ -520,6 +525,9 @@ private:
   //! read as "emit an error message for an unknown -D value"
   void ErrorMessageUnknownDashDValue(std::string &val);
 
+  //! add a variable definition from a command line -D value
+  bool AddVariableDefinition(const std::string &arg);
+
   //! parse and process most common command line arguments
   void HandleCommandLineArguments(size_t &i, 
                                   std::vector<std::string> &args);
@@ -562,6 +570,8 @@ private:
   int OutputLogFileLastTag;
 
   bool OutputTestOutputOnTestFailure;
+
+  std::map<std::string, std::string> Definitions;
 };
 
 class cmCTestLogWrite
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index d41627e..d650777 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -103,6 +103,12 @@ static const char * cmDocumentationOptions[][3] =
    "a dashboard test. All tests are <Mode><Test>, where Mode can be "
    "Experimental, Nightly, and Continuous, and Test can be Start, Update, "
    "Configure, Build, Test, Coverage, and Submit."},
+  {"-D <var>:<type>=<value>", "Define a variable for script mode",
+   "Pass in variable values on the command line. Use in "
+   "conjunction with -S to pass variable values to a dashboard script. "
+   "Parsing -D arguments as variable values is only attempted if "
+   "the value following -D does not match any of the known dashboard "
+   "types."},
   {"-M <model>, --test-model <model>", "Sets the model for a dashboard",
    "This option tells ctest to act as a Dart client "
    "where the TestModel can be Experimental, "

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=af298480d020e814fa4537ca7d7dd44d472489b5
commit af298480d020e814fa4537ca7d7dd44d472489b5
Author:     David Cole <david.c...@kitware.com>
AuthorDate: Sun Jun 24 05:51:08 2012 -0400
Commit:     David Cole <david.c...@kitware.com>
CommitDate: Sun Jun 24 05:51:08 2012 -0400

    CTest: Rename local variable for clarity

diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 689f6ab..cc4a341 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -2236,7 +2236,7 @@ int cmCTest::Run(std::vector<std::string> &args, 
std::string* output)
   this->FindRunningCMake();
   const char* ctestExec = "ctest";
   bool cmakeAndTest = false;
-  bool performSomeTest = true;
+  bool executeTests = true;
   bool SRArgumentSpecified = false;
 
   // copy the command line
@@ -2266,7 +2266,7 @@ int cmCTest::Run(std::vector<std::string> &args, 
std::string* output)
       if (!this->AddTestsForDashboardType(targ))
         {
         this->ErrorMessageUnknownDashDValue(targ);
-        performSomeTest = false;
+        executeTests = false;
         }
       }
 
@@ -2277,7 +2277,7 @@ int cmCTest::Run(std::vector<std::string> &args, 
std::string* output)
       i++;
       if ( !this->SetTest(args[i].c_str(), false) )
         {
-        performSomeTest = false;
+        executeTests = false;
         cmCTestLog(this, ERROR_MESSAGE,
           "CTest -T called with incorrect option: "
           << args[i].c_str() << std::endl);
@@ -2315,7 +2315,7 @@ int cmCTest::Run(std::vector<std::string> &args, 
std::string* output)
         }
       else
         {
-        performSomeTest = false;
+        executeTests = false;
         cmCTestLog(this, ERROR_MESSAGE,
           "CTest -M called with incorrect option: " << str.c_str()
           << std::endl);
@@ -2386,8 +2386,7 @@ int cmCTest::Run(std::vector<std::string> &args, 
std::string* output)
     return retv;
     }
 
-  // if some tests must be run 
-  if(performSomeTest)
+  if(executeTests)
     {
     int res;
     // call process directory

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=24ba0fd078ca1db13cdbeb51e531b0fce53f3f3f
commit 24ba0fd078ca1db13cdbeb51e531b0fce53f3f3f
Author:     David Cole <david.c...@kitware.com>
AuthorDate: Sun Jun 24 05:33:32 2012 -0400
Commit:     David Cole <david.c...@kitware.com>
CommitDate: Sun Jun 24 05:46:55 2012 -0400

    CTest: Refactor error output into ErrorMessageUnknownDashDValue
    
    No behavior change. Prep work for defining script variables by
    extending -D command line handling to recognize var:type=value syntax.

diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 4aff64b..689f6ab 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -1944,29 +1944,6 @@ bool cmCTest::AddTestsForDashboardType(std::string &targ)
     }
   else
     {
-    cmCTestLog(this, ERROR_MESSAGE,
-               "CTest -D called with incorrect option: "
-               << targ << std::endl);
-    cmCTestLog(this, ERROR_MESSAGE, "Available options are:" << std::endl
-               << "  " << "ctest" << " -D Continuous" << std::endl
-               << "  " << "ctest"
-               << " -D Continuous(Start|Update|Configure|Build)" << std::endl
-               << "  " << "ctest"
-               << " -D Continuous(Test|Coverage|MemCheck|Submit)"
-               << std::endl
-               << "  " << "ctest" << " -D Experimental" << std::endl
-               << "  " << "ctest"
-               << " -D Experimental(Start|Update|Configure|Build)"
-               << std::endl
-               << "  " << "ctest"
-               << " -D Experimental(Test|Coverage|MemCheck|Submit)"
-               << std::endl
-               << "  " << "ctest" << " -D Nightly" << std::endl
-               << "  " << "ctest"
-               << " -D Nightly(Start|Update|Configure|Build)" << std::endl
-               << "  " << "ctest"
-               << " -D Nightly(Test|Coverage|MemCheck|Submit)" << std::endl
-               << "  " << "ctest" << " -D NightlyMemoryCheck" << std::endl);
     return false;
     }
   return true;
@@ -1974,6 +1951,27 @@ bool cmCTest::AddTestsForDashboardType(std::string &targ)
 
 
 //----------------------------------------------------------------------
+void cmCTest::ErrorMessageUnknownDashDValue(std::string &val)
+{
+  cmCTestLog(this, ERROR_MESSAGE,
+    "CTest -D called with incorrect option: " << val << std::endl);
+
+  cmCTestLog(this, ERROR_MESSAGE,
+    "Available options are:" << std::endl
+    << "  ctest -D Continuous" << std::endl
+    << "  ctest -D Continuous(Start|Update|Configure|Build)" << std::endl
+    << "  ctest -D Continuous(Test|Coverage|MemCheck|Submit)" << std::endl
+    << "  ctest -D Experimental" << std::endl
+    << "  ctest -D Experimental(Start|Update|Configure|Build)" << std::endl
+    << "  ctest -D Experimental(Test|Coverage|MemCheck|Submit)" << std::endl
+    << "  ctest -D Nightly" << std::endl
+    << "  ctest -D Nightly(Start|Update|Configure|Build)" << std::endl
+    << "  ctest -D Nightly(Test|Coverage|MemCheck|Submit)" << std::endl
+    << "  ctest -D NightlyMemoryCheck" << std::endl);
+}
+
+
+//----------------------------------------------------------------------
 bool cmCTest::CheckArgument(const std::string& arg, const char* varg1,
   const char* varg2)
 {
@@ -2263,10 +2261,11 @@ int cmCTest::Run(std::vector<std::string> &args, 
std::string* output)
       this->ProduceXML = true;
       i++;
       std::string targ = args[i];
-      // AddTestsForDashboard parses the dashborad type and converts it
+      // AddTestsForDashboard parses the dashboard type and converts it
       // into the separate stages
       if (!this->AddTestsForDashboardType(targ))
         {
+        this->ErrorMessageUnknownDashDValue(targ);
         performSomeTest = false;
         }
       }
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index 7c71b00..68811f8 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -417,6 +417,7 @@ public:
   bool GetLabelSummary() { return this->LabelSummary;}
 
   std::string GetCostDataFile();
+
 private:
   std::string ConfigType;
   std::string ScheduleType;
@@ -516,6 +517,9 @@ private:
   //! parse the option after -D and convert it into the appropriate steps
   bool AddTestsForDashboardType(std::string &targ);
 
+  //! read as "emit an error message for an unknown -D value"
+  void ErrorMessageUnknownDashDValue(std::string &val);
+
   //! parse and process most common command line arguments
   void HandleCommandLineArguments(size_t &i, 
                                   std::vector<std::string> &args);

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

Summary of changes:
 Source/CTest/cmCTestScriptHandler.cxx  |    9 +++
 Source/cmCTest.cxx                     |   88 +++++++++++++++++++++-----------
 Source/cmCTest.h                       |   14 +++++
 Source/ctest.cxx                       |    6 ++
 Tests/CMakeLists.txt                   |   13 +++++
 Tests/CTestConfig/ScriptWithArgs.cmake |   16 ++++++
 6 files changed, 116 insertions(+), 30 deletions(-)
 create mode 100644 Tests/CTestConfig/ScriptWithArgs.cmake


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits

Reply via email to