please
please copied to clipboard
Segfault when attempting to `test --shell` a non-test build target
MWE:
genrule(
name = "not_a_test",
cmd = "true",
)
$ plz test //:not_a_test
0 test targets and 0 tests run; 0 passed.
Total time: 10ms real, 0s compute.
but:
$ plz test //:not_a_test --shell
Temp directories prepared, total time 10ms:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xc36519]
goroutine 98 [running]:
github.com/thought-machine/please/src/core.(*BuildTarget).GetTestCommand(...)
src/core/build_target.go:1505
github.com/thought-machine/please/src/output.printTempDirs(0xc0004f0000, 0x7ffe3227e0c6?, 0x1, 0x0)
src/output/shell_output.go:429 +0x3d9
github.com/thought-machine/please/src/output.MonitorState(0xc0004f0000, 0x0, 0x1, 0x0, 0x1, 0x0, {0x0, 0x0})
src/output/shell_output.go:89 +0xb87
main.runPlease.func1()
src/please.go:1214 +0x46
created by main.runPlease in goroutine 1
src/please.go:1213 +0x4d9
In the latter case we should probably be checking that test_cmd is actually defined.