Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 4,157
    • Issues 4,157
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 14
    • Merge requests 14
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMakeCMake
  • CMakeCMake
  • Merge requests
  • !4258

CTest: Add option to control error on no tests

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Stefan Dinkelacker requested to merge kislinsk/cmake:ctest-add-ignore-no-tests-option into master Jan 22, 2020
  • Overview 24
  • Commits 1
  • Pipelines 6
  • Changes 16

Add a CTest argument that allows to consider no tests found not as error.

By default CTest will log an error message and return an error code if no tests were found. This option prevents CTest from considering this condition as error.

There are various reasons why someone wants to consider "no tests found" not as error. For example, if the number of tests depends on variables, plattform, test modes, you name it, there may be test configurations that simply does not contain any tests, in particular if the subproject feature is used and certain subprojects do not have any tests, while there are tests in other subprojects.

Currently CTest does return error code 255 in this case just like when any test failed. While this does not affect the reporting on CDash, scripts in the CI infrastructure (for example the CMake plugin in Jenkins) cannot distinguish between these cases making "ignore exit code 255" not an option to correctly report success or failure to tools like Jenkins.

This merge request is a minimal invasive change of CTest that is fully backwards compatible without changing any defaults. I wrote documentation and a test. If accepted, I am totally open for renaming the new option if --ignore-no-tests is considered a bad name.

Edited Jan 23, 2020 by Brad King
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: ctest-add-ignore-no-tests-option