Adding Support for a Testing Dashboard.rst 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. Step 8: Adding Support for a Testing Dashboard
  2. ==============================================
  3. Adding support for submitting our test results to a dashboard is simple. We
  4. already defined a number of tests for our project in `Testing Support`_. Now we
  5. just have to run those tests and submit them to a dashboard. To include support
  6. for dashboards we include the :module:`CTest` module in our top-level
  7. ``CMakeLists.txt``.
  8. Replace:
  9. .. code-block:: cmake
  10. # enable testing
  11. enable_testing()
  12. With:
  13. .. code-block:: cmake
  14. # enable dashboard scripting
  15. include(CTest)
  16. The :module:`CTest` module will automatically call ``enable_testing()``, so we
  17. can remove it from our CMake files.
  18. We will also need to create a ``CTestConfig.cmake`` file in the top-level
  19. directory where we can specify the name of the project and where to submit the
  20. dashboard.
  21. .. literalinclude:: Step9/CTestConfig.cmake
  22. :language: cmake
  23. The :manual:`ctest <ctest(1)>` executable will read in this file when it runs.
  24. To create a simple dashboard you can run the :manual:`cmake <cmake(1)>`
  25. executable or the :manual:`cmake-gui <cmake-gui(1)>` to configure the project,
  26. but do not build it yet. Instead, change directory to the binary tree, and then
  27. run:
  28. ctest [-VV] -D Experimental
  29. Remember, for multi-config generators (e.g. Visual Studio), the configuration
  30. type must be specified::
  31. ctest [-VV] -C Debug -D Experimental
  32. Or, from an IDE, build the ``Experimental`` target.
  33. The :manual:`ctest <ctest(1)>` executable will build and test the project and
  34. submit the results to Kitware's public dashboard:
  35. https://my.cdash.org/index.php?project=CMakeTutorial.