Skip to content

cquery ignores test config in .bazelrc files #13428

@illicitonion

Description

@illicitonion

I expect cquery when querying tests to reflect flags like --test_env and --test_arg. It appears to reflect these if they're specified on the command line, but not if they're in a .bazelrc file:

Reproduction (making a clean workspace for each run, so we're definitely not seeing weird leftover state from previous runs):

$ dir=$(mktemp -d); (cd "${dir}" && touch WORKSPACE && touch test.sh && chmod 0755 test.sh && echo >BUILD 'sh_test(name = "test", srcs = ["test.sh"])' && bazel cquery //:test 2>/dev/null)
//:test (86e5752)

$ dir=$(mktemp -d); (cd "${dir}" && touch WORKSPACE && touch test.sh && chmod 0755 test.sh && echo >BUILD 'sh_test(name = "test", srcs = ["test.sh"])' && bazel cquery //:test --test_arg=beep 2>/dev/null)
//:test (6a51fd2)

$ dir=$(mktemp -d); (cd "${dir}" && touch WORKSPACE && touch test.sh && chmod 0755 test.sh && echo >BUILD 'sh_test(name = "test", srcs = ["test.sh"])' && echo 'test --test_arg=beep' > .bazelrc && bazel cquery //:test 2>/dev/null)
//:test (86e5752)

cquery does appear to correctly pay attention to .bazelrc files for things that would affect the build actions that produce the tests, but appears to be ignored for things that would affect the test actions.

What operating system are you running Bazel on?

macOS

What's the output of bazel info release?

release 4.0.0

/cc @gregestren

Metadata

Metadata

Assignees

Labels

P3We're not considering working on this, but happy to review a PR. (No assignee)team-Configurabilityplatforms, toolchains, cquery, select(), config transitionstype: feature request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions