-
Notifications
You must be signed in to change notification settings - Fork 786
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
Add set_bits
fuzz test
#6394
Add set_bits
fuzz test
#6394
Conversation
self.write_data | ||
.resize(offset_write_bytes + len + extra_write_data_bytes, 0); | ||
|
||
// interestingly set_bits seems to assume the output is already zeroed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was surprised at this -- if we fill the target with random data the tests fail (I am not sure why)
self.expected_data.resize(self.write_data.len(), 0); | ||
self.expected_data.copy_from_slice(&self.write_data); | ||
|
||
self.expected_null_count = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fuzz tester runs this code to compute the expected output (using set_bit
and get_bit
)
d77e4c0
to
074e0f8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @alamb for creating this
Thank you @Dandandan |
Which issue does this PR close?
Part of #6288
Rationale for this change
The code in #6288 is tricky and includes many special cases and
unsafe
so extra testing is warrantedWhat changes are included in this PR?
Refactor the tests for
set_bits
into a struct and then implement a fuzzer that randomly generates test casesAre there any user-facing changes?
No, this is entirely testing