MCPcopy Index your code
hub / github.com/containerd/containerd / FuzzDiffApply

Function FuzzDiffApply

contrib/fuzz/diff_fuzz_test.go:32–61  ·  view source on GitHub ↗
(f *testing.F)

Source from the content-addressed store, hash-verified

30)
31
32func FuzzDiffApply(f *testing.F) {
33 f.Fuzz(func(t *testing.T, data []byte) {
34 f := fuzz.NewConsumer(data)
35 mountsQty, err := f.GetInt()
36 if err != nil {
37 return
38 }
39 mounts := make([]mount.Mount, 0)
40 for i := 0; i < mountsQty%30; i++ {
41 m := mount.Mount{}
42 err = f.GenerateStruct(&m)
43 if err != nil {
44 return
45 }
46 mounts = append(mounts, m)
47 }
48 desc := ocispec.Descriptor{}
49 err = f.GenerateStruct(&desc)
50 if err != nil {
51 return
52 }
53 tmpDir := t.TempDir()
54 cs, err := local.NewStore(tmpDir)
55 if err != nil {
56 return
57 }
58 fsa := apply.NewFileSystemApplier(cs)
59 _, _ = fsa.Apply(context.Background(), desc, mounts)
60 })
61}
62
63func FuzzDiffCompare(f *testing.F) {
64 f.Fuzz(func(t *testing.T, data []byte) {

Callers

nothing calls this directly

Calls 3

NewStoreFunction · 0.92
NewFileSystemApplierFunction · 0.92
ApplyMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…