Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
lima-vm
GitHub Repository: lima-vm/lima
Path: blob/master/pkg/imgutil/nativeimgutil/fuzz_test.go
2614 views
1
// SPDX-FileCopyrightText: Copyright The Lima Authors
2
// SPDX-License-Identifier: Apache-2.0
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
}
24
25