Skip to content

Commit

Permalink
Fix update_mir_test_checks.py to run on python3
Browse files Browse the repository at this point in the history
Split off from D58817

Differential Revision: https://reviews.llvm.org/D58820

llvm-svn: 355268
  • Loading branch information
RKSimon committed Mar 2, 2019
1 parent 37a63a7 commit f436f70
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion llvm/utils/update_mir_test_checks.py
Expand Up @@ -62,6 +62,8 @@ def __call__(self, args, ir):
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
Expand Down Expand Up @@ -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():
Expand Down

0 comments on commit f436f70

Please sign in to comment.