cmake: Clean up testing code #1554

pull hebasto wants to merge 2 commits into bitcoin-core:master from hebasto:240626-ctest-cleanup changing 1 files +11 −9
  1. hebasto commented at 10:42 PM on June 26, 2024: member
    1. Delete CTest module.

    The CTest module handles CDash integration, which we do not use. It is not required for testing functionality.

    1. Clean up cases when to invoke enable_testing()

    The enable_testing() command invocation is required for add_test() commands, which are used only for {noverify_}tests, exhaustive_tests and examples.

  2. cmake: Delete `CTest` module
    The `CTest` module handles `CDash` integration, which we do not use. It
    is not required for testing functionality.
    6aa576515e
  3. real-or-random added the label assurance on Jun 27, 2024
  4. real-or-random added the label build on Jun 27, 2024
  5. real-or-random commented at 9:12 AM on June 27, 2024: contributor

    The enable_testing() command invocation is required for add_test() commands, which are used only for {noverify_}tests, exhaustive_tests and examples.

    I don't think it's required. It's just that add_test() has no effect without enable_testing().

    enable_testing() seems cheap. Couldn't we just run it always? Or do you think this has drawbacks?

  6. cmake: Call `enable_testing()` unconditionally
    This change simplifies the code.
    Also comments has been added to highlight the code structure.
    7c987ec89e
  7. hebasto force-pushed on Jun 27, 2024
  8. hebasto commented at 10:35 AM on June 27, 2024: member

    The enable_testing() command invocation is required for add_test() commands, which are used only for {noverify_}tests, exhaustive_tests and examples.

    I don't think it's required. It's just that add_test() has no effect without enable_testing().

    enable_testing() seems cheap.

    I agree.

    Couldn't we just run it always?

    Sure. The code has been adjusted.

    Or do you think this has drawbacks?

    I did some research and I haven't found any drawbacks. When enable_testing() is invoked and no tests being added, the created CTestTestfile.cmake files in the binary tree are noop/empty.

    It is recommended:

    to call enable_testing() somewhere in the top level CMakeLists.txt file. This would typically be done early, soon after the first project() call.

  9. real-or-random approved
  10. real-or-random commented at 10:47 AM on June 27, 2024: contributor

    utACK 7c987ec89e6cbee5d087683ba29b97012e679484

  11. theStack approved
  12. theStack commented at 10:40 AM on September 18, 2024: contributor

    ACK 7c987ec89e6cbee5d087683ba29b97012e679484

    I don't have too much knowledge about CMake, but following the discussion here and reading some CMake forum discussions (e.g. https://discourse.cmake.org/t/is-there-any-reason-to-prefer-include-ctest-or-enable-testing-over-the-other/1905/2), the simplification looks correct.

    I did some research and I haven't found any drawbacks. When enable_testing() is invoked and no tests being added, the created CTestTestfile.cmake files in the binary tree are noop/empty.

    Verified this by creating a fresh build directory via

    $ rm -rf ./build && cmake -B build -DSECP256K1_BUILD_BENCHMARK=OFF -DSECP256K1_BUILD_TESTS=OFF -DSECP256K1_BUILD_EXHAUSTIVE_TESTS=OFF -DSECP256K1_BUILD_CTIME_TESTS=OFF
    $ cat ./build/src/CTestTestfile.cmake
    

    and checking that the file only contains comment. If one of these options is ON, the file contains add_test(...) calls.

  13. real-or-random merged this on Sep 18, 2024
  14. real-or-random closed this on Sep 18, 2024

  15. hebasto deleted the branch on Sep 18, 2024
  16. vmta referenced this in commit d5f931329c on Sep 25, 2024
  17. achow101 referenced this in commit 5a0d3f1db5 on Oct 12, 2024
  18. hebasto referenced this in commit 5c425b5703 on Oct 16, 2024
  19. achow101 referenced this in commit c24b343141 on Oct 24, 2024
  20. vmta referenced this in commit 4d1f6d5635 on Oct 29, 2024
  21. achow101 referenced this in commit 378ca17fd1 on Nov 1, 2024
  22. achow101 referenced this in commit 2d46a89386 on Nov 4, 2024
  23. Eunovo referenced this in commit 55a2f7a840 on Nov 12, 2024
  24. vmta referenced this in commit f40affbf6c on Nov 21, 2024
  25. vmta referenced this in commit cc8d145633 on Nov 22, 2024
  26. janus referenced this in commit a4b4239cb4 on Jan 19, 2025
  27. div72 referenced this in commit af627d47c3 on Apr 12, 2025
  28. real-or-random referenced this in commit 211323d6b7 on Feb 13, 2026
  29. github-actions[bot] referenced this in commit 758d4e90b4 on Mar 1, 2026
  30. github-actions[bot] referenced this in commit 68a2178f22 on Mar 1, 2026
  31. github-actions[bot] referenced this in commit a8bc1a0b2b on Mar 1, 2026
  32. 0x000000000019d6689c085ae165831e934ff76 referenced this in commit 3b9450150d on Mar 2, 2026
  33. csjones referenced this in commit a4d92824ae on Mar 2, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-19 06:52 UTC