aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDamien Neil <dneil@google.com>2025-03-20 09:30:19 -0700
committerGopher Robot <gobot@golang.org>2025-03-20 11:23:35 -0700
commitba50de84299667dcaa2f4e6663078340bbae8c67 (patch)
treedf641c45171b74db4304a6df1283ca9d60cdaa03 /src
parent9dc572eab55b085b61877ecd4d7cc492e34dc3ab (diff)
downloadgo-ba50de84299667dcaa2f4e6663078340bbae8c67.tar.xz
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 <iant@google.com> Auto-Submit: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src')
-rw-r--r--src/os/root_test.go5
1 files changed, 4 insertions, 1 deletions
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)
}