Skip to content

Fix a flaky test failure in getentropy.c#398

Merged
alexcrichton merged 1 commit into
WebAssembly:mainfrom
alexcrichton:fix-flaky-getentropy-test
Mar 9, 2024
Merged

Fix a flaky test failure in getentropy.c#398
alexcrichton merged 1 commit into
WebAssembly:mainfrom
alexcrichton:fix-flaky-getentropy-test

Conversation

@alexcrichton
Copy link
Copy Markdown
Collaborator

This test looks to be asserting that getrandom never returns 256 consecutive zeros, but the way it's asserting that is summing up the bytes and asserting the sum is nonzero. Due to this being a signed addition, however, it's possible for the bytes to be nonzero and still trigger the assert. Locally running this test in a loop took 30 or so seconds before it triggered a failure.

I've updated the test to instead hunt for any entry which is not equal to zero and then assert that something is not zero.

This test looks to be asserting that `getrandom` never returns 256
consecutive zeros, but the way it's asserting that is summing up the
bytes and asserting the sum is nonzero. Due to this being a signed
addition, however, it's possible for the bytes to be nonzero and still
trigger the assert. Locally running this test in a loop took 30 or so
seconds before it triggered a failure.

I've updated the test to instead hunt for any entry which is not equal
to zero and then assert that something is not zero.
@alexcrichton alexcrichton merged commit 9389ea5 into WebAssembly:main Mar 9, 2024
@alexcrichton alexcrichton deleted the fix-flaky-getentropy-test branch March 9, 2024 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants