Skip to content

x/sys/unix: TestTime is flaky #33200

@QuLogic

Description

@QuLogic

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.TestingAn issue that has been verified to require only test changes, not just a test failure.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions