]> Cypherpunks repositories - gostls13.git/commit
os: fix Chtimes test flakes
authorKir Kolyshkin <kolyshkin@gmail.com>
Thu, 8 Aug 2024 20:11:14 +0000 (13:11 -0700)
committerGopher Robot <gobot@golang.org>
Thu, 8 Aug 2024 23:35:45 +0000 (23:35 +0000)
commit84266e1469cfa6fa8e1b41518528a96950db7562
treea6de5fc778144b1999fc24e536f1736f62835d76
parented31d642cb3465ad9cf5d891285ea82948e26026
os: fix Chtimes test flakes

It appears that some builders (notably, linux-arm) have some additional
security software installed, which apparently reads the files created by
tests. As a result, test file atime is changed, making the test fail
like these:

=== RUN   TestChtimesOmit
    ...
    os_test.go:1475: atime mismatch, got: "2024-07-30 18:42:03.450932494 +0000 UTC", want: "2024-07-30 18:42:02.450932494 +0000 UTC"

=== RUN   TestChtimes
    ...
    os_test.go:1539: AccessTime didn't go backwards; was=2024-07-31 20:45:53.390326147 +0000 UTC, after=2024-07-31 20:45:53.394326118 +0000 UTC

According to inode(7), atime is changed when more than 0 bytes are read
from the file. So, one possible solution to these flakes is to make the
test files empty, so no one can read more than 0 bytes from them.

Fixes #68687
Fixes #68663

Change-Id: Ib9234567883ef7b16ff8811e3360cd26c2d6bdab
Reviewed-on: https://go-review.googlesource.com/c/go/+/604315
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Kirill Kolyshkin <kolyshkin@gmail.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
src/os/os_test.go