I'm trying to run a go unit test that needs to exe...
# general
p
I'm trying to run a go unit test that needs to execute
nasm
. The executable is on my machine (
go test .
succeeds), I think it's just not accessible from the pants test sandbox:
Copy code
22:15:27.00 [INFO] Preserving local process execution dir /tmp/pants-sandbox-uPILeH for Run Go tests: //:myprog_pkg
22:15:27.02 [ERROR] Completed: Test with Go - //:myprog_pkg - failed (exit code 1).
--- FAIL: TestCompiledInt (0.01s)
    compile_test.go:19: unexpected error: nasm failed: exec: "nasm": executable file not found in $PATH
FAIL
Is there a way to either modify the $PATH for the sandbox or explicitly tell it to pull
nasm
inside the sandbox?
Looks like using an absolute path in the test is a workaround for now, though this seems fragile in the long run.
b
Yeah, I think a solution in Pants 2.16 (not yet released) might be to use a `system_binary` target as a dependency, e.g.
Copy code
system_binary(name="nasm", binary_name="nasm") # can use fingerprint... to ensure a correct version

go_test(..., dependencies=[":nasm"])
Maybe! I'm not 100% sure if that'll come through in the PATH though.
p
Thanks, I'll try that. The other workaround I'm having to use now is forcing PATH within the test itself so it can see everything it needs to run.
No luck with 2.16.0rc5, system_binary=..., dependencies=[":nasm"], and pants.backend.experimental.adhoc. I can with the PATH hack for a while.
b
ah well. Sorry for the poor advice! Support for this might be https://github.com/pantsbuild/pants/issues/18320
p
no worries I appreciate the effort. that issue and some of what it links to look promising
e
It looks like it already leaks PATH though.
p
that variable doesn't seem to affect the PATH used for the test_runner executable