[PATCH] D65697: [lit] Fix internal env calling internal commands
Joel E. Denny via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 3 07:18:27 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, if `env` on a lit RUN line calls `env`, `diff`, or
any of the 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.
`env` calling `diff` or a shell builtin appears useless in all cases
so far, so this patch takes the safe approach of diagnosing that usage
rather than supporting it.
`env` calling `env` can make sense if one such `env` is within a lit
substitution, as in D65156 <https://reviews.llvm.org/D65156> and D65121 <https://reviews.llvm.org/D65121>. This patch ensures that lit
executes both as internal commands.
This patch also extends lit's test suite to check that lit doesn't
accidentally execute any of those internal commands as external
commands. It does so by putting fake failing versions of those
commands in `PATH` while the entire lit test suite is running. For
some reason I cannot put my finger on, I'm not feeling confident this
testing will behave as I expect on all platforms, so hopefully
reviewers can give advice. I can say that, without the fixes in the
rest of this patch but with the tests, this approach does catch
accidental external calls on my Ubuntu installation.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D65697
Files:
llvm/utils/lit/lit/TestRunner.py
llvm/utils/lit/tests/Inputs/fake-externals/:
llvm/utils/lit/tests/Inputs/fake-externals/cd
llvm/utils/lit/tests/Inputs/fake-externals/diff
llvm/utils/lit/tests/Inputs/fake-externals/env
llvm/utils/lit/tests/Inputs/fake-externals/export
llvm/utils/lit/tests/Inputs/fake-externals/fake-external.py
llvm/utils/lit/tests/Inputs/fake-externals/mkdir
llvm/utils/lit/tests/Inputs/fake-externals/rm
llvm/utils/lit/tests/Inputs/shtest-env/env-calls-cd.txt
llvm/utils/lit/tests/Inputs/shtest-env/env-calls-colon.txt
llvm/utils/lit/tests/Inputs/shtest-env/env-calls-diff.txt
llvm/utils/lit/tests/Inputs/shtest-env/env-calls-echo.txt
llvm/utils/lit/tests/Inputs/shtest-env/env-calls-env.txt
llvm/utils/lit/tests/Inputs/shtest-env/env-calls-export.txt
llvm/utils/lit/tests/Inputs/shtest-env/env-calls-mkdir.txt
llvm/utils/lit/tests/Inputs/shtest-env/env-calls-rm.txt
llvm/utils/lit/tests/lit.cfg
llvm/utils/lit/tests/shtest-env.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65697.213189.patch
Type: text/x-patch
Size: 14656 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190803/b366d71c/attachment.bin>
More information about the llvm-commits
mailing list