Skip to content

Commit

Permalink
internal/mmap: skip tests on linux/arm relying on 64-bit atomics
Browse files Browse the repository at this point in the history
As pointed out by [email protected], 64-bit atomics were unreliable on
linux/arm in Go 1.21, and only reliable in later go versions for ARMv7
or later. Skip the recently added tests that are flaking as a result.

Fixes golang/go#68389
Fixes golang/go#68458

Change-Id: Icb0826216995edd18ff31a0ee1773f62407b1e9b
Reviewed-on: https://go-review.googlesource.com/c/telemetry/+/600915
Reviewed-by: Cherry Mui <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
  • Loading branch information
findleyr committed Aug 5, 2024
1 parent b54ba84 commit 6a1b328
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions internal/mmap/mmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"sync"
"sync/atomic"
"testing"
Expand Down Expand Up @@ -52,8 +53,18 @@ func openMapped(name string) (*os.File, *mmap.Data, error) {
return f, data, nil
}

// Via golang/go#68389 and golang/go#68458, we learned that 64-bit atomics were
// unreliable on linux/arm in Go 1.21. This was fixed in
// https://go.dev/cl/525637, but only for ARMv7 and later.
func skipIfLinuxArm(t *testing.T) {
if runtime.GOOS == "linux" && runtime.GOARCH == "arm" {
t.Skipf("64-bit atomics may not work on linux/arm")
}
}

func TestSharedMemory(t *testing.T) {
testenv.SkipIfUnsupportedPlatform(t)
skipIfLinuxArm(t)

// This test verifies that Mmap'ed files are usable for concurrent
// cross-process atomic operations.
Expand Down Expand Up @@ -105,6 +116,7 @@ func TestSharedMemory(t *testing.T) {

func TestMultipleMaps(t *testing.T) {
testenv.SkipIfUnsupportedPlatform(t)
skipIfLinuxArm(t)

// This test verifies that multiple views of an mmapp'ed file may
// simultaneously exist for the current process. This is relied upon by
Expand Down

0 comments on commit 6a1b328

Please sign in to comment.