Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a flaky test failure in getentropy.c #398

Merged

Conversation

alexcrichton
Copy link
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
5 checks passed
@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