Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/sys/unix: TestTime is flaky #33200

Closed
QuLogic opened this issue Jul 20, 2019 · 1 comment
Closed

x/sys/unix: TestTime is flaky #33200

QuLogic opened this issue Jul 20, 2019 · 1 comment
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Testing An issue that has been verified to require only test changes, not just a test failure.
Milestone

Comments

@QuLogic
Copy link

QuLogic commented Jul 20, 2019

In golang.org/x/sys/unix/syscall_linux_test.go, the TestTime function is flaky. It calls unix.Time and time.Now and compares them for strict equality.

These values are only good to 1-second precision, but since the calls do not occur at exactly the same time, there is still a possibility that the latter call could refer to next second. The strict equality check does not account for this and so the test sporadically fails whenever you happen to hit that rollover between both function calls.

What version of Go are you using (go version)?

$ go version
go version go1.12.2 linux/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

It's an automated rebuild, so I can't get go env output, but it's running on ppc64le.

What did you do?

Run tests for golang.org/x/sys.

What did you expect to see?

Tests pass.

What did you see instead?

Sporadic failures here with an off-by-one difference:

Time: return value 1563602573 should be nearly equal to time.Now().Unix() 1563602574

@gopherbot gopherbot added this to the Unreleased milestone Jul 20, 2019
@ALTree ALTree added Testing An issue that has been verified to require only test changes, not just a test failure. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Jul 21, 2019
@gopherbot
Copy link

Change https://golang.org/cl/206861 mentions this issue: unix: accept time.Now()±1 as valid in TestTime

@bradfitz bradfitz changed the title x/sys: unix/syscall_linux_test.go:TestTime is flaky x/sys/unix: TestTime is flaky Nov 13, 2019
@golang golang locked and limited conversation to collaborators Nov 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Testing An issue that has been verified to require only test changes, not just a test failure.
Projects
None yet
Development

No branches or pull requests

3 participants