diff options
author | Jay Conrod <jayconrod@google.com> | 2019-01-04 17:30:36 -0500 |
---|---|---|
committer | Jay Conrod <jayconrod@google.com> | 2019-01-07 17:55:24 +0000 |
commit | e1b903788ac5e35ed0d0fb20d904eafedca02c81 (patch) | |
tree | 66495b2805e46002f6d27d239ac0df8bcd66cc2e | |
parent | 73fb3c38a685158591503a3d760ae6e1d1a2a565 (diff) | |
download | go-e1b903788ac5e35ed0d0fb20d904eafedca02c81.tar.gz go-e1b903788ac5e35ed0d0fb20d904eafedca02c81.zip |
cmd/go: deflake TestScript/gcflags_patterns
The check below can fail incorrectly if the buildid ends with '-p'.
! stderr 'compile.* -e .*-p [^z]'
This fix changes regular expressions to '-e.* -p' or '-N.* -p' instead
of '-e .*-p'. '-l' is no longer used because the compiler accepts
multiple flags starting with '-l' ('-e' and '-N' do not have this
problem), so there could be false matches.
Change-Id: I827c411de28624019a287f853acc9666e87cbfb9
Reviewed-on: https://go-review.googlesource.com/c/156327
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-rw-r--r-- | src/cmd/go/testdata/script/gcflags_patterns.txt | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/cmd/go/testdata/script/gcflags_patterns.txt b/src/cmd/go/testdata/script/gcflags_patterns.txt index 2d7e88647b..40f80b7d6e 100644 --- a/src/cmd/go/testdata/script/gcflags_patterns.txt +++ b/src/cmd/go/testdata/script/gcflags_patterns.txt @@ -2,28 +2,28 @@ # -gcflags=-e applies to named packages, not dependencies go build -n -v -gcflags=-e z1 z2 -stderr 'compile.* -e .*-p z1' -stderr 'compile.* -e .*-p z2' +stderr 'compile.* -e.* -p z1' +stderr 'compile.* -e.* -p z2' stderr 'compile.* -p y' -! stderr 'compile.* -e .*-p [^z]' +! stderr 'compile.* -e.* -p [^z]' # -gcflags can specify package=flags, and can be repeated; last match wins go build -n -v -gcflags=-e -gcflags=z1=-N z1 z2 -stderr 'compile.* -N .*-p z1' -! stderr 'compile.* -e .*-p z1' -! stderr 'compile.* -N .*-p z2' -stderr 'compile.* -e .*-p z2' +stderr 'compile.* -N.* -p z1' +! stderr 'compile.* -e.* -p z1' +! stderr 'compile.* -N.* -p z2' +stderr 'compile.* -e.* -p z2' stderr 'compile.* -p y' -! stderr 'compile.* -e .*-p [^z]' -! stderr 'compile.* -N .*-p [^z]' +! stderr 'compile.* -e.* -p [^z]' +! stderr 'compile.* -N.* -p [^z]' # -gcflags can have arbitrary spaces around the flags go build -n -v -gcflags=' z1 = -e ' z1 -stderr 'compile.* -e .*-p z1' +stderr 'compile.* -e.* -p z1' -# -gcflags='all=-N -l' should apply to all packages, even with go test -go test -c -n -gcflags='all=-N -l' z1 -stderr 'compile.* -N -l .*-p z3 ' +# -gcflags='all=-e' should apply to all packages, even with go test +go test -c -n -gcflags='all=-e' z1 +stderr 'compile.* -e.* -p z3 ' # -ldflags for implicit test package applies to test binary go test -c -n -gcflags=-N -ldflags=-X=x.y=z z1 |