1
0
mirror of https://github.com/golang/go synced 2024-11-17 06:34:53 -07:00

cmd/go: fix tests broken in CL 358539

CL 358539 revised the build-stamp format, and updated the git and hg
tests to match. However, the fossil and bzr tests were missed, and
were not caught on the builders due to the fact that none of the
builder images have the necessary VCS tools installed.

Updates #48802
Updates #49168

Change-Id: I6b9fd0e19b81cb539864c94ab0860f74e7be6748
Reviewed-on: https://go-review.googlesource.com/c/go/+/369743
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
Bryan C. Mills 2021-12-06 17:25:34 -05:00 committed by Bryan Mills
parent e07b02ff87
commit dc65c489cc
2 changed files with 30 additions and 24 deletions

View File

@ -31,14 +31,15 @@ cd ..
env PATH=$oldpath
rm .bzr
# If there is an empty repository in a parent directory, only "uncommitted" is tagged.
# If there is an empty repository in a parent directory, only "modified" is tagged.
exec bzr init
cd a
go install
go version -m $GOBIN/a$GOEXE
! stdout bzrrevision
! stdout bzrcommittime
stdout '^\tbuild\tbzruncommitted\ttrue$'
stdout '^\tbuild\tvcs=bzr$'
! stdout vcs.revision
! stdout vcs.time
stdout '^\tbuild\tvcs.modified=true$'
cd ..
# Revision and commit time are tagged for repositories with commits.
@ -47,9 +48,10 @@ exec bzr commit -m 'initial commit'
cd a
go install
go version -m $GOBIN/a$GOEXE
stdout '^\tbuild\tbzrrevision\t'
stdout '^\tbuild\tbzrcommittime\t'
stdout '^\tbuild\tbzruncommitted\tfalse$'
stdout '^\tbuild\tvcs=bzr$'
stdout '^\tbuild\tvcs.revision='
stdout '^\tbuild\tvcs.time='
stdout '^\tbuild\tvcs.modified=false$'
rm $GOBIN/a$GOEXE
# Building an earlier commit should still build clean.
@ -59,29 +61,30 @@ exec bzr commit -m 'add NEWS'
exec bzr update -r1
go install
go version -m $GOBIN/a$GOEXE
stdout '^\tbuild\tbzrrevision\t'
stdout '^\tbuild\tbzrcommittime\t'
stdout '^\tbuild\tbzruncommitted\tfalse$'
stdout '^\tbuild\tvcs=bzr$'
stdout '^\tbuild\tvcs.revision='
stdout '^\tbuild\tvcs.time='
stdout '^\tbuild\tvcs.modified=false$'
# Building with -buildvcs=false suppresses the info.
go install -buildvcs=false
go version -m $GOBIN/a$GOEXE
! stdout bzrrevision
! stdout vcs.revision
rm $GOBIN/a$GOEXE
# An untracked file is shown as uncommitted, even if it isn't part of the build.
# An untracked file is shown as modified, even if it isn't part of the build.
cp ../../outside/empty.txt .
go install
go version -m $GOBIN/a$GOEXE
stdout '^\tbuild\tbzruncommitted\ttrue$'
stdout '^\tbuild\tvcs.modified=true$'
rm empty.txt
rm $GOBIN/a$GOEXE
# An edited file is shown as uncommitted, even if it isn't part of the build.
# An edited file is shown as modified, even if it isn't part of the build.
cp ../../outside/empty.txt ../README
go install
go version -m $GOBIN/a$GOEXE
stdout '^\tbuild\tbzruncommitted\ttrue$'
stdout '^\tbuild\tvcs.modified=true$'
exec bzr revert ../README
rm $GOBIN/a$GOEXE

View File

@ -19,7 +19,7 @@ cd repo/a
# If there's no local repository, there's no VCS info.
go install
go version -m $GOBIN/a$GOEXE
! stdout fossilrevision
! stdout vcs.revision
rm $GOBIN/a$GOEXE
# If there is a repository, but it can't be used for some reason,
@ -44,30 +44,33 @@ exec fossil commit -m 'initial commit'
cd a
go install
go version -m $GOBIN/a$GOEXE
stdout '^\tbuild\tfossilrevision\t'
stdout '^\tbuild\tfossilcommittime\t'
stdout '^\tbuild\tfossiluncommitted\tfalse$'
stdout '^\tbuild\tvcs=fossil\n'
stdout '^\tbuild\tvcs.revision='
stdout '^\tbuild\tvcs.time='
stdout '^\tbuild\tvcs.modified=false$'
rm $GOBIN/a$GOEXE
# Building with -buildvcs=false suppresses the info.
go install -buildvcs=false
go version -m $GOBIN/a$GOEXE
! stdout fossilrevision
! stdout vcs.revision
rm $GOBIN/a$GOEXE
# An untracked file is shown as uncommitted, even if it isn't part of the build.
# An untracked file is shown as modified, even if it isn't part of the build.
cp ../../outside/empty.txt .
go install
go version -m $GOBIN/a$GOEXE
stdout '^\tbuild\tfossiluncommitted\ttrue$'
stdout '^\tbuild\tvcs=fossil\n'
stdout '^\tbuild\tvcs.modified=true$'
rm empty.txt
rm $GOBIN/a$GOEXE
# An edited file is shown as uncommitted, even if it isn't part of the build.
# An edited file is shown as modified, even if it isn't part of the build.
cp ../../outside/empty.txt ../README
go install
go version -m $GOBIN/a$GOEXE
stdout '^\tbuild\tfossiluncommitted\ttrue$'
stdout '^\tbuild\tvcs=fossil\n'
stdout '^\tbuild\tvcs.modified=true$'
exec fossil revert ../README
rm $GOBIN/a$GOEXE