[Cmake-commits] CMake branch, next, updated. v2.8.11.2-4232-g6099159

Brad King brad.king at kitware.com
Wed Sep 18 14:10:26 EDT 2013


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  60991593fec030a7cce4ed976e71e20157cdaebd (commit)
       via  7a5a0ab5ab2585305e9a338745485cadc15b2c53 (commit)
       via  2dd34f6e127556cb85c7ca318920896ccd8e3ff1 (commit)
       via  07934636a2694aec187e006fa3c65abd47b2b2b1 (commit)
       via  dad426c1c5d8a398479b16cc082adc0a1049739f (commit)
      from  5335a803c7744c9db349c48a9ba947386f1f902a (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=60991593fec030a7cce4ed976e71e20157cdaebd
commit 60991593fec030a7cce4ed976e71e20157cdaebd
Merge: 5335a80 7a5a0ab
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 18 14:10:21 2013 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Sep 18 14:10:21 2013 -0400

    Merge topic 'generate-modern-style' into next
    
    7a5a0ab Merge branch 'test-property-genex' into generate-modern-style
    2dd34f6 add_test: Mention generator expressions in old-style add_test docs
    0793463 cmTestGenerator: Evaluate generator expressions in test properties
    dad426c cmTestGenerator: Separate test properties for each configuration


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7a5a0ab5ab2585305e9a338745485cadc15b2c53
commit 7a5a0ab5ab2585305e9a338745485cadc15b2c53
Merge: 33055c4 2dd34f6
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 18 14:05:30 2013 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 18 14:05:30 2013 -0400

    Merge branch 'test-property-genex' into generate-modern-style
    
    Resolve conflict in Source/cmTestGenerator.cxx by taking "their" side
    (test-property-genex).  It already accounts for the lower-case change in
    "our" side (generate-modern-style).


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2dd34f6e127556cb85c7ca318920896ccd8e3ff1
commit 2dd34f6e127556cb85c7ca318920896ccd8e3ff1
Author:     Ben Boeckel <mathstuf at gmail.com>
AuthorDate: Wed Aug 7 18:08:54 2013 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 18 14:05:06 2013 -0400

    add_test: Mention generator expressions in old-style add_test docs
    
    The old-style add_test() call does not support generator expressions at
    all. This also applies to the properties for the test, but it is not
    mentioned at all.

diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h
index ec7fda3..ce98aaa 100644
--- a/Source/cmAddTestCommand.h
+++ b/Source/cmAddTestCommand.h
@@ -66,7 +66,8 @@ public:
       "built by this project or an arbitrary executable on the "
       "system (like tclsh).  The test will be run with the current working "
       "directory set to the CMakeList.txt files corresponding directory "
-      "in the binary tree.\n"
+      "in the binary tree.  Tests added using this signature do not support "
+      "generator expressions.\n"
       "\n"
       "  add_test(NAME <name> [CONFIGURATIONS [Debug|Release|...]]\n"
       "           [WORKING_DIRECTORY dir]\n"

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=07934636a2694aec187e006fa3c65abd47b2b2b1
commit 07934636a2694aec187e006fa3c65abd47b2b2b1
Author:     Ben Boeckel <mathstuf at gmail.com>
AuthorDate: Wed Aug 7 17:07:30 2013 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 18 14:05:06 2013 -0400

    cmTestGenerator: Evaluate generator expressions in test properties
    
    This is useful for something like:
    
        set_tests_properties(mytest
          PROPERTIES
            WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
    
    The common thought is that getting CTEST_CONFIGURATION_TYPE to be
    expanded when setting the property is the way, but this variable is not
    normalized. On Windows, using the variable in `ctest -R rELEASE` will
    likely work, but with Xcode, the path does not exist due to case
    sensitivity.

diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h
index 3a59218..f2f2611 100644
--- a/Source/cmSetTestsPropertiesCommand.h
+++ b/Source/cmSetTestsPropertiesCommand.h
@@ -51,7 +51,8 @@ public:
       "  set_tests_properties(test1 [test2...] PROPERTIES prop1 value1 prop2"
       " value2)\n"
       "Set a property for the tests. If the property is not found, CMake "
-      "will report an error. The properties include:\n"
+      "will report an error. Generator expressions will be expanded the same "
+      "as supported by the test's add_test call. The properties include:\n"
       "WILL_FAIL: If set to true, this will invert the pass/fail flag of the"
       " test.\n"
       "PASS_REGULAR_EXPRESSION: If set, the test output will be checked "
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 3167362..e5984a8 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -117,7 +117,8 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
         i != pm.end(); ++i)
       {
       os << " " << i->first
-         << " " << lg->EscapeForCMake(i->second.GetValue());
+         << " " << lg->EscapeForCMake(
+           ge.Parse(i->second.GetValue())->Evaluate(mf, config));
       }
     os << ")" << std::endl;
     }
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 9c3ed59..a5ad58c 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -604,6 +604,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
     ${build_generator_args}
     --build-project GeneratorExpression
     --build-options -DCMAKE_BUILD_TYPE=\${CTEST_CONFIGURATION_TYPE}
+    --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} -V
     )
   list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/GeneratorExpression")
 
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index 4d8d7ed..117686e 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -1,5 +1,7 @@
 cmake_minimum_required (VERSION 2.8.8)
-project(GeneratorExpression CXX)
+project(GeneratorExpression)
+
+include(CTest)
 
 # This test is split into multiple parts as needed to avoid NMake command
 # length limits.
@@ -190,3 +192,29 @@ add_custom_target(check-part3 ALL
   COMMAND ${CMAKE_COMMAND} -E echo "check done (part 3 of 3)"
   VERBATIM
   )
+
+#-----------------------------------------------------------------------------
+# Cover test properties with generator expressions.
+add_executable(echo echo.c)
+add_executable(pwd pwd.c)
+
+add_test(NAME echo-configuration COMMAND echo $<CONFIGURATION>)
+set_property(TEST echo-configuration PROPERTY
+  PASS_REGULAR_EXPRESSION "^$<CONFIGURATION>\n$")
+
+add_test(NAME echo-target-file COMMAND echo $<TARGET_FILE:echo>)
+set_property(TEST echo-target-file PROPERTY
+  PASS_REGULAR_EXPRESSION "/echo${CMAKE_EXECUTABLE_SUFFIX}\n$")
+
+add_test(NAME working-dir-arg
+  WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/WorkingDirectory/$<CONFIGURATION>"
+  COMMAND pwd)
+set_property(TEST working-dir-arg PROPERTY
+  PASS_REGULAR_EXPRESSION "WorkingDirectory/$<CONFIGURATION>\n$")
+foreach(c ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE})
+  file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/WorkingDirectory/${c}")
+endforeach()
+
+add_test(echo-old-style echo "\$<CONFIGURATION>")
+set_property(TEST echo-old-style PROPERTY
+    PASS_REGULAR_EXPRESSION "^\\$<CONFIGURATION>\n$")
diff --git a/Tests/GeneratorExpression/echo.c b/Tests/GeneratorExpression/echo.c
new file mode 100644
index 0000000..06b0844
--- /dev/null
+++ b/Tests/GeneratorExpression/echo.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char* argv[])
+{
+  printf("%s\n", argv[1]);
+  return EXIT_SUCCESS;
+}
diff --git a/Tests/GeneratorExpression/pwd.c b/Tests/GeneratorExpression/pwd.c
new file mode 100644
index 0000000..054b1af
--- /dev/null
+++ b/Tests/GeneratorExpression/pwd.c
@@ -0,0 +1,34 @@
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifdef _WIN32
+#include <direct.h>
+#define getcurdir _getcwd
+#else
+#include <unistd.h>
+#define getcurdir getcwd
+#endif
+
+int main(int argc, char* argv[])
+{
+#define BUFSZ 20000
+  char buf[BUFSZ + 1];
+#ifdef _WIN32
+  char *pos;
+#endif
+  getcurdir(buf, BUFSZ);
+#ifdef _WIN32
+  pos = buf;
+  while (*pos)
+    {
+    if (*pos == '\\')
+      {
+      *pos = '/';
+      }
+    ++pos;
+    }
+#endif
+  printf("%s\n", buf);
+  return EXIT_SUCCESS;
+}

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dad426c1c5d8a398479b16cc082adc0a1049739f
commit dad426c1c5d8a398479b16cc082adc0a1049739f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 18 13:05:05 2013 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 18 14:05:06 2013 -0400

    cmTestGenerator: Separate test properties for each configuration
    
    Move property generation from GenerateScriptConfigs to separate copies
    in GenerateOldStyle and GenerateScriptForConfig.  This causes the
    per-config tests generated for the add_test(NAME) signature to each get
    their own test properties.  This will allow us to later change the
    property values based on the test configuration.
    
    While at it, generate lower-case CMake code (set_tests_properties).
    
    Inspired-by: Ben Boeckel <mathstuf at gmail.com>

diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 42f511e..3167362 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -39,29 +39,8 @@ cmTestGenerator
 void cmTestGenerator::GenerateScriptConfigs(std::ostream& os,
                                             Indent const& indent)
 {
-  // First create the tests.
+  // Create the tests.
   this->cmScriptGenerator::GenerateScriptConfigs(os, indent);
-
-  // Now generate the test properties.
-  if(this->TestGenerated)
-    {
-    cmTest* test = this->Test;
-    cmMakefile* mf = test->GetMakefile();
-    cmLocalGenerator* lg = mf->GetLocalGenerator();
-    std::ostream& fout = os;
-    cmPropertyMap::const_iterator pit;
-    cmPropertyMap* mpit = &test->GetProperties();
-    if ( mpit->size() )
-      {
-      fout << "SET_TESTS_PROPERTIES(" << test->GetName() << " PROPERTIES ";
-      for ( pit = mpit->begin(); pit != mpit->end(); ++ pit )
-        {
-        fout << " " << pit->first
-             << " " << lg->EscapeForCMake(pit->second.GetValue());
-        }
-      fout << ")" << std::endl;
-      }
-    }
 }
 
 //----------------------------------------------------------------------------
@@ -127,6 +106,21 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
 
   // Finish the test command.
   os << ")\n";
+
+  // Output properties for the test.
+  cmPropertyMap& pm = this->Test->GetProperties();
+  if(!pm.empty())
+    {
+    os << indent << "set_tests_properties(" << this->Test->GetName()
+       << " PROPERTIES ";
+    for(cmPropertyMap::const_iterator i = pm.begin();
+        i != pm.end(); ++i)
+      {
+      os << " " << i->first
+         << " " << lg->EscapeForCMake(i->second.GetValue());
+      }
+    os << ")" << std::endl;
+    }
 }
 
 //----------------------------------------------------------------------------
@@ -181,4 +175,21 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout,
     fout << "\"";
     }
   fout << ")" << std::endl;
+
+  // Output properties for the test.
+  cmMakefile* mf = this->Test->GetMakefile();
+  cmLocalGenerator* lg = mf->GetLocalGenerator();
+  cmPropertyMap& pm = this->Test->GetProperties();
+  if(!pm.empty())
+    {
+    fout << indent << "set_tests_properties(" << this->Test->GetName()
+         << " PROPERTIES ";
+    for(cmPropertyMap::const_iterator i = pm.begin();
+        i != pm.end(); ++i)
+      {
+      fout << " " << i->first
+           << " " << lg->EscapeForCMake(i->second.GetValue());
+      }
+    fout << ")" << std::endl;
+    }
 }

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

Summary of changes:
 Source/cmAddTestCommand.h                |    3 +-
 Source/cmSetTestsPropertiesCommand.h     |    3 +-
 Source/cmTestGenerator.cxx               |   56 ++++++++++++++++++------------
 Tests/CMakeLists.txt                     |    1 +
 Tests/GeneratorExpression/CMakeLists.txt |   30 +++++++++++++++-
 Tests/GeneratorExpression/echo.c         |    8 ++++
 Tests/GeneratorExpression/pwd.c          |   34 ++++++++++++++++++
 7 files changed, 110 insertions(+), 25 deletions(-)
 create mode 100644 Tests/GeneratorExpression/echo.c
 create mode 100644 Tests/GeneratorExpression/pwd.c


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list