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, Windows: empty string not passed to test #6277

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

xx_test.args, Windows: empty string not passed to test #6277

laszlocsomor opened this issue Oct 1, 2018 · 3 comments
Assignees
Labels
area-Windows Windows-specific issues and feature requests P2 We'll consider working on this in future. (Assignee optional) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug

Comments

@laszlocsomor
Copy link
Contributor

Description of the problem / feature request:

Bazel does not pass empty test arguments from *_test.args to the test.

This is the Windows counterpart of #6274. The notable difference is that not even --test_arg works.

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",
        "",
        "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="" --test_arg="qux"
(...)
  external/bazel_tools/tools/test/test-setup.sh ./x foo bar baz '' qux)
FAIL: //:x (see (...)/testlogs/x/test.log)
INFO: From Testing //:x:
==================== Test output for //:x:
TEST: argc=6
TEST: argv[0]=((...)/x.runfiles/__main__/x)
TEST: argv[1]=(foo)
TEST: argv[2]=(bar)
TEST: argv[3]=(baz)
TEST: argv[4]=()
TEST: argv[5]=(qux)
(...)

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?

  $ bazel info release
release 0.17.2
@jin jin added area-Windows Windows-specific issues and feature requests untriaged labels Oct 1, 2018
@laszlocsomor laszlocsomor self-assigned this Oct 5, 2018
@laszlocsomor laszlocsomor added type: bug P2 We'll consider working on this in future. (Assignee optional) and removed untriaged labels Oct 16, 2018
@laszlocsomor
Copy link
Contributor Author

I believe the culprit is the same as of #7387.

@laszlocsomor
Copy link
Contributor Author

I believe this will be fixed by #7454

@laszlocsomor
Copy link
Contributor Author

With Bazel 0.27, there's no difference between Windows and Linux behavior.
Closing this in favour of #6274.

@philwo philwo added the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Windows Windows-specific issues and feature requests P2 We'll consider working on this in future. (Assignee optional) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug
Projects
None yet
Development

No branches or pull requests

3 participants