You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add cfg = _test_arg_transition in configurations/cc_test/defs.bzl (#367)
Question for the bazel experts: Does configurations/cc_test work as
intended without the added `cfg = _test_arg_transition` in defs.bzl?
This PR changes mytest.cc to send `argv` to stdout.
Without the added `cfg = _test_arg_transition` in defs.bzl, `new arg`
does not appear in the output. See below.
The other changes are optional, they just make this example more
complete. Not being very familiar with the bazel mechanisms, it took me
a while to figure out the two tricks to 1. ensure that `args` are
handled correctly, and 2. the non-transitioned test is not run.
________
**WITHOUT** the added `cfg = _test_arg_transition` in defs.bzl
```
bazel test :all --test_output=all
```
```
MYTEST ARGV[0]: /usr/local/google/home/rwgk/.cache/bazel/_bazel_rwgk/bfd421ff56c7e52ce2de56579817e14d/sandbox/linux-sandbox/9/execroot/__main__/bazel-out/k8-fastbuild/bin/my-test.runfiles/__main__/my-test
MYTEST ARGV[1]: x
MYTEST ARGV[2]: y
MYTEST ARGV[3]: z
```
________
**WITH** the added `cfg = _test_arg_transition` in defs.bzl (i.e. this
PR as is)
```
MYTEST ARGV[0]: /usr/local/google/home/rwgk/.cache/bazel/_bazel_rwgk/bfd421ff56c7e52ce2de56579817e14d/sandbox/linux-sandbox/4/execroot/__main__/bazel-out/k8-fastbuild-ST-54535d7cadf4/bin/my-test.runfiles/__main__/my-test
MYTEST ARGV[1]: x
MYTEST ARGV[2]: y
MYTEST ARGV[3]: z
MYTEST ARGV[4]: new arg
```
0 commit comments