Fixes #30791 (comment):
Building with a fuzz engine fails, because the ctime tests are auto-detected in cmake, based on whether or not valgrind-devel is installed or not.
Fixes #30791 (comment):
Building with a fuzz engine fails, because the ctime tests are auto-detected in cmake, based on whether or not valgrind-devel is installed or not.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
For detailed information about the code coverage, see the test coverage report.
See the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
SECP256K1_BUILD_CTIME_TESTS=OFF
is sometimes overridden later on? Otherwise, this change is unclear, because the ctime tests (along with the other secp256k1 tests) are already supposedly controlled by BUILD_TESTS
, but now the ctime tests are being wrapped in another BUILD_TESTS
conditional? (adding a comment would be good, otherwise I assume anyone reading this code will assume the second conditional is redundant).
48@@ -49,6 +49,9 @@ set(SECP256K1_ENABLE_MODULE_RECOVERY ON CACHE BOOL "" FORCE)
49 set(SECP256K1_BUILD_BENCHMARK OFF CACHE BOOL "" FORCE)
50 set(SECP256K1_BUILD_TESTS ${BUILD_TESTS} CACHE BOOL "" FORCE)
51 set(SECP256K1_BUILD_EXHAUSTIVE_TESTS ${BUILD_TESTS} CACHE BOOL "" FORCE)
52+if(NOT BUILD_TESTS)
53+ set(SECP256K1_BUILD_CTIME_TESTS ${BUILD_TESTS} CACHE BOOL "" FORCE)
54+endif()
I think I’m missing something here. Isn’t it a bug that us already setting
SECP256K1_BUILD_CTIME_TESTS=OFF
is sometimes overridden later on? Otherwise, this change is unclear, because the ctime tests (along with the other secp256k1 tests) are already supposedly controlled byBUILD_TESTS
, but now the ctime tests are being wrapped in anotherBUILD_TESTS
conditional? (adding a comment would be good, otherwise I assume anyone reading this code will assume the second conditional is redundant). @fanquake Is the following comment a good explanation:
0if(NOT BUILD_TESTS)
1 # Do not force SECP256K1_BUILD_CTIME_TESTS to ON, as its default value depends on SECP256K1_VALGRIND.
2 set(SECP256K1_BUILD_CTIME_TESTS ${BUILD_TESTS} CACHE BOOL "" FORCE)
3endif()
?
I’m not sure, because in the case being fixed here (-DBUILD_FOR_FUZZING
), BUILD_TESTS=OFF
, so we aren’t forcing it to ON
?
It also doesn’t explain why our setting (of OFF
) is being overriden later. The same thing doesn’t happen if you pass -DSECP256K1_BUILD_CTIME_TESTS=OFF
when invoking cmake.
I’m not sure, because in the case being fixed here (
-DBUILD_FOR_FUZZING
),BUILD_TESTS=OFF
, so we aren’t forcing it toON
?
We cannot force it to ON
because the build will require the installed Valgrind, which is not always the case.
It also doesn’t explain why our setting (of
OFF
) is being overriden later.
When?
-DBUILD_FOR_FUZZING=ON
is passed.
Something like:
0# Always skip the ctime tests, if we are building no other tests.
1# Otherwise, they are built if Valgrind is available. See SECP256K1_VALGRIND.
?
Co-authored-by: fanquake <fanquake@gmail.com>
re-review ACK 23eedc5d1e24b3d31da7902ece5182b9b24672d8
only change is a comment