fix(verify): fix flaky JIT tests with global buffers and KeepAlive
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user