mirror of https://github.com/golang/go.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 <iant@google.com> Auto-Submit: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
9dc572eab5
commit
ba50de8429
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue