Add fuzzer version of randomized prevector test#18529
Add fuzzer version of randomized prevector test#18529maflcko merged 5 commits intobitcoin:masterfrom
Conversation
|
The fuzz tests are not shipped on our website, nor are they run as part of Concept ACK on the new fuzzing harness. |
a8c3f23 to
b1d24d1
Compare
|
@MarcoFalke Rebased, addressed your comments, and removed removal of the existing unit test (I've duplicated instead of creating a common shared class, as I expect the two to diverge - the existing test is much more suited as an approach for fuzzing, while we may want a few static cases instead as unit tests). |
|
ACK b1d24d1 🍬 Show signature and timestampSignature: |
b1d24d1 Reorder the test instructions by number (Pieter Wuille) c2ccadc Merge and generalize case 3 and case 6 (Pieter Wuille) 402ad5a Only run sanity check once at the end (Pieter Wuille) eda8309 Assert immediately rather than caching failure (Pieter Wuille) 5560845 Make a fuzzer-based copy of the prevector randomized test (Pieter Wuille) Pull request description: The current prevector test effectively randomly generates a number of operations to perform on a prevector and a normal vector, and checks consistency between the two. By converting this into a fuzzer the operations can be targetted rather than random. ACKs for top commit: MarcoFalke: ACK b1d24d1 🍬 Tree-SHA512: 2b5c62abcd5fee94f42db03400531484d98c59e7f4308e0e683c61aabcd9ce42f85c5d058d2d5e7f8221124f71d2112b6a5f3c80e5d0fdae265a70647747e92f
Summary: ``` The current prevector test effectively randomly generates a number of operations to perform on a prevector and a normal vector, and checks consistency between the two. By converting this into a fuzzer the operations can be targetted rather than random. ``` Backport of core [[bitcoin/bitcoin#18529 | PR18529]]. Test Plan: ninja bitcoin-fuzzers ./src/test/fuzz/prevector <path_to_corpus> Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Differential Revision: https://reviews.bitcoinabc.org/D9003
| test.resize(std::max(0, std::min(30, (int)test.size() + prov.ConsumeIntegralInRange<int>(0, 4) - 2))); | ||
| break; | ||
| case 2: | ||
| test.insert(prov.ConsumeIntegralInRange<size_t>(0, test.size()), 1 + prov.ConsumeBool(), prov.ConsumeIntegral<int>()); |
There was a problem hiding this comment.
post-merge question: Is there a reason to limit the number of elements inserted in this case to 1 or 2?
backport: bitcoin#18417, bitcoin#18521, bitcoin#18529, bitcoin#18176, bitcoin#18423, bitcoin#17926, bitcoin#18353, bitcoin#18407, bitcoin#18455, bitcoin#18565, bitcoin#18867 (fuzzing harness backports: part 2)
The current prevector test effectively randomly generates a number of operations to perform on a prevector and a normal vector, and checks consistency between the two.
By converting this into a fuzzer the operations can be targetted rather than random.