MCPcopy
hub / github.com/containerd/containerd / FuzzDiffCompare

Function FuzzDiffCompare

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

Source from the content-addressed store, hash-verified

61}
62
63func FuzzDiffCompare(f *testing.F) {
64 f.Fuzz(func(t *testing.T, data []byte) {
65 f := fuzz.NewConsumer(data)
66
67 lowerQty, err := f.GetInt()
68 if err != nil {
69 return
70 }
71 lower := make([]mount.Mount, 0)
72 for i := 0; i < lowerQty%30; i++ {
73 m := mount.Mount{}
74 err = f.GenerateStruct(&m)
75 if err != nil {
76 return
77 }
78 lower = append(lower, m)
79 }
80
81 upperQty, err := f.GetInt()
82 if err != nil {
83 return
84 }
85 upper := make([]mount.Mount, 0)
86 for i := 0; i < upperQty%30; i++ {
87 m := mount.Mount{}
88 err = f.GenerateStruct(&m)
89 if err != nil {
90 return
91 }
92 upper = append(upper, m)
93 }
94
95 ctx := context.Background()
96 tmpDir := t.TempDir()
97 cs, err := local.NewStore(tmpDir)
98 if err != nil {
99 return
100 }
101 walker := walking.NewWalkingDiff(cs)
102 _, _ = walker.Compare(ctx, lower, upper)
103 })
104}

Callers

nothing calls this directly

Calls 3

NewStoreFunction · 0.92
NewWalkingDiffFunction · 0.92
CompareMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…