aboutsummaryrefslogtreecommitdiffstats
path: root/prog/test_util.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-04-15 14:54:58 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-04-16 14:20:36 +0000
commitf8f619e676a9c568c10ac690b37f8b414cd0d52b (patch)
tree80b0b1f72e63158df06d9b83267f45555717e700 /prog/test_util.go
parentea9bf35499d55e77ffac7d9939bb53949162dac6 (diff)
prog: don't require preallocated buffer for exec encoding
If we send exec encoding to the fuzzer, it's not necessary to serialize exec encoding into existing buffer (currnetly we serialize directly into shmem). So simplify code by serializing into a new slice.
Diffstat (limited to 'prog/test_util.go')
-rw-r--r--prog/test_util.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/prog/test_util.go b/prog/test_util.go
index 71a52c809..eb15539ea 100644
--- a/prog/test_util.go
+++ b/prog/test_util.go
@@ -27,7 +27,6 @@ type DeserializeTest struct {
func TestDeserializeHelper(t *testing.T, OS, arch string, transform func(*Target, *Prog), tests []DeserializeTest) {
target := InitTargetTest(t, OS, arch)
- buf := make([]byte, ExecBufferSize)
for testidx, test := range tests {
t.Run(fmt.Sprint(testidx), func(t *testing.T) {
if test.StrictErr == "" {
@@ -75,7 +74,7 @@ func TestDeserializeHelper(t *testing.T, OS, arch string, transform func(*Target
if want != output && want != outputVerbose {
t.Fatalf("wrong serialized data:\n%s\nexpect:\n%s\n", outputVerbose, want)
}
- p.SerializeForExec(buf)
+ p.SerializeForExec()
}
}
})