1
0

Adding Support for a Testing Dashboard.rst 1.8 KB

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