You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
garble/testdata/scripts
Daniel Martí 2fa5697189
avoid panic on funcs that almost look like tests (#235)
The added test case used to crash garble:

	panic: runtime error: invalid memory address or nil pointer dereference [recovered]
		panic: runtime error: invalid memory address or nil pointer dereference
	[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x8fe71b]

	goroutine 1 [running]:
	golang.org/x/tools/go/ast/astutil.Apply.func1(0xc0001e8880, 0xc000221570)
		/go/pkg/mod/golang.org/x/tools@v0.0.0-20210115202250-e0d201561e39/go/ast/astutil/rewrite.go:47 +0x97
	panic(0x975bc0, 0xd6c610)
		/sdk/go1.15.8/src/runtime/panic.go:969 +0x1b9
	go/types.(*Named).Obj(...)
		/sdk/go1.15.8/src/go/types/type.go:473
	mvdan.cc/garble.isTestSignature(0xc0001e7080, 0xa02e84)
		/src/garble/main.go:1170 +0x7b
	mvdan.cc/garble.(*transformer).transformGo.func2(0xc000122df0, 0xaac301)
		/src/garble/main.go:1028 +0xff1

We were assuming that the first parameter was a named type, but that
might not be the case.

This crash was found out in the wild, from which a minimal repro was
written. We add two variants of it to the test data, just in case.
5 years ago
..
asm.txt testdata: don't let tests rely on rewriting mod files 5 years ago
basic.txt obfuscate unexported names like exported ones (#227) 5 years ago
cgo.txt testdata: don't let tests rely on rewriting mod files 5 years ago
debugdir.txt testdata: don't let tests rely on rewriting mod files 5 years ago
goprivate.txt obfuscate fewer std packages (#196) 5 years ago
goversion.txt testdata: simplify goversion test (#232) 5 years ago
help.txt include a "garble version" test (#221) 5 years ago
implement.txt testdata: don't let tests rely on rewriting mod files 5 years ago
imports.txt make the handling of import paths more robust 5 years ago
init.txt testdata: add test case for init funcs in many files (#208) 5 years ago
ldflags.txt testdata: don't let tests rely on rewriting mod files 5 years ago
linkname.txt fixed some bugs related to additional linkname corner cases (#210) 5 years ago
literals.txt do not try to obfuscate huge literals (#204) 5 years ago
modinfo.txt testdata: don't let tests rely on rewriting mod files 5 years ago
plugin.txt testdata: don't let tests rely on rewriting mod files 5 years ago
reverse.txt reverse: support unexported names and package paths (#233) 5 years ago
seed.txt testdata: don't let tests rely on rewriting mod files 5 years ago
syntax.txt avoid panic on funcs that almost look like tests (#235) 5 years ago
test.txt testdata: don't let tests rely on rewriting mod files 5 years ago
tiny.txt testdata: don't let tests rely on rewriting mod files 5 years ago