Author: rinrab
Date: Mon Jul  8 16:10:10 2024
New Revision: 1919027

URL: http://svn.apache.org/viewvc?rev=1919027&view=rev
Log:
On the 'cmake' branch: Add simple running of CTests.

Currently, all tests except one are passing. The one that fails unable to find
the svnserve program, because the build directory layout has changed. Also now
testing only one configuration and run the tests locally (with local remote
access).

To run the tests, use the following command:

[[[
ctest.exe --test-dir BUILDDIR
]]]

* build/generator/gen_cmake.py
  (cmake_target): Add the srcdir field.
  (Generator.write): Initialize srcdir by the value of target.path.

* build/generator/templates/targets.cmake.ezt
  (test targets): Use add_test() command to add the test to run with the
   proper arguments.

* CMakeLists.txt
  (options): Invoke the enable_testing() command if SVN_BUILD_TEST is true.

Modified:
    subversion/branches/cmake/CMakeLists.txt
    subversion/branches/cmake/build/generator/gen_cmake.py
    subversion/branches/cmake/build/generator/templates/targets.cmake.ezt

Modified: subversion/branches/cmake/CMakeLists.txt
URL: 
http://svn.apache.org/viewvc/subversion/branches/cmake/CMakeLists.txt?rev=1919027&r1=1919026&r2=1919027&view=diff
==============================================================================
--- subversion/branches/cmake/CMakeLists.txt (original)
+++ subversion/branches/cmake/CMakeLists.txt Mon Jul  8 16:10:10 2024
@@ -83,6 +83,10 @@ option(SVN_BUILD_PROGRAMS "Build Subvers
 option(SVN_BUILD_TOOLS "Build Subversion tools" OFF)
 option(SVN_BUILD_TEST "Build Subversion test-suite" OFF)
 
+if (SVN_BUILD_TEST)
+  enable_testing()
+endif()
+
 option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
 
 option(SVN_BUILD_SHARED_FS "Build shared FS modules" ${BUILD_SHARED_LIBS})

Modified: subversion/branches/cmake/build/generator/gen_cmake.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/cmake/build/generator/gen_cmake.py?rev=1919027&r1=1919026&r2=1919027&view=diff
==============================================================================
--- subversion/branches/cmake/build/generator/gen_cmake.py (original)
+++ subversion/branches/cmake/build/generator/gen_cmake.py Mon Jul  8 16:10:10 
2024
@@ -32,7 +32,7 @@ class cmake_target():
   def __init__(self, name: str, type: str, sources,
                libs, msvc_libs, msvc_objects, msvc_export,
                enable_condition, group: str, build_type: str,
-               description: str):
+               description: str, srcdir: str):
     self.name = name
     self.type = type
     self.sources = sources
@@ -50,6 +50,7 @@ class cmake_target():
     self.group = group
     self.build_type = build_type
     self.description = description
+    self.srcdir = srcdir
 
 def get_target_type(target: gen_base.Target):
   if isinstance(target, gen_base.TargetExe):
@@ -204,6 +205,7 @@ class Generator(gen_base.GeneratorBase):
           group = group,
           build_type = build_type,
           description = target.desc,
+          srcdir = target.path,
         )
 
         if isinstance(target, gen_base.TargetExe):

Modified: subversion/branches/cmake/build/generator/templates/targets.cmake.ezt
URL: 
http://svn.apache.org/viewvc/subversion/branches/cmake/build/generator/templates/targets.cmake.ezt?rev=1919027&r1=1919026&r2=1919027&view=diff
==============================================================================
--- subversion/branches/cmake/build/generator/templates/targets.cmake.ezt 
(original)
+++ subversion/branches/cmake/build/generator/templates/targets.cmake.ezt Mon 
Jul  8 16:10:10 2024
@@ -41,6 +41,7 @@ if ([targets.enable_condition])[is targe
   add_executable([targets.name][for targets.sources]
     [targets.sources][end]
   )
+  add_test([targets.name] [targets.name] --srcdir 
${CMAKE_SOURCE_DIR}/[targets.srcdir])
   [end]target_link_libraries([targets.name] PRIVATE[for targets.libs]
     [targets.libs][end]
   )[if-any targets.msvc_libs]


Reply via email to