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: tests fail when run with -count=2 #37820

Closed
bcmills opened this issue Mar 12, 2020 · 1 comment
Closed

cmd/go: tests fail when run with -count=2 #37820

bcmills opened this issue Mar 12, 2020 · 1 comment
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Testing An issue that has been verified to require only test changes, not just a test failure.
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Mar 12, 2020

To try to narrow down the cause of #37573, I ran a bunch of cmd/go script tests in conjunction with test_race_install_cgo with -count=10.

I did not find the cause of the test_race_install_cgo failure. However, I did find that many of the script tests — which are supposed to be pretty much completely isolated from each other! — end up failing when run with a count greater than 1, mostly due to unexpected cache hits.

CC @jayconrod @matloob

go test proxy running at GOPROXY=http://127.0.0.1:43255/mod
go proxy: no archive rsc.io v1.1.0: file does not exist
go proxy: no archive golang.org/x v0.3.0: file does not exist
go proxy: no archive golang.org/x v0.1.0: file does not exist
go proxy: no archive golang.org v0.1.0: file does not exist
go proxy: no archive golang.org v0.3.0: file does not exist
go proxy: no archive rsc.io v1.5.1: file does not exist
go proxy: no archive example.com v0.1.0: file does not exist
go proxy: no archive example.com/newcycle v1.0.0: file does not exist
go proxy: no archive rsc.io v1.0.0: file does not exist
go proxy: no archive rsc.io v1.4.0: file does not exist
go proxy: no archive rsc.io v1.5.2: file does not exist
go proxy: no archive rsc.io v1.5.2: file does not exist
go proxy: no archive rsc.io v1.0.0: file does not exist
go proxy: no archive rsc.io v1.0.0: file does not exist
go proxy: no archive rsc.io v1.0.0: file does not exist
go proxy: no archive rsc.io v1.5.2: file does not exist
go proxy: no archive example.com v0.1.0: file does not exist
go proxy: no archive golang.org/x v0.3.0: file does not exist
go proxy: no archive golang.org v0.3.0: file does not exist
go proxy: no archive golang.org/x v0.1.0: file does not exist
go proxy: no archive golang.org v0.1.0: file does not exist
go proxy: no archive rsc.io v1.5.1: file does not exist
go proxy: no archive example.com/newcycle v1.0.0: file does not exist
go proxy: no archive rsc.io v1.4.0: file does not exist
go proxy: no archive rsc.io v1.0.0: file does not exist
go proxy: no archive rsc.io v1.5.2: file does not exist
go proxy: no archive rsc.io v1.0.0: file does not exist
go proxy: no archive rsc.io v1.0.0: file does not exist
go proxy: no archive rsc.io v1.0.0: file does not exist
go proxy: no archive rsc.io v1.0.0: file does not exist
go proxy: no archive rsc.io v1.1.0: file does not exist
--- FAIL: TestScript (0.01s)
    --- FAIL: TestScript/mod_get_tags (0.31s)
        script_test.go:194: 
            # get should add modules needed to build packages, even if those
            # dependencies are in sources excluded by build tags.
            # All build tags are considered true except "ignore". (0.221s)
            # Packages that are only imported in excluded files should not be built. (0.081s)
            > go get -x .
            [stderr]
            WORK=$WORK/tmp/go-build819388988
            > stderr 'compile.* -p m '
            FAIL: testdata/script/mod_get_tags.txt:18: no match for `(?m)compile.* -p m ` found in stderr
            
    --- FAIL: TestScript/mod_get_commit (0.29s)
        script_test.go:194: 
            # @commit should resolve
            # golang.org/x/text/language@commit should resolve.
            # Because of -d, the compiler should not run. (0.051s)
            # go get should skip build with no Go files in root (0.026s)
            # dropping -d, we should see a build. (0.203s)
            > [short] skip
            > go get -x golang.org/x/text/language@14c0d48
            [stderr]
            # get http://127.0.0.1:43255/mod/quiet/golang.org/@v/14c0d48.info
            # get http://127.0.0.1:43255/mod/quiet/golang.org/x/text/language/@v/14c0d48.info
            # get http://127.0.0.1:43255/mod/quiet/golang.org/x/@v/14c0d48.info
            # get http://127.0.0.1:43255/mod/quiet/golang.org/x/text/@v/14c0d48.info
            # get http://127.0.0.1:43255/mod/quiet/golang.org/@v/14c0d48.info: 404 Not Found (0.001s)
            # get http://127.0.0.1:43255/mod/quiet/golang.org/x/text/language/@v/14c0d48.info: 404 Not Found (0.001s)
            # get http://127.0.0.1:43255/mod/quiet/golang.org/x/@v/14c0d48.info: 404 Not Found (0.001s)
            # get http://127.0.0.1:43255/mod/quiet/golang.org/x/text/@v/14c0d48.info: 200 OK (0.001s)
            go: found golang.org/x/text/language in golang.org/x/text v0.3.0
            WORK=$WORK/tmp/go-build590178612
            > stderr 'compile|cp|gccgo .*language\.a$'
            FAIL: testdata/script/mod_get_commit.txt:18: no match for `(?m)compile|cp|gccgo .*language\.a$` found in stderr
            
    --- FAIL: TestScript/mod_edit_go (0.02s)
        script_test.go:194: 
            # Test support for go mod -edit to set language version. (0.017s)
            > env GO111MODULE=on
            > ! go build
            FAIL: testdata/script/mod_edit_go.txt:4: unexpected command success
            
    --- FAIL: TestScript/gcflags_patterns (0.05s)
        script_test.go:194: 
            # -gcflags=-e applies to named packages, not dependencies (0.049s)
            > go build -n -v -gcflags=-e z1 z2
            [stderr]
            
            #
            # z2
            #
            
            z2
            mkdir -p $WORK/b003/
            cat >$WORK/b003/importcfg << 'EOF' # internal
            # import config
            EOF
            cd $WORK/gopath/src/z2
            /usr/local/google/home/bcmills/bisect/pkg/tool/linux_amd64/compile -o $WORK/b003/_pkg_.a -trimpath "$WORK/b003=>" -e -p z2 -complete -buildid B0MNirRyL_4cV8ZO-Da-/B0MNirRyL_4cV8ZO-Da- -D "" -importcfg $WORK/b003/importcfg -pack ./z.go
            /usr/local/google/home/bcmills/bisect/pkg/tool/linux_amd64/buildid -w $WORK/b003/_pkg_.a # internal
            
            #
            # z1
            #
            
            z1
            mkdir -p $WORK/b001/
            cat >$WORK/b001/importcfg << 'EOF' # internal
            # import config
            packagefile y=/usr/local/google/home/bcmills/.cache/go-build/ae/ae4494b73616a9c0524ee0b67ccbfef1cf85ad84e80da9b414f9bae7010bc225-d
            packagefile z2=$WORK/b003/_pkg_.a
            EOF
            cd $WORK/gopath/src/z1
            /usr/local/google/home/bcmills/bisect/pkg/tool/linux_amd64/compile -o $WORK/b001/_pkg_.a -trimpath "$WORK/b001=>" -e -p z1 -complete -buildid pxd_ajIeoaTRmqDCZ8hd/pxd_ajIeoaTRmqDCZ8hd -D "" -importcfg $WORK/b001/importcfg -pack ./z.go
            /usr/local/google/home/bcmills/bisect/pkg/tool/linux_amd64/buildid -w $WORK/b001/_pkg_.a # internal
            > stderr 'compile.* -e.* -p z1'
            > stderr 'compile.* -e.* -p z2'
            > stderr 'compile.* -p y'
            FAIL: testdata/script/gcflags_patterns.txt:10: no match for `(?m)compile.* -p y` found in stderr
            
    --- FAIL: TestScript/cgo_flag_contains_space (0.65s)
        script_test.go:194: 
            > [short] skip
            > [!cgo] skip
            > go run -x main.go
            [stderr]
            WORK=$WORK/tmp/go-build564807454
            mkdir -p $WORK/b001/
            cat >$WORK/b001/importcfg.link << 'EOF' # internal
            packagefile command-line-arguments=/usr/local/google/home/bcmills/.cache/go-build/ca/cabf34d99b0a29dd113d8791223f70d4b945a777d5b4238801efbb3ddb56b7cf-d
            packagefile runtime/cgo=/usr/local/google/home/bcmills/bisect/pkg/linux_amd64/runtime/cgo.a
            packagefile syscall=/usr/local/google/home/bcmills/bisect/pkg/linux_amd64/syscall.a
            packagefile runtime=/usr/local/google/home/bcmills/bisect/pkg/linux_amd64/runtime.a
            packagefile internal/bytealg=/usr/local/google/home/bcmills/bisect/pkg/linux_amd64/internal/bytealg.a
            packagefile internal/oserror=/usr/local/google/home/bcmills/bisect/pkg/linux_amd64/internal/oserror.a
            packagefile internal/race=/usr/local/google/home/bcmills/bisect/pkg/linux_amd64/internal/race.a
            packagefile sync=/usr/local/google/home/bcmills/bisect/pkg/linux_amd64/sync.a
            packagefile internal/cpu=/usr/local/google/home/bcmills/bisect/pkg/linux_amd64/internal/cpu.a
            packagefile runtime/internal/atomic=/usr/local/google/home/bcmills/bisect/pkg/linux_amd64/runtime/internal/atomic.a
            packagefile runtime/internal/math=/usr/local/google/home/bcmills/bisect/pkg/linux_amd64/runtime/internal/math.a
            packagefile runtime/internal/sys=/usr/local/google/home/bcmills/bisect/pkg/linux_amd64/runtime/internal/sys.a
            packagefile errors=/usr/local/google/home/bcmills/bisect/pkg/linux_amd64/errors.a
            packagefile sync/atomic=/usr/local/google/home/bcmills/bisect/pkg/linux_amd64/sync/atomic.a
            packagefile internal/reflectlite=/usr/local/google/home/bcmills/bisect/pkg/linux_amd64/internal/reflectlite.a
            EOF
            mkdir -p $WORK/b001/exe/
            cd .
            /usr/local/google/home/bcmills/bisect/pkg/tool/linux_amd64/link -o $WORK/b001/exe/main -importcfg $WORK/b001/importcfg.link -s -w -buildmode=exe -buildid=IAgTYRyL2ebYjDRObcR6/_MAdnQ6JGWX0VdYH-MPS/H2BKhhfye0Z0qnod8v8q/IAgTYRyL2ebYjDRObcR6 -extld=gcc /usr/local/google/home/bcmills/.cache/go-build/ca/cabf34d99b0a29dd113d8791223f70d4b945a777d5b4238801efbb3ddb56b7cf-d
            $WORK/b001/exe/main
            > stderr '"-I[^"]+c flags"' # find quoted c flags
            FAIL: testdata/script/cgo_flag_contains_space.txt:5: no match for `(?m)"-I[^"]+c flags"` found in stderr
            
    --- FAIL: TestScript/build_gcflags (1.35s)
        script_test.go:194: 
            # Test that the user can override default code generation flags. (1.353s)
            > [gccgo] skip  # gccgo does not use -gcflags
            > [!cgo] skip
            > [!linux] skip  # test only works if c-archive implies -shared
            > [short] skip
            > go build -x -buildmode=c-archive -gcflags=all=-shared=false ./override.go
            [stderr]
            WORK=$WORK/tmp/go-build595545770
            mkdir -p $WORK/b003/
            cd /usr/local/google/home/bcmills/bisect/src/runtime/cgo
            CGO_LDFLAGS='"-g" "-O2" "-lpthread"' /usr/local/google/home/bcmills/bisect/pkg/tool/linux_amd64/cgo -objdir $WORK/b003/ -importpath runtime/cgo -import_runtime_cgo=false -import_syscall=false -exportheader=$WORK/b003/_cgo_install.h -- -I $WORK/b003/ -g -O2 -Wall -Werror ./cgo.go
            cd $WORK
            gcc -fno-caret-diagnostics -c -x c - -o /dev/null || true
            gcc -Qunused-arguments -c -x c - -o /dev/null || true
            gcc -fdebug-prefix-map=a=b -c -x c - -o /dev/null || true
            gcc -gno-record-gcc-switches -c -x c - -o /dev/null || true
            cd $WORK/b003
            TERM='dumb' gcc -I /usr/local/google/home/bcmills/bisect/src/runtime/cgo -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b003=/tmp/go-build -gno-record-gcc-switches -I ./ -g -O2 -Wall -Werror -o ./_x001.o -c _cgo_export.c
            TERM='dumb' gcc -I /usr/local/google/home/bcmills/bisect/src/runtime/cgo -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b003=/tmp/go-build -gno-record-gcc-switches -I ./ -g -O2 -Wall -Werror -o ./_x002.o -c cgo.cgo2.c
            cd /usr/local/google/home/bcmills/bisect/src/runtime/cgo
            TERM='dumb' gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b003=/tmp/go-build -gno-record-gcc-switches -I $WORK/b003/ -g -O2 -Wall -Werror -o $WORK/b003/_x003.o -c gcc_context.c
            TERM='dumb' gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b003=/tmp/go-build -gno-record-gcc-switches -I $WORK/b003/ -g -O2 -Wall -Werror -o $WORK/b003/_x004.o -c gcc_fatalf.c
            TERM='dumb' gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b003=/tmp/go-build -gno-record-gcc-switches -I $WORK/b003/ -g -O2 -Wall -Werror -o $WORK/b003/_x005.o -c gcc_libinit.c
            TERM='dumb' gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b003=/tmp/go-build -gno-record-gcc-switches -I $WORK/b003/ -g -O2 -Wall -Werror -o $WORK/b003/_x006.o -c gcc_linux_amd64.c
            TERM='dumb' gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b003=/tmp/go-build -gno-record-gcc-switches -I $WORK/b003/ -g -O2 -Wall -Werror -o $WORK/b003/_x007.o -c gcc_mmap.c
            TERM='dumb' gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b003=/tmp/go-build -gno-record-gcc-switches -I $WORK/b003/ -g -O2 -Wall -Werror -o $WORK/b003/_x008.o -c gcc_setenv.c
            TERM='dumb' gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b003=/tmp/go-build -gno-record-gcc-switches -I $WORK/b003/ -g -O2 -Wall -Werror -o $WORK/b003/_x009.o -c gcc_sigaction.c
            TERM='dumb' gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b003=/tmp/go-build -gno-record-gcc-switches -I $WORK/b003/ -g -O2 -Wall -Werror -o $WORK/b003/_x010.o -c gcc_traceback.c
            TERM='dumb' gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b003=/tmp/go-build -gno-record-gcc-switches -I $WORK/b003/ -g -O2 -Wall -Werror -o $WORK/b003/_x011.o -c gcc_util.c
            TERM='dumb' gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b003=/tmp/go-build -gno-record-gcc-switches -I $WORK/b003/ -g -O2 -Wall -Werror -o $WORK/b003/_x012.o -c gcc_amd64.S
            cd $WORK/b003
            TERM='dumb' gcc -I /usr/local/google/home/bcmills/bisect/src/runtime/cgo -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b003=/tmp/go-build -gno-record-gcc-switches -I ./ -g -O2 -Wall -Werror -o ./_cgo_main.o -c _cgo_main.c
            cd /usr/local/google/home/bcmills/bisect/src/runtime/cgo
            TERM='dumb' gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b003=/tmp/go-build -gno-record-gcc-switches -o $WORK/b003/_cgo_.o $WORK/b003/_cgo_main.o $WORK/b003/_x001.o $WORK/b003/_x002.o $WORK/b003/_x003.o $WORK/b003/_x004.o $WORK/b003/_x005.o $WORK/b003/_x006.o $WORK/b003/_x007.o $WORK/b003/_x008.o $WORK/b003/_x009.o $WORK/b003/_x010.o $WORK/b003/_x011.o $WORK/b003/_x012.o -g -O2 -lpthread
            TERM='dumb' /usr/local/google/home/bcmills/bisect/pkg/tool/linux_amd64/cgo -dynpackage cgo -dynimport $WORK/b003/_cgo_.o -dynout $WORK/b003/_cgo_import.go -dynlinker
            mkdir -p $WORK/b001/
            cp /usr/local/google/home/bcmills/.cache/go-build/3d/3d5bf3936f481e850ade7ff344ec767787423469308ae16f72f764fb3086ebe9-d $WORK/b001/_cgo_install.h
            cat >$WORK/b001/importcfg.link << 'EOF' # internal
            packagefile command-line-arguments=/usr/local/google/home/bcmills/.cache/go-build/09/0950f9844f94d443e64950b7a1c9e8da8eba46a8b27cc2cd776b1c1a37986971-d
            packagefile runtime/cgo=/usr/local/google/home/bcmills/.cache/go-build/a2/a208148e641d6c1aee1aad24cf9f9e8ecb1a03740227ffe33ccebbc405a946b9-d
            packagefile syscall=/usr/local/google/home/bcmills/.cache/go-build/b6/b6368e72958cae1e21c26bfa72a5112229c6857b52d52e0ad3899d4ca0c5c680-d
            packagefile runtime=/usr/local/google/home/bcmills/.cache/go-build/17/17c3ae38a0c854ec2aa74cbf9e7e9b679588cf35d07da97c4f8e361147e0bed8-d
            packagefile internal/bytealg=/usr/local/google/home/bcmills/.cache/go-build/63/63d4009a299a25385e22c5de5aa4f6430e0d2bd2e018e31bab0de58200eec837-d
            packagefile internal/oserror=/usr/local/google/home/bcmills/.cache/go-build/d7/d75cd1ae4ca58ff2809129c979920e98af841fe3cd8b3a4f3d025481b2b5556a-d
            packagefile internal/race=/usr/local/google/home/bcmills/.cache/go-build/d6/d6ba7ec49c9fbd1562bb25c56e87e6edd25d90dc0b2e9b197071030bf6c260a3-d
            packagefile sync=/usr/local/google/home/bcmills/.cache/go-build/a0/a07e83319e6d1c498961d840e296b8c4b5edb2ca8fc5e4698fae82b41b4040b8-d
            packagefile internal/cpu=/usr/local/google/home/bcmills/.cache/go-build/cf/cf52869c13539572f8f9d26e33b471c210774dd73545c37ff7b3c02fd8a579c6-d
            packagefile runtime/internal/atomic=/usr/local/google/home/bcmills/.cache/go-build/72/72a5a74431f6d7c7822305cca4c0a749749b3afb8726ed67b056fb18447f9a7b-d
            packagefile runtime/internal/math=/usr/local/google/home/bcmills/.cache/go-build/d2/d23a61dfe543aca264da4a9ea0a05624ffac7bd3a008993d309ba1d08f81f242-d
            packagefile runtime/internal/sys=/usr/local/google/home/bcmills/.cache/go-build/3b/3b72c458aa348b2993a9769e5b686d355559235c9b90fd7dd3a14e132b13117e-d
            packagefile errors=/usr/local/google/home/bcmills/.cache/go-build/41/416fc911db787c3c5bbf76b907d4a1fb9c5c631ed669d60ae07dca3501d487dc-d
            packagefile sync/atomic=/usr/local/google/home/bcmills/.cache/go-build/9a/9aef8644905e4c13c374973a8b29ab756ccd66a48189502f3feb4645ef357147-d
            packagefile internal/reflectlite=/usr/local/google/home/bcmills/.cache/go-build/34/342bb59557b08cb255e96e119a30cc07d84094c1032ca7b79d2f64d3c88c5d2a-d
            EOF
            mkdir -p $WORK/b001/exe/
            cd .
            /usr/local/google/home/bcmills/bisect/pkg/tool/linux_amd64/link -o $WORK/b001/exe/a.out.a -importcfg $WORK/b001/importcfg.link -installsuffix shared -buildmode=c-archive -buildid=SiyGwkIE2XW8gu-p_ZGA/CxBVTpir_hvfxWnvjqKN/Ij_IY1dDRxj_drIug0S4/SiyGwkIE2XW8gu-p_ZGA -extld=gcc /usr/local/google/home/bcmills/.cache/go-build/09/0950f9844f94d443e64950b7a1c9e8da8eba46a8b27cc2cd776b1c1a37986971-d
            /usr/local/google/home/bcmills/bisect/pkg/tool/linux_amd64/buildid -w $WORK/b001/exe/a.out.a # internal
            mv $WORK/b001/_cgo_install.h override.h
            mv $WORK/b001/exe/a.out.a override.a
            rm -r $WORK/b001/
            > stderr '^.*/compile (.* )?-shared (.* )?-shared=false'
            FAIL: testdata/script/build_gcflags.txt:11: no match for `(?m)^.*/compile (.* )?-shared (.* )?-shared=false` found in stderr
            
FAIL
FAIL	cmd/go	210.470s
FAIL
@bcmills bcmills added Testing An issue that has been verified to require only test changes, not just a test failure. NeedsFix The path to resolution is known, but the work has not been done. labels Mar 12, 2020
@bcmills bcmills added this to the Backlog milestone Mar 12, 2020
@bcmills bcmills self-assigned this Mar 12, 2020
@bcmills bcmills modified the milestones: Backlog, Go1.15 Mar 12, 2020
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/223140 mentions this issue: cmd/go: fix test failures with -count=2

@golang golang locked and limited conversation to collaborators Mar 12, 2021
@rsc rsc unassigned bcmills Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. 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

2 participants