Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xx_test.args: argument with space is split up #6275

Closed
laszlocsomor opened this issue Oct 1, 2018 · 2 comments
Closed

xx_test.args: argument with space is split up #6275

laszlocsomor opened this issue Oct 1, 2018 · 2 comments
Labels
duplicate P2 We'll consider working on this in future. (Assignee optional) team-Local-Exec Issues and PRs for the Execution (Local) team type: bug

Comments

@laszlocsomor
Copy link
Contributor

Description of the problem / feature request:

If a test arguments in *_test.args contains a space, Bazel splits it up before passing it to the test, but doesn't do the same for args from --test_arg

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

BUILD file:

cc_test(
    name = "x",
    srcs = ["x.cc"],
    args = [
        "foo",
        "a b",
        "bar",
    ],
)

x.cc file:

#include <stdio.h>

int main(int argc, char** argv) {
  printf("TEST: argc=%d\n", argc);
  for (int i = 0; i < argc; ++i) {
    printf("TEST: argv[%d]=(%s)\n", i, argv[i]);
  }
  return 1;  // make sure the test fails, so --test_output=errors prints the output
}

Repro:

  $ bazel test //:x -s --test_output=errors --test_arg="baz" --test_arg="c d" --test_arg="qux"
(...)
  external/bazel_tools/tools/test/test-setup.sh ./x foo a b bar baz 'c d' qux)
FAIL: //:x (see (...)/testlogs/x/test.log)
INFO: From Testing //:x:
==================== Test output for //:x:
TEST: argc=8
TEST: argv[0]=((...)/bin/x.runfiles/__main__/x)
TEST: argv[1]=(foo)
TEST: argv[2]=(a)
TEST: argv[3]=(b)
TEST: argv[4]=(bar)
TEST: argv[5]=(baz)
TEST: argv[6]=(c d)
TEST: argv[7]=(qux)

What operating system are you running Bazel on?

Linux

What's the output of bazel info release?

  $ bazel info release
release 0.17.2

Have you found anything relevant by searching the web?

See also #6274

@jin jin added area-Windows Windows-specific issues and feature requests untriaged labels Oct 1, 2018
@jin
Copy link
Member

jin commented Oct 1, 2018

@laszlocsomor assigning this to team-Windows, feel free to reassign if it's not right. thanks!

@laszlocsomor laszlocsomor self-assigned this Oct 5, 2018
@laszlocsomor laszlocsomor added type: bug team-Execution and removed area-Windows Windows-specific issues and feature requests labels Oct 16, 2018
@laszlocsomor laszlocsomor removed their assignment Oct 16, 2018
@philwo philwo added P2 We'll consider working on this in future. (Assignee optional) category: misc > testing and removed untriaged labels Oct 17, 2018
@jin jin added team-Local-Exec Issues and PRs for the Execution (Local) team and removed team-Execution labels Jan 14, 2019
@jmmv
Copy link
Contributor

jmmv commented May 12, 2020

Same root cause as #6274, which I'm fixing to better highlight all problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate P2 We'll consider working on this in future. (Assignee optional) team-Local-Exec Issues and PRs for the Execution (Local) team type: bug
Projects
None yet
Development

No branches or pull requests

4 participants