-
Notifications
You must be signed in to change notification settings - Fork 4k
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
env
attribute of *_test
rules should be able to overwrite variables like PATH
#14418
Comments
Looks like this is only an issue with native tests, passing over to server rules team to make a policy decision. Hopefully this problem goes away since Starlark doesn't use this mechanism in any case? |
@janakdr Does this mean we will lose this feature completely when the language specific rules are migrated to Starlark? This would surprise me since the |
I think it's the opposite: in a Starlark action, you can set the
environment to whatever you like via the `env` parameter of `actions.run.`
I'll defer to the rules team for a definitive answer, though.
|
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 90 days unless any other activity occurs. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale. |
The issue is still relevant and unresolved |
+1 to this request. |
@comius I think this should be higher than a P4. |
I submitted #22420 to fix this |
Fixes bazelbuild#14418 Closes bazelbuild#22420. PiperOrigin-RevId: 635740423 Change-Id: Iffd4d172c4175be2e1b6cfad04ddad2759adb987
Fixes #14418 Closes #22420. PiperOrigin-RevId: 635740423 Change-Id: Iffd4d172c4175be2e1b6cfad04ddad2759adb987 Commit 01a90d6 Co-authored-by: Keith Smiley <[email protected]>
Description of the problem / feature request:
The test rule attribute
env
should be able to overwrite environment variables, not just inject additional ones.Feature requests: what underlying problem are you trying to solve with this feature?
I am writing tests which require a custom
PATH
value.One could modify the
PATH
environment variable inside the test implementation, but I consider this a hacky workaround.--test_env
can do the required task, but it influences all tests, whereas I want to influence just some specific tests.Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
BUILD file
test implementation
command:
bazel test --test_output=all //:foo
The test will not print the expected
foo
.What operating system are you running Bazel on?
Ubuntu 20.04
What's the output of
bazel info release
?release 4.1.0
Have you found anything relevant by searching the web?
The documentation explicitly states
Specifies additional environment ...
.It seems the current behavior is intended. Still, I believe being able to overwrite
PATH
is a valid feature.No open issues discussing overwriting environment variables could be found.
The text was updated successfully, but these errors were encountered: