`labgrid_test` causes ExecutionError due to empty program_prefix for root level targets
When running a labgrid_test
target which is in a BUILD.bazel file at the root of the module, a failure similar to this can be seen:
INFO: From Testing //:cat-release:
==================== Test output for //:cat-release:
/tmp/home/.cache/bazel/user/aa8becc1cf038ad66d33573a40643e89/sandbox/processwrapper-sandbox/575/execroot/_main/bazel-out/k8-fastbuild-ST-3dd539271c19/bin/cat-release.runfiles/openssh~/scp: dest open "/tmp/tmp.NSukY64cv1-EXECROOT/''/cat.sh": No such file or directory
/tmp/home/.cache/bazel/user/aa8becc1cf038ad66d33573a40643e89/sandbox/processwrapper-sandbox/575/execroot/_main/bazel-out/k8-fastbuild-ST-3dd539271c19/bin/cat-release.runfiles/openssh~/scp: failed to upload file /tmp/home/.cache/bazel/user/aa8becc1cf038ad66d33573a40643e89/sandbox/processwrapper-sandbox/575/execroot/_main/bazel-out/k8-fastbuild-ST-3dd539271c19/bin/cat-release.runfiles/_main/cat.sh to /tmp/tmp.NSukY64cv1-EXECROOT/''/cat.sh
Traceback (most recent call last):
File "/tmp/home/.cache/bazel/user/aa8becc1cf038ad66d33573a40643e89/sandbox/processwrapper-sandbox/575/execroot/_main/bazel-out/k8-fastbuild-ST-3dd539271c19/bin/cat-release.runfiles/_main/../rules_labgrid~/labgrid/run/_run_stage2_bootstrap.py", line 411, in <module>
main()
File "/tmp/home/.cache/bazel/user/aa8becc1cf038ad66d33573a40643e89/sandbox/processwrapper-sandbox/575/execroot/_main/bazel-out/k8-fastbuild-ST-3dd539271c19/bin/cat-release.runfiles/_main/../rules_labgrid~/labgrid/run/_run_stage2_bootstrap.py", line 407, in main
_run_py(main_filename, args=sys.argv[1:])
File "/tmp/home/.cache/bazel/user/aa8becc1cf038ad66d33573a40643e89/sandbox/processwrapper-sandbox/575/execroot/_main/bazel-out/k8-fastbuild-ST-3dd539271c19/bin/cat-release.runfiles/_main/../rules_labgrid~/labgrid/run/_run_stage2_bootstrap.py", line 266, in _run_py
runpy.run_path(main_filename, run_name="__main__")
File "<frozen runpy>", line 291, in run_path
File "<frozen runpy>", line 98, in _run_module_code
File "<frozen runpy>", line 88, in _run_code
File "/tmp/home/.cache/bazel/user/aa8becc1cf038ad66d33573a40643e89/sandbox/processwrapper-sandbox/575/execroot/_main/bazel-out/k8-fastbuild-ST-3dd539271c19/bin/cat-release.runfiles/_main/../rules_labgrid~/labgrid/run/__main__.py", line 138, in <module>
entry()
File "/tmp/home/.cache/bazel/user/aa8becc1cf038ad66d33573a40643e89/sandbox/processwrapper-sandbox/575/execroot/_main/bazel-out/k8-fastbuild-ST-3dd539271c19/bin/cat-release.runfiles/_main/../rules_labgrid~/labgrid/run/__main__.py", line 134, in entry
exit(main(Path(argv[0]), *argv[1:]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/home/.cache/bazel/user/aa8becc1cf038ad66d33573a40643e89/sandbox/processwrapper-sandbox/575/execroot/_main/bazel-out/k8-fastbuild-ST-3dd539271c19/bin/cat-release.runfiles/_main/../rules_labgrid~/labgrid/run/__main__.py", line 114, in main
return run(
^^^^
File "/tmp/home/.cache/bazel/user/aa8becc1cf038ad66d33573a40643e89/sandbox/processwrapper-sandbox/575/execroot/_main/bazel-out/k8-fastbuild-ST-3dd539271c19/bin/cat-release.runfiles/rules_labgrid~/labgrid/run/run.py", line 26, in run
r.put(uploads)
File "/tmp/home/.cache/bazel/user/aa8becc1cf038ad66d33573a40643e89/sandbox/processwrapper-sandbox/575/execroot/_main/bazel-out/k8-fastbuild-ST-3dd539271c19/bin/cat-release.runfiles/rules_labgrid~/bazel/labgrid/runner/runner.py", line 91, in put
self._transfer.put(local, remote)
File "/tmp/home/.cache/bazel/user/aa8becc1cf038ad66d33573a40643e89/sandbox/processwrapper-sandbox/575/execroot/_main/bazel-out/k8-fastbuild-ST-3dd539271c19/bin/cat-release.runfiles/rules_python~~pip~rules_labgrid-labgrid-3.11_311_labgrid/site-packages/labgrid/binding.py", line 102, in wrapper
return func(self, *_args, **_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/home/.cache/bazel/user/aa8becc1cf038ad66d33573a40643e89/sandbox/processwrapper-sandbox/575/execroot/_main/bazel-out/k8-fastbuild-ST-3dd539271c19/bin/cat-release.runfiles/rules_python~~pip~rules_labgrid-labgrid-3.11_311_labgrid/site-packages/labgrid/step.py", line 215, in wrapper
_result = func(*_args, **_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/home/.cache/bazel/user/aa8becc1cf038ad66d33573a40643e89/sandbox/processwrapper-sandbox/575/execroot/_main/bazel-out/k8-fastbuild-ST-3dd539271c19/bin/cat-release.runfiles/rules_python~~pip~rules_labgrid-labgrid-3.11_311_labgrid/site-packages/labgrid/driver/sshdriver.py", line 508, in put
raise ExecutionError(
labgrid.driver.exception.ExecutionError: error executing command: ['/tmp/home/.cache/bazel/user/aa8becc1cf038ad66d33573a40643e89/sandbox/processwrapper-sandbox/575/execroot/_main/bazel-out/k8-fastbuild-ST-3dd539271c19/bin/cat-release.runfiles/openssh~/scp', '-S', '/tmp/home/.cache/bazel/user/aa8becc1cf038ad66d33573a40643e89/sandbox/processwrapper-sandbox/575/execroot/_main/bazel-out/k8-fastbuild-ST-3dd539271c19/bin/cat-release.runfiles/openssh~/ssh', '-o', 'LogLevel=ERROR', '-F', 'none', '-o', 'ControlPath=/tmp/lg-ssh-dsoqoghv/control-*.*.*.*', '-P', '22', '-r', PosixPath('/tmp/home/.cache/bazel/user/aa8becc1cf038ad66d33573a40643e89/sandbox/processwrapper-sandbox/575/execroot/_main/bazel-out/k8-fastbuild-ST-3dd539271c19/bin/cat-release.runfiles/_main/cat.sh'), "user@*.*.*.*:/tmp/tmp.NSukY64cv1-EXECROOT/''/cat.sh"]
The main issue here is with the constructed path /tmp/tmp.NSukY64cv1-EXECROOT/''/cat.sh
as there are some empty quotes where the program_prefix goes.
As this is in the root of the MODULE the prefix is empty and the current handling of that causes the empty single quotes to be added to the path rather than not being added at all.
The expectation would be to have the program be located at /tmp/tmp.NSukY64cv1-EXECROOT/cat.sh
.