This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] Better Windows support for running tests in external shell
ClosedPublic

Authored by broadwaylamb on Jul 9 2020, 8:36 AM.

Details

Summary

These changes are necessary to support remote running compiler-rt tests that were compiled on Windows.

Most of the code here has been copy-pasted from other lit configs.

Diff Detail

Event Timeline

broadwaylamb created this revision.Jul 9 2020, 8:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 9 2020, 8:36 AM
Herald added subscribers: Restricted Project, dberris. · View Herald Transcript

Can you add an explanation for why the conversion to ascii was removed? I don't immediately see why that is needed, not that ascii is a great choice.

Can you add an explanation for why the conversion to ascii was removed? I don't immediately see why that is needed, not that ascii is a great choice.

We set the universal_newlines argument to True in Popen instead. This is supported in both Python 2.7 and 3, is easier (no need to do the str(dir.decode('ascii')) dance) and less error prone.

Also, this is necessary because if the config is executed on Windows, and execute_external is True, we take the branch if sys.platform in ['win32'] and execute_external, and if we use Python 3, then the dir variable is a byte-like object, not str, but the replace method on byte-like objects requires its arguments to also be byte-like objects, which is incompatible with Python 2 etc etc.

It is a lot simpler to just work with strings in the first place, which is achieved by setting universal_newlines to True. As far as I understand, this way wasn't taken because of the need to support Python <2.7, but this is not the case now.

compnerd accepted this revision.Jul 9 2020, 9:27 AM

Ah, thanks for the explanation. I'm accepting the change, but would like that explanation also reflected in the commit message. I think that it is very helpful and explains why the change is being made.

This revision is now accepted and ready to land.Jul 9 2020, 9:27 AM

@compnerd thank your for responding so fast!

This revision was automatically updated to reflect the committed changes.