Skip to content

[test] Use dd instead of head -c. #32421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 22, 2020

Conversation

3405691582
Copy link
Member

head -c, to print the specified number of bytes, is a GNU extension.
Using dd for the same task should be somewhat more portable.

@compnerd
Copy link
Member

I wonder if it really is more portable ...

@compnerd
Copy link
Member

@swift-ci please test Windows platform

@3405691582
Copy link
Member Author

(I've briefly thought about whether py versions of the tools tests expect might be a good idea, but that's another kettle of fish...)

@compnerd
Copy link
Member

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - d06745777d466dd0c9b2e4a0a3bafa54bc089f4c

@3405691582
Copy link
Member Author

Okay, Mac OS X dd doesn't support status. Reworking...

@3405691582 3405691582 force-pushed the Test_OpenBSD_UseDD branch from d067457 to 6c2fb78 Compare June 18, 2020 01:01
@3405691582
Copy link
Member Author

Updated to use |& to make up for the lack of status=none on OS X. The grep will still behave as intended even if the dd status message gets input anyway; we shouldn't try to do anything more precise than that since the lit shell runner may not support it.

@compnerd
Copy link
Member

|& is a shell extension isnt it? That wont work on Windows.

@3405691582
Copy link
Member Author

The lit shell does support redirection and I remember seeing something mentioned somewhere about that construction being permitted, but documentation is rather vague about what the lit shell actually supports. Let me do some research.

@3405691582 3405691582 force-pushed the Test_OpenBSD_UseDD branch from 6c2fb78 to c733c2f Compare June 18, 2020 21:26
head -c, to print the specified number of bytes, is a GNU extension.
Using dd for the same task should be somewhat more portable.

Mac OS X does not have status=none, so redirect the status output away
instead. Despite appearances, redirecting with the Bourne shell-ism
`2>/dev/null` is fine on Windows since Windows executes with the
internal lit shell runner, which translates `/dev/null` to a temporary
file.
@3405691582 3405691582 force-pushed the Test_OpenBSD_UseDD branch from c733c2f to 18ecb1e Compare June 18, 2020 21:28
@3405691582
Copy link
Member Author

So, |& is indeed wrong, and forcing LIT_USE_INTERNAL_SHELL is a good way to confirm that when running the tests. I had avoided using 2>/dev/null thinking that would not be compatible, but this is actually what ought to work perfectly, since lit will translate this to a temporary file.

I've done so here. Sorry for the confusion!

@compnerd
Copy link
Member

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - d06745777d466dd0c9b2e4a0a3bafa54bc089f4c

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - d06745777d466dd0c9b2e4a0a3bafa54bc089f4c

@compnerd
Copy link
Member

@swift-ci please test Windows platform

@compnerd compnerd merged commit 09141ce into swiftlang:master Jun 22, 2020
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