| 1 | CTest Example |
| 2 | ============= |
| 3 | |
| 4 | This example project demonstrates how to use dh-cmake's CTest functionality. It |
| 5 | can be built out of the box with dpkg-buildpackage. The `CMakeLists.txt` file |
| 6 | and `CTestConfig.cmake` file contain the project's CTest configuration. |
| 7 | |
| 8 | This tutorial assumes you already know how to use CTest. If not, please refer |
| 9 | to the [CTest manual](https://cmake.org/cmake/help/latest/manual/ctest.1.html). |
| 10 | |
| 11 | Look in the `debian/rules` file. Notice the `--with ctest` parameter. This |
| 12 | enables the `ctest` Debhelper sequence, which runs the `dh_ctest_start`, |
| 13 | `dh_ctest_configure`, `dh_ctest_build`, and `dh_ctest_test` commands. |
| 14 | `dh_ctest_start` starts a CTest dashboard test, while the rest of the commands |
| 15 | replace and wrap their `dh_auto_*` counterparts, capturing their output for the |
| 16 | dashboard test. |
| 17 | |
| 18 | To activate dashboard mode, run `dpkg-buildpackage` with the following |
| 19 | environment variable (warning for the privacy-minded: this will submit the |
| 20 | results of the configure, build, and test steps to Kitware's public CDash |
| 21 | server, along with some information about your machine specs): |
| 22 | |
| 23 | ```shell |
| 24 | DEB_CTEST_OPTIONS="model=Experimental site=<hostname> build=debian-dpkg submit" dpkg-buildpackage |
| 25 | ``` |
| 26 | |
| 27 | When running this command, replace `<hostname>` with your computer's hostname. |
| 28 | |
| 29 | Once the package has been built, go to the |
| 30 | [Kitware public dashboard](https://open.cdash.org/index.php?project=PublicDashboard) |
| 31 | and see the results of your tests in the "Experimental" section. |
| 32 | |
| 33 | Note that dashboard mode and the submission feature are completely optional. |
| 34 | If you don't set `DEB_CTEST_OPTIONS` and just run `dpkg-buildpackage`, it will |
| 35 | simply run the `dh_auto_*` commands the same way it normally would, without |
| 36 | capturing their output or sending anything to a server. |