mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-07-26 07:58:14 +00:00
Fuzz Bucket CRDT (#1442)
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1442 Reviewed-by: Alex <lx@deuxfleurs.fr>
This commit is contained in:
@@ -13,6 +13,7 @@ libfuzzer-sys = { workspace = true }
|
||||
|
||||
garage_db.workspace = true
|
||||
garage_table.workspace = true
|
||||
garage_util.workspace = true
|
||||
garage_model = { workspace = true, default-features = false, features = ["arbitrary"] }
|
||||
|
||||
[[bin]]
|
||||
@@ -28,3 +29,10 @@ path = "fuzz_targets/mpu_crdt.rs"
|
||||
test = false
|
||||
doc = false
|
||||
bench = false
|
||||
|
||||
[[bin]]
|
||||
name = "bucket_crdt"
|
||||
path = "fuzz_targets/bucket_crdt.rs"
|
||||
test = false
|
||||
doc = false
|
||||
bench = false
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
#![no_main]
|
||||
|
||||
use garage_fuzz::check_crdt_laws;
|
||||
use garage_model::bucket_table::{Bucket, BucketParams};
|
||||
use garage_util::crdt::{self, Deletable};
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
|
||||
fn make(state: Deletable<BucketParams>) -> Bucket {
|
||||
Bucket {
|
||||
id: [0u8; 32].into(),
|
||||
state,
|
||||
}
|
||||
}
|
||||
|
||||
fuzz_target!(|inputs: (
|
||||
crdt::Deletable<BucketParams>,
|
||||
crdt::Deletable<BucketParams>,
|
||||
crdt::Deletable<BucketParams>
|
||||
)| {
|
||||
let (a, b, c) = inputs;
|
||||
check_crdt_laws(make(a), make(b), make(c));
|
||||
});
|
||||
Reference in New Issue
Block a user