diff options
Diffstat (limited to 'src/cmd/go')
-rw-r--r-- | src/cmd/go/internal/modfetch/codehost/git.go | 2 | ||||
-rw-r--r-- | src/cmd/go/internal/test/test.go | 2 | ||||
-rw-r--r-- | src/cmd/go/testdata/script/cover_coverpkg_partial.txt | 8 | ||||
-rw-r--r-- | src/cmd/go/testdata/script/reuse_git.txt | 44 | ||||
-rw-r--r-- | src/cmd/go/testdata/script/test_ppc64_linker_funcs.txt | 4 |
5 files changed, 36 insertions, 24 deletions
diff --git a/src/cmd/go/internal/modfetch/codehost/git.go b/src/cmd/go/internal/modfetch/codehost/git.go index 7d9e5d8..bab4c5e 100644 --- a/src/cmd/go/internal/modfetch/codehost/git.go +++ b/src/cmd/go/internal/modfetch/codehost/git.go @@ -554,7 +554,7 @@ func (r *gitRepo) stat(ctx context.Context, rev string) (info *RevInfo, err erro // an apparent Git bug introduced in Git 2.21 (commit 61c771), // which causes the handler for protocol version 1 to sometimes miss // tags that point to the requested commit (see https://go.dev/issue/56881). - _, err = Run(ctx, r.dir, "git", "fetch", "-f", "-c", "protocol.version=2", "--depth=1", r.remote, refspec) + _, err = Run(ctx, r.dir, "git", "-c", "protocol.version=2", "fetch", "-f", "--depth=1", r.remote, refspec) release() if err == nil { diff --git a/src/cmd/go/internal/test/test.go b/src/cmd/go/internal/test/test.go index 8a40547..13818b7 100644 --- a/src/cmd/go/internal/test/test.go +++ b/src/cmd/go/internal/test/test.go @@ -1396,7 +1396,7 @@ func (r *runTestActor) Act(b *work.Builder, ctx context.Context, a *work.Action) if p := a.Package; len(p.TestGoFiles)+len(p.XTestGoFiles) == 0 { reportNoTestFiles := true - if cfg.BuildCover && cfg.Experiment.CoverageRedesign { + if cfg.BuildCover && cfg.Experiment.CoverageRedesign && p.Internal.Cover.GenMeta { if err := sh.Mkdir(a.Objdir); err != nil { return err } diff --git a/src/cmd/go/testdata/script/cover_coverpkg_partial.txt b/src/cmd/go/testdata/script/cover_coverpkg_partial.txt index 5240241..ef7a4dd 100644 --- a/src/cmd/go/testdata/script/cover_coverpkg_partial.txt +++ b/src/cmd/go/testdata/script/cover_coverpkg_partial.txt @@ -39,6 +39,14 @@ go test -coverprofile=baz.p -coverpkg=./a,./d,./f ./b ./f stdout '^ok\s+M/b\s+\S+\s+coverage: 83.3% of statements in ./a, ./d, ./f' stdout '^\s*M/f\s+coverage: 0.0% of statements' +# This sub-test inspired by issue 65653: if package P is is matched +# via the package pattern supplied as the argument to "go test -cover" +# but P is not part of "-coverpkg", then we don't want coverage for P +# (including the specific case where P has no test files). +go test -coverpkg=./a ./... +stdout '^ok\s+M/a\s+\S+\s+coverage: 100.0% of statements in ./a' +stdout '^\s*\?\s+M/f\s+\[no test files\]' + -- a/a.go -- package a diff --git a/src/cmd/go/testdata/script/reuse_git.txt b/src/cmd/go/testdata/script/reuse_git.txt index 432f5a9..3c1b38b 100644 --- a/src/cmd/go/testdata/script/reuse_git.txt +++ b/src/cmd/go/testdata/script/reuse_git.txt @@ -7,7 +7,7 @@ env GOSUMDB=off # go mod download with the pseudo-version should invoke git but not have a TagSum or Ref. go mod download -x -json vcs-test.golang.org/git/hello.git@v0.0.0-20170922010558-fc3a09f3dc5c -stderr 'git fetch' +stderr 'git( .*)* fetch' cp stdout hellopseudo.json ! stdout '"(Query|TagPrefix|TagSum|Ref)"' stdout '"Version": "v0.0.0-20170922010558-fc3a09f3dc5c"' @@ -18,7 +18,7 @@ go clean -modcache # go mod download vcstest/hello should invoke git, print origin info go mod download -x -json vcs-test.golang.org/git/hello.git@latest -stderr 'git fetch' +stderr 'git( .*)* fetch' cp stdout hello.json stdout '"Version": "v0.0.0-20170922010558-fc3a09f3dc5c"' stdout '"VCS": "git"' @@ -33,13 +33,13 @@ stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"' # but still be careful not to include a TagSum or a Ref, especially not Ref set to HEAD, # which is easy to do when reusing the cached version from the @latest query. go mod download -x -json vcs-test.golang.org/git/hello.git@v0.0.0-20170922010558-fc3a09f3dc5c -! stderr 'git fetch' +! stderr 'git( .*)* fetch' cp stdout hellopseudo2.json cmpenv hellopseudo.json hellopseudo2.json # go mod download vcstest/hello@hash needs to check TagSum to find pseudoversion base. go mod download -x -json vcs-test.golang.org/git/hello.git@fc3a09f3dc5c -! stderr 'git fetch' +! stderr 'git( .*)* fetch' cp stdout hellohash.json stdout '"Version": "v0.0.0-20170922010558-fc3a09f3dc5c"' stdout '"Query": "fc3a09f3dc5c"' @@ -98,7 +98,7 @@ stdout '"RepoSum": "r1:c0/9JCZ25lxoBiK3[+]3BhACU4giH49flcJmBynJ[+]Jvmc="' # go mod download vcstest/tagtests should invoke git, print origin info go mod download -x -json vcs-test.golang.org/git/tagtests.git@latest -stderr 'git fetch' +stderr 'git( .*)* fetch' cp stdout tagtests.json stdout '"Version": "v0.2.2"' stdout '"Query": "latest"' @@ -135,7 +135,7 @@ stdout '"Hash": "c7818c24fa2f3f714c67d0a6d3e411c85a518d1f"' # go mod download vcstest/prefixtagtests should invoke git, print origin info go mod download -x -json vcs-test.golang.org/git/prefixtagtests.git/sub@latest -stderr 'git fetch' +stderr 'git( .*)* fetch' cp stdout prefixtagtests.json stdout '"Version": "v0.0.10"' stdout '"Query": "latest"' @@ -154,12 +154,12 @@ cp stdout all.json # clean the module cache, make sure that makes go mod download re-run git fetch, clean again go clean -modcache go mod download -x -json vcs-test.golang.org/git/hello.git@latest -stderr 'git fetch' +stderr 'git( .*)* fetch' go clean -modcache # reuse go mod download vcstest/hello result go mod download -reuse=hello.json -x -json vcs-test.golang.org/git/hello.git@latest -! stderr 'git fetch' +! stderr 'git( .*)* fetch' stdout '"Reuse": true' stdout '"Version": "v0.0.0-20170922010558-fc3a09f3dc5c"' stdout '"VCS": "git"' @@ -175,7 +175,7 @@ stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"' # reuse go mod download vcstest/hello pseudoversion result go mod download -reuse=hellopseudo.json -x -json vcs-test.golang.org/git/hello.git@v0.0.0-20170922010558-fc3a09f3dc5c -! stderr 'git fetch' +! stderr 'git( .*)* fetch' stdout '"Reuse": true' stdout '"Version": "v0.0.0-20170922010558-fc3a09f3dc5c"' stdout '"VCS": "git"' @@ -186,7 +186,7 @@ stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"' # reuse go mod download vcstest/hello@hash go mod download -reuse=hellohash.json -x -json vcs-test.golang.org/git/hello.git@fc3a09f3dc5c -! stderr 'git fetch' +! stderr 'git( .*)* fetch' stdout '"Reuse": true' stdout '"Query": "fc3a09f3dc5c"' stdout '"Version": "v0.0.0-20170922010558-fc3a09f3dc5c"' @@ -199,7 +199,7 @@ stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"' # reuse go mod download vcstest/hello/v9 error result ! go mod download -reuse=hellov9.json -x -json vcs-test.golang.org/git/hello.git/v9@latest -! stderr 'git fetch' +! stderr 'git( .*)* fetch' stdout '"Reuse": true' stdout '"Error":.*no matching versions' ! stdout '"TagPrefix"' @@ -210,7 +210,7 @@ stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"' # reuse go mod download vcstest/hello/sub/v9 error result ! go mod download -reuse=hellosubv9.json -x -json vcs-test.golang.org/git/hello.git/sub/v9@latest -! stderr 'git fetch' +! stderr 'git( .*)* fetch' stdout '"Reuse": true' stdout '"Error":.*no matching versions' stdout '"TagPrefix": "sub/"' @@ -221,7 +221,7 @@ stdout '"Hash": "fc3a09f3dc5cfe0d7a743ea18f1f5226e68b3777"' # reuse go mod download vcstest/hello@nonexist ! go mod download -reuse=hellononexist.json -x -json vcs-test.golang.org/git/hello.git@nonexist -! stderr 'git fetch' +! stderr 'git( .*)* fetch' stdout '"Reuse": true' stdout '"Version": "nonexist"' stdout '"Error":.*unknown revision nonexist' @@ -231,7 +231,7 @@ stdout '"RepoSum": "r1:c0/9JCZ25lxoBiK3[+]3BhACU4giH49flcJmBynJ[+]Jvmc="' # reuse go mod download vcstest/hello@1234567890123456789012345678901234567890 ! go mod download -reuse=hellononhash.json -x -json vcs-test.golang.org/git/hello.git@1234567890123456789012345678901234567890 -! stderr 'git fetch' +! stderr 'git( .*)* fetch' stdout '"Reuse": true' stdout '"Version": "1234567890123456789012345678901234567890"' stdout '"Error":.*unknown revision 1234567890123456789012345678901234567890' @@ -241,7 +241,7 @@ stdout '"RepoSum": "r1:c0/9JCZ25lxoBiK3[+]3BhACU4giH49flcJmBynJ[+]Jvmc="' # reuse go mod download vcstest/hello@v0.0.0-20220101120101-123456789abc ! go mod download -reuse=hellononpseudo.json -x -json vcs-test.golang.org/git/hello.git@v0.0.0-20220101120101-123456789abc -! stderr 'git fetch' +! stderr 'git( .*)* fetch' stdout '"Reuse": true' stdout '"Version": "v0.0.0-20220101120101-123456789abc"' stdout '"Error":.*unknown revision 123456789abc' @@ -251,7 +251,7 @@ stdout '"RepoSum": "r1:c0/9JCZ25lxoBiK3[+]3BhACU4giH49flcJmBynJ[+]Jvmc="' # reuse go mod download vcstest/tagtests result go mod download -reuse=tagtests.json -x -json vcs-test.golang.org/git/tagtests.git@latest -! stderr 'git fetch' +! stderr 'git( .*)* fetch' stdout '"Reuse": true' stdout '"Version": "v0.2.2"' stdout '"Query": "latest"' @@ -265,7 +265,7 @@ stdout '"Hash": "59356c8cd18c5fe9a598167d98a6843e52d57952"' # reuse go mod download vcstest/tagtests@v0.2.2 result go mod download -reuse=tagtestsv022.json -x -json vcs-test.golang.org/git/tagtests.git@v0.2.2 -! stderr 'git fetch' +! stderr 'git( .*)* fetch' stdout '"Reuse": true' stdout '"Version": "v0.2.2"' ! stdout '"Query":' @@ -279,7 +279,7 @@ stdout '"Hash": "59356c8cd18c5fe9a598167d98a6843e52d57952"' # reuse go mod download vcstest/tagtests@master result go mod download -reuse=tagtestsmaster.json -x -json vcs-test.golang.org/git/tagtests.git@master -! stderr 'git fetch' +! stderr 'git( .*)* fetch' stdout '"Reuse": true' stdout '"Version": "v0.2.3-0.20190509225625-c7818c24fa2f"' stdout '"Query": "master"' @@ -293,7 +293,7 @@ stdout '"Hash": "c7818c24fa2f3f714c67d0a6d3e411c85a518d1f"' # reuse go mod download vcstest/tagtests@master result again with all.json go mod download -reuse=all.json -x -json vcs-test.golang.org/git/tagtests.git@master -! stderr 'git fetch' +! stderr 'git( .*)* fetch' stdout '"Reuse": true' stdout '"Version": "v0.2.3-0.20190509225625-c7818c24fa2f"' stdout '"Query": "master"' @@ -307,7 +307,7 @@ stdout '"Hash": "c7818c24fa2f3f714c67d0a6d3e411c85a518d1f"' # go mod download vcstest/prefixtagtests result with json go mod download -reuse=prefixtagtests.json -x -json vcs-test.golang.org/git/prefixtagtests.git/sub@latest -! stderr 'git fetch' +! stderr 'git( .*)* fetch' stdout '"Version": "v0.0.10"' stdout '"Query": "latest"' stdout '"VCS": "git"' @@ -321,7 +321,7 @@ stdout '"Hash": "2b7c4692e12c109263cab51b416fcc835ddd7eae"' # reuse the bulk results with all.json ! go mod download -reuse=all.json -json vcs-test.golang.org/git/hello.git@latest vcs-test.golang.org/git/hello.git/v9@latest vcs-test.golang.org/git/hello.git/sub/v9@latest vcs-test.golang.org/git/tagtests.git@latest vcs-test.golang.org/git/tagtests.git@v0.2.2 vcs-test.golang.org/git/tagtests.git@master -! stderr 'git fetch' +! stderr 'git( .*)* fetch' stdout '"Reuse": true' ! stdout '"(Dir|Info|GoMod|Zip)"' @@ -329,7 +329,7 @@ stdout '"Reuse": true' cp tagtestsv022.json tagtestsv022badhash.json replace '57952' '56952XXX' tagtestsv022badhash.json go mod download -reuse=tagtestsv022badhash.json -x -json vcs-test.golang.org/git/tagtests.git@v0.2.2 -stderr 'git fetch' +stderr 'git( .*)* fetch' ! stdout '"Reuse": true' stdout '"Version": "v0.2.2"' ! stdout '"Query"' diff --git a/src/cmd/go/testdata/script/test_ppc64_linker_funcs.txt b/src/cmd/go/testdata/script/test_ppc64_linker_funcs.txt index 735b5dc..d789f89 100644 --- a/src/cmd/go/testdata/script/test_ppc64_linker_funcs.txt +++ b/src/cmd/go/testdata/script/test_ppc64_linker_funcs.txt @@ -14,6 +14,10 @@ go build -ldflags='-linkmode=internal' exec ./abitest stdout success +go build -buildmode=pie -o abitest.pie -ldflags='-linkmode=internal' +exec ./abitest.pie +stdout success + -- go.mod -- module abitest |