| 1 | |
| 2 | |
| 3 | |
| 4 | package nativeimgutil |
| 5 | |
| 6 | import ( |
| 7 | "os" |
| 8 | "path/filepath" |
| 9 | "testing" |
| 10 | |
| 11 | "github.com/lima-vm/go-qcow2reader/image/raw" |
| 12 | "gotest.tools/v3/assert" |
| 13 | ) |
| 14 | |
| 15 | func FuzzConvertToRaw(f *testing.F) { |
| 16 | f.Fuzz(func(t *testing.T, imgData []byte, withBacking bool, size int64) { |
| 17 | srcPath := filepath.Join(t.TempDir(), "src.img") |
| 18 | destPath := filepath.Join(t.TempDir(), "dest.img") |
| 19 | err := os.WriteFile(srcPath, imgData, 0o600) |
| 20 | assert.NilError(t, err) |
| 21 | _ = convertTo(raw.Type, srcPath, destPath, &size, withBacking) |
| 22 | }) |
| 23 | } |