diff --git a/go/atomic2/atomic128_test.go b/go/atomic2/atomic128_test.go index 499514f688a..eb48a016cbc 100644 --- a/go/atomic2/atomic128_test.go +++ b/go/atomic2/atomic128_test.go @@ -24,6 +24,17 @@ import ( ) func TestCompareAndSwap(t *testing.T) { + runCompareAndSwap(t) +} + +func TestCompareAndSwapWriteBarrier(t *testing.T) { + writeBarrier.enabled = true + require.True(t, writeBarrier.enabled, "writeBarrier should be enabled") + + runCompareAndSwap(t) +} + +func runCompareAndSwap(t *testing.T) { i1 := new(int) i2 := new(int) n := &PointerAndUint64[int]{p: unsafe.Pointer(i1), u: 12345}