Open laszlocsomor opened 5 years ago
Oh noes. I think the chain of events that leads to this is:
which results in attempting to perform shell expansion on an empty argument, and because an empty string has no meaning as a lone shell argument, it's not added to the tokenized list. This is just plain wrong, but it goes so deep (and is in a generic part of the code) that I'm afraid fixing this will make many things blow up...
Given #6275, which reports similar problems with spaces in arguments... it seems that this code is going further and attempting to perform even more shell expansions on the arguments. I think the args
list shouldn't be subject to any kind of shell expansion/handling and passed to the test program directly...
I'm facing this with a py_test
target that passes some marker expressions down to the underlying pytest invocation, eg something that would go like pytest -m "markerA and not markerB"
is being placed in the py_test target like
py_test(
name = "test_foo",
args = [ "-m", "markerA and not markerB"],
....
)
In the pytest scenario it's taking the tokens individually and yielding
============================ no tests ran in 0.00s =============================
ERROR: file not found: and
Update looks like I could resolve it by enclosing in single quotes
args = [ "-m", "'markerA and not markerB'"],
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team (@bazelbuild/triage
) if you think this issue is still relevant or you are interested in getting the issue resolved.
@bazelbuild/triage Not stale
Description of the problem / feature request:
Bazel does not pass empty test arguments from
*_test.args
to the test, but it does pass them from--test_arg
.Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
BUILD
file:x.cc
file:Repro:
As you see the command line does not contain the "" argument from the BUILD file, but does from the
--test_arg
flag.What operating system are you running Bazel on?
Linux
What's the output of
bazel info release
?