This is an archive of the discontinued LLVM Phabricator instance.

[lit] Fix internal env calling other internal commands
ClosedPublic

Authored by jdenny on Aug 20 2019, 4:27 PM.

Details

Summary

Without this patch, when using lit's internal shell, if env on a lit
RUN line calls cd, diff, or any of the other in-process shell
builtins that lit implements, lit accidentally searches for the latter
as an external executable.

This patch puts such builtins in a map so that boilerplate for them
need only be implemented once. This patch moves that handling after
processing of env so that env calling such a builtin can be
detected. Finally, because such calls appears to be useless, this
patch takes the safe approach of diagnosing them rather than
supporting them.

Diff Detail

Event Timeline

jdenny created this revision.Aug 20 2019, 4:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 20 2019, 4:27 PM
Herald added a subscriber: delcypher. · View Herald Transcript
rnk accepted this revision.Aug 20 2019, 4:46 PM

lgtm

I suppose you could add a test for composing env with in process builtins, but I think that's already in the next patch.

This revision is now accepted and ready to land.Aug 20 2019, 4:46 PM
In D66506#1638493, @rnk wrote:

lgtm

I suppose you could add a test for composing env with in process builtins, but I think that's already in the next patch.

Good point. I originally wrote this patch after the next one, and I forgot about that change when I reversed them. That also means this patch isn't NFC.

I'll clean that up before pushing.

Thanks!

jdenny updated this revision to Diff 216382.Aug 21 2019, 6:35 AM
jdenny retitled this revision from [lit][NFC] Capture boilerplate for in-process shell builtins to [lit] Fix internal env calling other internal commands.
jdenny edited the summary of this revision. (Show Details)

As discussed, moved relevant tests from D65697 to this patch, and rewrote summary to describe the non-NFC parts of this change.

This revision was automatically updated to reflect the committed changes.