[PATCH] D66531: [lit] Fix `not` calling internal commands

Joel E. Denny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 21 06:55:36 PDT 2019


jdenny created this revision.
jdenny added reviewers: probinson, stella.stamenova, bd1976llvm, jlpeyton, rnk, mgorny.
Herald added a subscriber: delcypher.
Herald added a project: LLVM.

Without this patch, when using lit's internal shell, if `not` on a lit 
RUN line calls `env`, `diff`, or any of the other in-process shell
builtins that lit implements, lit accidentally searches for the latter
as an external executable.  What's worse is that works fine when a
developer is testing on a platform where those executables are 
available and behave as expected, but it then breaks on other
platforms.

`not` seems useful for some builtins, such as `diff`, so this patch
supports such uses.  `not --crash` does not seem useful for builtins,
so this patch diagnoses such uses.  In all cases, this patch ensures
shell builtins are found behind any sequence of `env` and `not`
commands.

`not` calling `env` calling an external command appears useful when
the `env` and external command are part of a lit substitution, as in
D65156 <https://reviews.llvm.org/D65156>.  This patch supports that by looking through any sequence of
`env` and `not` commands, building the environment from the `env`s,
and storing the `not`s.  The `not`s are then added back to the command
line without the `env`s to execute externally.  This avoids the need
to replicate the `not` implementation, in particular the `--crash`
option, in lit.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D66531

Files:
  llvm/utils/lit/lit/TestRunner.py
  llvm/utils/lit/tests/Inputs/shtest-env/env-calls-not-builtin.txt
  llvm/utils/lit/tests/Inputs/shtest-not/fail.py
  llvm/utils/lit/tests/Inputs/shtest-not/lit.cfg
  llvm/utils/lit/tests/Inputs/shtest-not/not-args-last-is-crash.txt
  llvm/utils/lit/tests/Inputs/shtest-not/not-args-nested-none.txt
  llvm/utils/lit/tests/Inputs/shtest-not/not-args-none.txt
  llvm/utils/lit/tests/Inputs/shtest-not/not-calls-cd.txt
  llvm/utils/lit/tests/Inputs/shtest-not/not-calls-colon.txt
  llvm/utils/lit/tests/Inputs/shtest-not/not-calls-diff-with-crash.txt
  llvm/utils/lit/tests/Inputs/shtest-not/not-calls-diff.txt
  llvm/utils/lit/tests/Inputs/shtest-not/not-calls-echo.txt
  llvm/utils/lit/tests/Inputs/shtest-not/not-calls-env-builtin.txt
  llvm/utils/lit/tests/Inputs/shtest-not/not-calls-export.txt
  llvm/utils/lit/tests/Inputs/shtest-not/not-calls-external.txt
  llvm/utils/lit/tests/Inputs/shtest-not/not-calls-mkdir.txt
  llvm/utils/lit/tests/Inputs/shtest-not/not-calls-rm.txt
  llvm/utils/lit/tests/Inputs/shtest-not/pass.py
  llvm/utils/lit/tests/Inputs/shtest-not/print_environment.py
  llvm/utils/lit/tests/shtest-env.py
  llvm/utils/lit/tests/shtest-not.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66531.216388.patch
Type: text/x-patch
Size: 18410 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190821/ea4695b9/attachment.bin>


More information about the llvm-commits mailing list