Skip to content

Conversation

@ramonasuncion
Copy link
Member

Remove subshells, command substitution, and env PATH.

Partially address: #84407

Replace (cd %t && ...) with cd %t && ...
Replace env PATH manipulation with Swift driver's -tools-directory flag
to specify location of fake linker.

This seems to work with lit's internal shell, though I'm not 100% certain
it's the right approach.
@ramonasuncion
Copy link
Member Author

Let me know if you'd like me to squash these commits or make any other changes.

Copy link
Member

@hnrklssn hnrklssn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@hnrklssn
Copy link
Member

@swift-ci please smoke test

// RUN: cat $(cat %t/output-filelist) | %FileCheck -check-prefix OUTPUT-FILELIST-CONTENTS %s
// RUN: cat $(cat %t/input-filelist) | %FileCheck -check-prefix INPUT-FILELIST-CONTENTS %s
// RUN: cat %t/output-filelist | xargs cat | %FileCheck -check-prefix OUTPUT-FILELIST-CONTENTS %s
// RUN: cat %t/input-filelist | xargs cat | %FileCheck -check-prefix INPUT-FILELIST-CONTENTS %s
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is xargs a builtin in lit?

Copy link
Member

@hnrklssn hnrklssn Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, so while this gives lit shell compatibility, it still requires that xargs is on the PATH. Do you have a suggestion for a Windows compatible approach?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it would be okay since tests have used Unix specific commands, as in this with // REQUIRES: OS=macosx. I'm just learning that might not be the same for UNSUPPORTED: OS=windows-msvc 🤦‍♂️

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's safe to assume (for the foreseeable future) that UNSUPPORTED: OS=windows-msvc implies POSIX compatibility. The question is why UNSUPPORTED: OS=windows-msvc is there in the first place. If it's just because of the bash-isms, then maybe we can enable this for Windows with some work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I don't think that UNSUPPORTED: OS=windows-msvc implies POSIX compatibility. We do have some of the tools, not all of them. I think that this might've been one of the early ones that I didn't find. A lot of tests were improperly annotated as not supporting Windows and we should fix that. As to how to support this on Windows, I would say that instead of using xargs we use temporary files and redirection.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make a note to create a patch and remove UNSUPPORTED: OS=windows-msvc.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh are you referring to building on Windows, but not targeting Windows? Or is there some other supported OS without POSIX?

@hnrklssn
Copy link
Member

@swift-ci please smoke test windows platform

@hnrklssn
Copy link
Member

I'll merge this for now, as internal shell support is still an improvement even without Windows support. Either of you are very welcome to file a follow-up to add Windows support if you feel like it @ramonasuncion @compnerd

@hnrklssn hnrklssn merged commit c8fc005 into swiftlang:main Oct 17, 2025
3 checks passed
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.

3 participants