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
+7
View File
@@ -7,6 +7,7 @@ import (
"bytes"
"math/rand"
"os"
"runtime"
"testing"
"unsafe"
)
@@ -53,6 +54,8 @@ func TestAVX512DecodeKnownAnswers(t *testing.T) {
PutUint64(args, 40, uint64(cap(dst)))
out, err := k.CallFunc("decodeBlockAVX512", args)
runtime.KeepAlive(tt.src)
runtime.KeepAlive(dst)
if err != nil {
t.Fatalf("CallFunc: %v", err)
}
@@ -91,6 +94,8 @@ func TestAVX512DifferentialFuzz(t *testing.T) {
PutUint64(args, 40, uint64(cap(jitDst)))
out, err := k.CallFunc("decodeBlockAVX512", args)
runtime.KeepAlive(src)
runtime.KeepAlive(jitDst)
if err != nil {
t.Fatalf("iter %d: %v", i, err)
}
@@ -134,6 +139,8 @@ func TestAVX512WideCopy(t *testing.T) {
PutUint64(args, 40, uint64(n))
_, err := k.CallFunc("wideCopyAVX512", args)
runtime.KeepAlive(dst)
runtime.KeepAlive(src)
if err != nil {
t.Fatalf("wideCopyAVX512(n=%d): %v", n, err)
}