Fix tiny test

pull/128/head
pagran 5 years ago
parent 3764df54a7
commit 54667e5e51

@ -1,43 +1,33 @@
env GOPRIVATE=test/main
env TINY_PATTERN='^\/\/line :1$'
env DEFAULT_PATTERN='^\/\/line \w\.go:[1-9][0-9]*$'
env DEFAULT_STACK_PATTERN='^\t\w\.go:[1-9][0-9]*(\s\+0x[0-9a-f]+)?'
env TINY_STACK_PATTERN='^\t\?\?:[0-9][0-9]*(\s\+0x[0-9a-f]+)?$'
# Tiny mode
garble -tiny -debugdir=.obf-src build
exec ./main$exe
grep $TINY_PATTERN .obf-src/main/main.go
! grep $DEFAULT_PATTERN .obf-src/main/main.go
! exec ./main$exe
! stderr 'main\.go'
! stderr $DEFAULT_STACK_PATTERN
stderr $TINY_STACK_PATTERN
stderr '\? 0'
[short] stop # no need to verify this with -short
# Default mode
garble -debugdir=.obf-src build
# Check for file name leak protection
grep $TINY_PATTERN .obf-src/main/main.go
grep '^\/\/line :1$' .obf-src/main/main.go
# Check for default line obfuscation
grep $DEFAULT_PATTERN .obf-src/main/main.go
grep '^\/\/line \w\.go:[1-9][0-9]*$' .obf-src/main/main.go
exec ./main$exe
! exec ./main$exe
! stderr 'main\.go'
! stderr $TINY_STACK_PATTERN
stderr $DEFAULT_STACK_PATTERN
stderr '\w\.go 3'
-- go.mod --
module test/main
-- main.go --
package main
import "runtime"
func main() {
panic("Test")
}
_, file, line, _ := runtime.Caller(0)
println(file, line)
}
Loading…
Cancel
Save