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

cmd/go: test failures: TestGoInstallRebuildsStalePackagesInOtherGOPATH and TestBuildDashIInstallsDependencies #12205

Closed
pebbe opened this issue Aug 19, 2015 · 7 comments
Milestone

Comments

@pebbe
Copy link
Contributor

pebbe commented Aug 19, 2015

Installing Go from fresh source, release branch go1.5, I get:

--- FAIL: TestGoInstallRebuildsStalePackagesInOtherGOPATH (0.45s)
        go_test.go:251: running testgo [install p1]
        go_test.go:251: running testgo [list -f {{.Stale}} p1]
        go_test.go:266: standard output:
        go_test.go:267: false

        go_test.go:251: running testgo [list -f {{.Stale}} p2]
        go_test.go:266: standard output:
        go_test.go:267: false

        go_test.go:251: running testgo [list -f {{.Stale}} p2]
        go_test.go:266: standard output:
        go_test.go:267: false

        go_test.go:563: ./testgo list mypkg claims p2 is NOT stale, incorrectly
--- FAIL: TestBuildDashIInstallsDependencies (0.60s)
        go_test.go:251: running testgo [build -v -i x/y/bar]
        go_test.go:270: standard error:
        go_test.go:271: x/y/foo
                x/y/bar

        go_test.go:251: running testgo [build -v -i x/y/bar]
        go_test.go:270: standard error:
        go_test.go:271: x/y/bar

        go_test.go:251: running testgo [build -v -i x/y/bar]
        go_test.go:270: standard error:
        go_test.go:271: x/y/bar

        go_test.go:378: first build -i cmd did not build x/y/foo
        go_test.go:379: pattern x/y/foo not found in standard output or standard error
FAIL
FAIL    cmd/go  51.841s

$ for i in -s -r -v -m -p -i -o; do uname $i; done
Linux
2.6.32-5-amd64
#1 SMP Wed Jun 17 16:09:06 UTC 2015

x86_64
unknown
unknown
GNU/Linux

On another, virtually identical machine, it installs without problems:

$ for i in -s -r -v -m -p -i -o; do uname $i; done
Linux
2.6.32-5-amd64
#1 SMP Sat Jul 12 16:47:57 UTC 2014

x86_64
unknown
unknown
GNU/Linux

@ianlancetaylor ianlancetaylor added this to the Go1.5.1 milestone Aug 19, 2015
@ianlancetaylor ianlancetaylor changed the title Go 1.5 tests fail: TestGoInstallRebuildsStalePackagesInOtherGOPATH and TestBuildDashIInstallsDependencies cmd/go: test failures: TestGoInstallRebuildsStalePackagesInOtherGOPATH and TestBuildDashIInstallsDependencies Aug 19, 2015
@mwhudson
Copy link
Contributor

Do the systems differ in filesystem timestamp resolution? E.g. is the first one ext3, or ext4-that-was-once-ext3?

@pebbe
Copy link
Contributor Author

pebbe commented Aug 19, 2015

The first (failures) is nfs with /tmp on ext3

The second (all ok) is all ext3

@rsc
Copy link
Contributor

rsc commented Aug 25, 2015

This looks like an error in test logic, so not something for a point release.

It looks to me like func measureTick has the test backward:

func measureTick(path string) {
    st, err := os.Stat(path)
    if err != nil {
        // Default to one second, the most conservative value.
        mtimeTick = time.Second
        return
    }
    mtime := st.ModTime()
    t := time.Microsecond
    for mtime.Round(t).Equal(mtime) && t < time.Second {
        t *= 10
    }
    mtimeTick = t
}

I think that "for " should be "for !", negating the first half of the conjunction. If I'm reading it correctly, the current test will decide on microsecond precision for file systems with only second precision and vice versa.

@rsc rsc modified the milestones: Go1.6Early, Go1.5.1 Aug 25, 2015
@ianlancetaylor
Copy link
Contributor

I think the measureTick logic is correct. If rounding to t gives you the same time, you don't know anything--the time might have been a multiple of t anyhow. So you keep going. If rounding to t gives you a different time, then you can expect that a sleep of t will give you a different time.

@rsc
Copy link
Contributor

rsc commented Nov 4, 2015

@ianlancetaylor, yes, I was clearly misreading.

I wonder if maybe the os.Stat gets cached Linux data with microsecond resolution even though NFS only stores 1-second resolution, or something like that.

@rsc rsc modified the milestones: Go1.6, Go1.6Early Nov 4, 2015
@btracey
Copy link
Contributor

btracey commented Nov 23, 2015

As another point, I am seeing the exact same failure as @pebbe

btracey@vader ~/gover/go/src $ for i in -s -r -v -m -p -i -o; do uname $i; done
Linux
3.14.14-gentoo
#1 SMP Thu Oct 2 04:23:17 MDT 2014
x86_64
AMD Opteron(tm) Processor 6172
AuthenticAMD
GNU/Linux

@gopherbot
Copy link

CL https://golang.org/cl/17953 mentions this issue.

@rsc rsc closed this as completed in 06b46c0 Dec 17, 2015
@golang golang locked and limited conversation to collaborators Dec 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants