aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/testutil
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2022-11-22 12:10:18 +0100
committerDmitry Vyukov <dvyukov@google.com>2022-11-23 09:09:39 +0100
commitf46b2272283056876fb9df794e3c67d3a2c3c059 (patch)
tree3e6574e80ea6d8b11142627835a740074ec3449e /pkg/testutil
parent1c50689b39eb028d91a28951b8300b7970a2aca5 (diff)
executor: add test for zlib decompression
Diffstat (limited to 'pkg/testutil')
-rw-r--r--pkg/testutil/testutil.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/testutil/testutil.go b/pkg/testutil/testutil.go
index 9a8de26bd..566d728ef 100644
--- a/pkg/testutil/testutil.go
+++ b/pkg/testutil/testutil.go
@@ -22,3 +22,11 @@ func RandSource(t *testing.T) rand.Source {
t.Logf("seed=%v", seed)
return rand.NewSource(seed)
}
+
+func RandMountImage(r *rand.Rand) []byte {
+ const maxLen = 1 << 20 // 1 MB.
+ len := r.Intn(maxLen)
+ slice := make([]byte, len)
+ r.Read(slice)
+ return slice
+}