diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-03-02 11:14:01 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-03-02 11:14:01 +0000 |
commit | f436f70fb8667e221c11a838ed804181eb450c04 (patch) | |
tree | e816cc55a9bd6749c1c5ba59611cbfb995e6825d /llvm/utils/update_mir_test_checks.py | |
parent | 37a63a748e7dd431f9576aaff3bcbd8f923c8c79 (diff) | |
download | bcm5719-llvm-f436f70fb8667e221c11a838ed804181eb450c04.tar.gz bcm5719-llvm-f436f70fb8667e221c11a838ed804181eb450c04.zip |
Fix update_mir_test_checks.py to run on python3
Split off from D58817
Differential Revision: https://reviews.llvm.org/D58820
llvm-svn: 355268
Diffstat (limited to 'llvm/utils/update_mir_test_checks.py')
-rwxr-xr-x | llvm/utils/update_mir_test_checks.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/utils/update_mir_test_checks.py b/llvm/utils/update_mir_test_checks.py index 56d236de249..cf7528f5760 100755 --- a/llvm/utils/update_mir_test_checks.py +++ b/llvm/utils/update_mir_test_checks.py @@ -62,6 +62,8 @@ class LLC: with open(ir) as ir_file: stdout = subprocess.check_output('{} {}'.format(self.bin, args), shell=True, stdin=ir_file) + if sys.version_info[0] > 2: + stdout = stdout.decode() # Fix line endings to unix CR style. stdout = stdout.replace('\r\n', '\n') return stdout @@ -408,7 +410,7 @@ def update_test_file(llc, test, remove_common_prefixes=False, verbose=False): log('Writing {} lines to {}...'.format(len(output_lines), test), verbose) with open(test, 'wb') as fd: - fd.writelines([l + '\n' for l in output_lines]) + fd.writelines(['{}\n'.format(l).encode('utf-8') for l in output_lines]) def main(): |