Repository navigation
tests: run the wolfCrypt self-test once per make check and ctest - #12280
yosuke-wolfssl wants to merge 1 commit into
Conversation
- testsuite_test() runs wolfcrypt_test() in every build, with its own func_args, before the TLS tests. - configure.ac sets UNIT_TEST_WC_ARG to --no-wc when testsuite.test is built (examples enabled, leantls disabled), and scripts/unit.test passes it to tests/unit.test. - CMake passes --no-wc to the unit_test ctest entry when WOLFSSL_CRYPT_TESTS registers wolfcrypttest.
|
@claude review |
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the changes that avoid duplicate wolfCrypt self-test runs.
No open issues 🎉
What changed in this PR
This PR avoids duplicate wolfCrypt self-test runs during make check and ctest, reducing test time, especially for costly post-quantum configurations. Direct invocation of tests/unit.test still includes the self-test.
Changes:
- Separates wolfCrypt self-test execution from TLS test prerequisites in
testsuite_test(). - Passes
--no-wcto automated unit tests when a dedicated program owns the self-test. - Preserves unit-test self-test execution when no dedicated runner is available.
| File | Description |
|---|---|
testsuite/testsuite.c |
Runs the self-test independently of TLS tests, with wolfCrypt initialization and cleanup. |
scripts/unit.test.in |
Forwards the configured self-test skip argument through every launcher path. |
configure.ac |
Sets --no-wc when the testsuite program is built. |
CMakeLists.txt |
Adds --no-wc to CTest unit tests when crypto tests are enabled. |
Review effort: Balanced
There was a problem hiding this comment.
LGTM. This is a small test-harness change, and the conditions for passing --no-wc line up with where the wolfCrypt self-test still runs.
What was reviewed:
- configure.ac:
UNIT_TEST_WC_ARGuses the same test asBUILD_EXAMPLE_SERVERS, which is what gates buildingtestsuite.test.testsuite_test()now runs the self-test even without the TLS dependencies, so builds such asNO_WOLFSSL_CLIENTstill run it once. - CMake:
--no-wcis passed only underWOLFSSL_CRYPT_TESTS, the same option that registers thewolfcrypttestctest.tests/unit.calready accepts--no-wc.make checkrunsunit.testthroughscripts/unit.test, which now gets the flag. - testsuite.c: declarations stay at the top of the block (C90).
argc/argvare still used throughwc_argswhen the macro is undefined.NO_CRYPT_TESTskips the self-test in bothtestsuite.testandunit.test. Init and cleanup are balanced, andwolfSSL_Cleanupnow runs beforewc_SwDev_Cleanup. - I did not rebuild under the other feature-macro configurations AGENTS.md lists. This review covered the C code and the build conditions by reading only.
Extended reasoning...
The change touches testsuite/testsuite.c, configure.ac, scripts/unit.test.in and CMakeLists.txt. Together they stop make check and ctest from running the wolfCrypt self-test twice. It changes test and build plumbing only, not library code, and touches no security-sensitive runtime path. I checked the autotools condition against the testsuite.test build gate and the CMake condition against the wolfcrypttest registration, and both match. The --no-wc flag already exists in tests/unit.c. The repository has no CODEOWNERS file, and the timeline shows no outstanding reviewer objections.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #12280
Scan targets checked: wolfssl-bugs
Not reviewed (no scan target covers them): CMakeLists.txt, configure.ac, scripts/unit.test.in
Coverage: 1 of 1 in-scope changed file(s) opened by the reviewer
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Max
Problem
make checkruns the full wolfCrypt self-test twice: intestsuite.testand again inunit.test.ctestdoes the same withwolfcrypttestandunit_test.The cost is largest in the PQ small-mode configs, where XMSS dominates the self-test.
all-pq-small-noasmis the slowest config in its "Quantum Resistant Tests" shard. That shard hit the 45-minute timeout in 19 of about 100 recent PR runs, and passed at 44-45 minutes in another 12.Fix (
testsuite/testsuite.c)testsuite_test()runs the self-test in every build, then the TLS tests where the build has them (HAVE_TESTSUITE_TLS_TESTS_DEPENDENCIES).unit.testgets--no-wcwherever a dedicated program owns the self-test:unit.testtestsuite.testbuilttestsuite.test--no-wc--enable-leantlsunit.testWOLFSSL_CRYPT_TESTSwolfcrypttest--no-wcRunning
./tests/unit.testby hand still includes the self-test.Verification
all-pq-small-noasm,make checkon 4 CPUs (Linux aarch64): 582 s → 392 s, same results (18 pass, 7 skip; 2783 of 3311 API tests pass, the rest skip).make checkpassing, in: default,NO_WOLFSSL_CLIENT,no-tls-cryptocb-aesgcm-setkey-free,--enable-leantls,cryptocb-onlyECC (swdev + TLS),--enable-stacksize(stack use still reported).ctestrunsunit.test --no-wcandtestwolfcrypt; both pass.-Werror -pedantic -Wdeclaration-after-statement: clean.