secp256k1 icon indicating copy to clipboard operation
secp256k1 copied to clipboard

cmake: Clean up testing code

Open hebasto opened this issue 1 year ago • 2 comments

  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.

hebasto avatar Jun 26 '24 22:06 hebasto

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?

real-or-random avatar Jun 27 '24 09:06 real-or-random

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.

hebasto avatar Jun 27 '24 10:06 hebasto