Skip to content

Conversation

boomanaiden154
Copy link
Contributor

This test is a special case as it executes two commands that are special
cased in the internal shell implementation. env runs entirely inside the
internal shell whereas not is handled specially, but still executed
externally. The internal shell does reorder execution of these though,
putting env commands before not which means we do not pick up
environment variables set by not.

These complications make it easier to just ensure that we invoke the
actual env binary (by calling it through bash) rather than using the
internal shell implementation.

Fixes #106627 by fixing the test, but without fixing the redirection
issue given the complexity does not seem justified.

@ilovepi
Copy link
Contributor

ilovepi commented Sep 6, 2025

Should we update the lit implementation handling for not/env to avoid reordering those two commands when combined?

Created using spr 1.3.6

[skip ci]
Created using spr 1.3.6
Created using spr 1.3.6

[skip ci]
Created using spr 1.3.6
@boomanaiden154
Copy link
Contributor Author

Should we update the lit implementation handling for not/env to avoid reordering those two commands when combined?

We theoretically can, but it's not that simple. The test runner already explicitly reorders them due to how not needs to be run. I'm not sure of exact test cases where the following is relevant, but it seems like it would be difficult to tease apart, and was not worth it for this test based on my assessment:

# We had to search through the 'not' commands to find all the 'env'

Created using spr 1.3.6

[skip ci]
Created using spr 1.3.6
Created using spr 1.3.6

[skip ci]
Created using spr 1.3.6
Created using spr 1.3.6

[skip ci]
Created using spr 1.3.6
boomanaiden154 added a commit to boomanaiden154/llvm-project that referenced this pull request Sep 9, 2025
This test is a special case as it executes two commands that are special
cased in the internal shell implementation. env runs entirely inside the
internal shell whereas not is handled specially, but still executed
externally. The internal shell does reorder execution of these though,
putting env commands before not which means we do not pick up
environment variables set by not.

These complications make it easier to just ensure that we invoke the
actual env binary (by calling it through bash) rather than using the
internal shell implementation.

Fixes llvm#106627 by fixing the test, but without fixing the redirection
issue given the complexity does not seem justified.

Pull Request: llvm#157236
@boomanaiden154 boomanaiden154 changed the base branch from users/boomanaiden154/main.not-update-disable-symbolizationtest-to-work-with-internal-shell to main September 9, 2025 20:36
@boomanaiden154 boomanaiden154 merged commit 3e790bd into main Sep 9, 2025
13 of 15 checks passed
@boomanaiden154 boomanaiden154 deleted the users/boomanaiden154/not-update-disable-symbolizationtest-to-work-with-internal-shell branch September 9, 2025 20:37
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Sep 9, 2025
…nal shell

This test is a special case as it executes two commands that are special
cased in the internal shell implementation. env runs entirely inside the
internal shell whereas not is handled specially, but still executed
externally. The internal shell does reorder execution of these though,
putting env commands before not which means we do not pick up
environment variables set by not.

These complications make it easier to just ensure that we invoke the
actual env binary (by calling it through bash) rather than using the
internal shell implementation.

Fixes #106627 by fixing the test, but without fixing the redirection
issue given the complexity does not seem justified.

Reviewers: ilovepi, MaskRay, petrhosek

Reviewed By: MaskRay

Pull Request: llvm/llvm-project#157236
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[llvm-lit] The env command without args doesn't support redirection with lit internal shell
3 participants