fix(verify): fix flaky JIT tests with global buffers and KeepAlive
Test / vet (push) Successful in 49s
Test / test (push) Failing after 2m9s
Test / build (push) Skipped

This commit is contained in:
2026-08-05 23:09:54 +02:00
parent 23b3d3e152
commit 19b37569c0
10 changed files with 323 additions and 38 deletions
+4
View File
@@ -5,6 +5,7 @@ package verify
import (
"bytes"
"runtime"
"testing"
"unsafe"
)
@@ -68,6 +69,7 @@ func TestJITSum(t *testing.T) {
PutUint64(args, 16, uint64(cap(tt.data)))
out, err := k.CallFunc("sum", args)
runtime.KeepAlive(tt.data)
if err != nil {
t.Fatalf("CallFunc(sum, %v): %v", tt.data, err)
}
@@ -111,6 +113,8 @@ func TestJITWideCopy(t *testing.T) {
PutUint64(args, 40, uint64(tt.n)) // src_cap
_, err := k.CallFunc("wideCopy", args)
runtime.KeepAlive(dst)
runtime.KeepAlive(src)
if err != nil {
t.Fatalf("CallFunc(wideCopy): %v", err)
}