testdata: use the debugdir flag less often

In tiny.txt, we already check line numbers via stderr, so there's no
need to do that via -debugdir.

In syntax.txt, we only really care about what names remain in the
binary, not the names which remain in the source but don't affect the
binary.

These changes are important because -debugdir adds a non-trivial amount
of work, which will impede build caching once that feature lands. We
will likely make -debugdir support build caching eventually, but for
now, this preliminary change will make 'go test' much faster with build
caching.

And of course, the tests get simpler, which is nice.
pull/143/head
Daniel Martí 5 years ago
parent 00c1d5b11d
commit c3bee46a26

@ -49,7 +49,6 @@ grep '^\s+\w+ = append\(\w+,(\s+\w+\[\d+\][\^\-+]\w+\[\d+\],?)+\)$' .obf-src/mai
# XorSeed obfuscator. Detect type decFunc func(byte) decFunc # XorSeed obfuscator. Detect type decFunc func(byte) decFunc
grep '^\s+type \w+ func\(byte\) \w+$' .obf-src/main/extraLiterals.go grep '^\s+type \w+ func\(byte\) \w+$' .obf-src/main/extraLiterals.go
-- go.mod -- -- go.mod --
module test/main module test/main
-- main.go -- -- main.go --

@ -1,13 +1,11 @@
env GOPRIVATE='test/main,rsc.io/*' env GOPRIVATE='test/main,rsc.io/*'
garble -debugdir=debug build garble build
exec ./main$exe exec ./main$exe
cmp stderr main.stderr cmp stderr main.stderr
! binsubstr main$exe 'localName' 'globalConst' 'globalVar' 'globalType' 'valuable information' 'rsc.io' ! binsubstr main$exe 'localName' 'globalConst' 'globalVar' 'globalType' 'valuable information' 'rsc.io'
binsubstr debug/main/scopes.go 'localName' 'globalConst'
[short] stop # no need to verify this with -short [short] stop # no need to verify this with -short
go build go build

@ -11,13 +11,7 @@ stderr '\? 0'
# Default mode # Default mode
env GODEBUG= env GODEBUG=
garble -debugdir=.obf-src build garble build
# Check for file name leak protection
grep '^\/\/line :1$' .obf-src/main/main.go
# Check for default line obfuscation
grep '^\/\/line \w\.go:[1-9][0-9]*$' .obf-src/main/main.go
! exec ./main$exe ! exec ./main$exe
cmp stdout main.stdout cmp stdout main.stdout
stderr '\w\.go [1-9]' stderr '\w\.go [1-9]'
@ -47,4 +41,4 @@ func main() {
} }
-- main.stdout -- -- main.stdout --
ya like jazz? ya like jazz?

Loading…
Cancel
Save