This is an archive of the discontinued LLVM Phabricator instance.

[lit] RUN commands without stdin.
AcceptedPublic

Authored by csigg on Oct 3 2022, 2:12 AM.

Details

Summary

This changes the initial stdin of a lit RUN command to be None, so that tools taking input from stdin do not see a zero-length input.

This will prevent issues like that one fixed in commit 720dd81.

Diff Detail

Event Timeline

csigg created this revision.Oct 3 2022, 2:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 3 2022, 2:12 AM
csigg requested review of this revision.Oct 3 2022, 2:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 3 2022, 2:12 AM
csigg edited the summary of this revision. (Show Details)Oct 3 2022, 2:24 AM

So what would such a tool see? Would it get an error trying to open stdin, or something else?

Needs a test in lit's own test suite.

jdenny added a subscriber: jdenny.Oct 3 2022, 1:56 PM
csigg updated this revision to Diff 464911.Oct 4 2022, 1:19 AM

Add test, fix external shell mode.

csigg updated this revision to Diff 464930.Oct 4 2022, 2:38 AM

Fix bazel config to actually test lit tests.

Create a separate test instead of reusing the shtest-timeout one.

csigg added a comment.Oct 4 2022, 2:39 AM

So what would such a tool see? Would it get an error trying to open stdin, or something else?

A tool reading from stdin would get stdin, not an error and not an empty string (which it did before this change).

Needs a test in lit's own test suite.

Done.

probinson accepted this revision.Oct 4 2022, 9:13 AM

So what would such a tool see? Would it get an error trying to open stdin, or something else?

A tool reading from stdin would get stdin, not an error and not an empty string (which it did before this change).

Ah. I interpreted that to mean "it will hang waiting for input" and then I see the test expects lit to timeout the test. That works.

LGTM

This revision is now accepted and ready to land.Oct 4 2022, 9:13 AM
csigg updated this revision to Diff 465096.Oct 4 2022, 11:28 AM

Fix clang tests that relied on empty input or accidentally did not provide the input in the RUN directive.

Herald added a project: Restricted Project. · View Herald Transcript
jhenderson added inline comments.
llvm/utils/lit/tests/Inputs/shtest-stdin/print-stdin.py
6

Nit: add newline at EOF.

llvm/utils/lit/tests/shtest-stdin.py
28

Nit: Don't have multiple \n at EOF (there should be exactly one).