OSDN Git Service

[compiler-rt] Better Windows support for running tests in external shell
authorSergej Jaskiewicz <jaskiewiczs@icloud.com>
Thu, 9 Jul 2020 16:36:15 +0000 (19:36 +0300)
committerSergej Jaskiewicz <jaskiewiczs@icloud.com>
Thu, 9 Jul 2020 16:40:22 +0000 (19:40 +0300)
commita89d54fd61a6e7a05f7434491135e667306a22e7
tree3904de19eff4ded60239bb4fcbaefec61accaad9
parentafc1a709433e3754ee3819efd9e144b657919131
[compiler-rt] Better Windows support for running tests in external shell

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.

Why do we remove the conversions to ASCII in the crt config?

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.

Reviewers: compnerd, phosek, weimingz

Reviewed By: compnerd

Subscribers: dberris, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D83485
compiler-rt/test/builtins/Unit/lit.cfg.py
compiler-rt/test/crt/lit.cfg.py