do less work in 'go test -short'

Only reduces the approximate elapsed time on my laptop from 7.8s to
7.5s, but that's still a win.
pull/22/head
Daniel Martí 4 years ago
parent d72c00eafd
commit 53272a1eda

@ -1,18 +1,3 @@
# Check that the program works as expected without garble.
exec go build main.go
exec ./main
cmp stderr main.stderr
# The default build includes DWARF and the symbol table.
[!windows] [exec:readelf] exec readelf --section-headers main$exe
[!windows] [exec:readelf] stdout 'debug_info'
[!windows] [exec:readelf] stdout '\.symtab'
# The default build includes full non-trimmed paths, as well as our names.
# Only check $WORK on non-windows, because it's difficult to do it there.
binsubstr main$exe 'globalVar' 'globalFunc'
[!windows] binsubstr main$exe ${WORK@R}
# Check that we fail if the user forgot -trimpath.
! exec go build -a -toolexec=garble main.go
stderr 'should be used alongside -trimpath'
@ -38,6 +23,22 @@ garble build main.go
! binsubstr main$exe 'globalVar'
bincmp main$exe main_old$exe
# Check that the program works as expected without garble. No need to verify
# this when we run with -short.
exec go build main.go
exec ./main
cmp stderr main.stderr
# The default build includes DWARF and the symbol table.
[!windows] [exec:readelf] exec readelf --section-headers main$exe
[!windows] [exec:readelf] stdout 'debug_info'
[!windows] [exec:readelf] stdout '\.symtab'
# The default build includes full non-trimmed paths, as well as our names.
# Only check $WORK on non-windows, because it's difficult to do it there.
binsubstr main$exe 'globalVar' 'globalFunc'
[!windows] binsubstr main$exe ${WORK@R}
-- main.go --
package main

@ -1,13 +1,15 @@
exec go build
exec ./main
cmp stdout main.stdout-orig
binsubstr main$exe '(devel)'
garble build
exec ./main
cmp stdout main.stdout
! binsubstr main$exe '(devel)'
[short] stop # no need to verify this with -short
exec go build
exec ./main
cmp stdout main.stdout-orig
binsubstr main$exe '(devel)'
-- go.mod --
module foo.com/main
-- main.go --

@ -1,6 +1,3 @@
exec go test -v
stdout 'PASS.*TestFoo'
garble test -c
binsubstr bar.test$exe 'TestFoo' 'TestSeparateFoo'
! binsubstr bar.test$exe 'ImportedVar'
@ -9,6 +6,11 @@ exec ./bar.test -test.v
stdout 'PASS.*TestFoo'
stdout 'PASS.*TestSeparateFoo'
[short] stop # no need to verify this with -short
exec go test -v
stdout 'PASS.*TestFoo'
-- go.mod --
module foo.com/bar
-- bar.go --

Loading…
Cancel
Save