From: Damien Neil Date: Thu, 20 Mar 2025 16:30:19 +0000 (-0700) Subject: os: skip atime checks in TestRootChtimes on plan9 X-Git-Tag: go1.25rc1~644 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=ba50de84299667dcaa2f4e6663078340bbae8c67;p=gostls13.git os: skip atime checks in TestRootChtimes on plan9 Plan 9 doesn't permit setting arbitrary atimes. Fixes #72957 Change-Id: Ia4e14c75ed7dcdefd4669c0c21884d5ead9ab2fb Reviewed-on: https://go-review.googlesource.com/c/go/+/659615 Reviewed-by: Ian Lance Taylor Auto-Submit: Damien Neil LUCI-TryBot-Result: Go LUCI --- diff --git a/src/os/root_test.go b/src/os/root_test.go index b91d85d176..4ca6f9c834 100644 --- a/src/os/root_test.go +++ b/src/os/root_test.go @@ -427,6 +427,9 @@ func TestRootChmod(t *testing.T) { } func TestRootChtimes(t *testing.T) { + // Don't check atimes if the fs is mounted noatime, + // or on Plan 9 which does not permit changing atimes to arbitrary values. + checkAtimes := !hasNoatime() && runtime.GOOS != "plan9" for _, test := range rootTestCases { test.run(t, func(t *testing.T, target string, root *os.Root) { if target != "" { @@ -466,7 +469,7 @@ func TestRootChtimes(t *testing.T) { if got := st.ModTime(); !times.mtime.IsZero() && !got.Equal(times.mtime) { t.Errorf("after root.Chtimes(%q, %v, %v): got mtime=%v, want %v", test.open, times.atime, times.mtime, got, times.mtime) } - if !hasNoatime() { + if checkAtimes { if got := os.Atime(st); !times.atime.IsZero() && !got.Equal(times.atime) { t.Errorf("after root.Chtimes(%q, %v, %v): got atime=%v, want %v", test.open, times.atime, times.mtime, got, times.atime) }