Skip to content

tests: set CURL_ENTROPY per test, not globally#17971

Closed
vszakats wants to merge 3 commits intocurl:masterfrom
vszakats:t-entropy
Closed

tests: set CURL_ENTROPY per test, not globally#17971
vszakats wants to merge 3 commits intocurl:masterfrom
vszakats:t-entropy

Conversation

@vszakats
Copy link
Member

@vszakats vszakats commented Jul 19, 2025

Setting CURL_ENTROPY in debug-enabled builds overrides the code paths
responsible for random number generation. To avoid masking issue there,
this patch moves CURL_ENTROPY settings to each test that requires it,
and stop setting it by default for all tests (in runner.pm).

This makes it possible to catch random generator issues in debug-enabled
builds; extending test coverage.

To keep offering a well-defined state for tests, make runner.pm delete
the CURL_ENTROPY env, if present.

Ref: #17970

@vszakats vszakats marked this pull request as draft July 19, 2025 16:45
@github-actions github-actions bot added the tests label Jul 19, 2025
@vszakats vszakats changed the title set CURL_ENTROPY per test, not globally try setting CURL_ENTROPY per test, not globally Jul 19, 2025
@vszakats vszakats changed the title try setting CURL_ENTROPY per test, not globally tests: try setting CURL_ENTROPY per test, not globally Jul 19, 2025
@vszakats vszakats changed the title tests: try setting CURL_ENTROPY per test, not globally tests: set CURL_ENTROPY per test, not globally Jul 19, 2025
@vszakats vszakats marked this pull request as ready for review July 19, 2025 17:28
@vszakats vszakats closed this in 1fcf225 Jul 19, 2025
@vszakats vszakats deleted the t-entropy branch July 19, 2025 19:31
vszakats added a commit that referenced this pull request Jul 20, 2025
To fix test 1308 in MultiSSL builds.

Failure was caused by the random number generator virtual function being
NULL, instead of pointing to the implementation in the runtime-selected
TLS backend. This could happen in MultiSSL builds when a functionality
was asking for a random number without triggering a VTLS function table
initialization first. Such functionality is MIME, or form data via MIME.

The reason CI did not catch it in an earlier MultiSSL GHA/windows job,
is that it was a debug-enabled one. In debug-enabled builds the test
runner was overriding the random number generator for all tests.

Fixed this by moving the override to the tests requiring it, via
1fcf225 #17971, enabling debug builds
to catch this issue.

Enable MultiSSL in two CI jobs, to verify this patch.

Fixing:
```
test 1308...[formpost tests]

libtests returned 44, when expecting 0
 1308: exit FAILED
[...]
=== Start of file stderr1308
 URL: log/3/test-1308
 tests/libtest/lib1308.c:70 Assertion 'res == 0' FAILED: curl_formget returned error
 tests/libtest/lib1308.c:72 Assertion 'total_size == 518' FAILED: curl_formget got wrong size back
 tests/libtest/lib1308.c:88 Assertion 'res == 0' FAILED: curl_formget returned error
 tests/libtest/lib1308.c:89 Assertion 'total_size == 899' FAILED: curl_formget got wrong size back
```
Ref: https://github.com/curl/curl/actions/runs/16387693424/job/46309536359?pr=17963#step:16:2515

Bug: #17963 (comment)

Closes #17970
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

1 participant