[utils] Add windows support to update_llc_test_checks.py

Strip dos line endings from llc generated files to allow the regex patterns to match them.

Ensure updated *.ll files are generated with unix style line endings.

llvm-svn: 258987
This commit is contained in:
Simon Pilgrim 2016-01-27 21:13:18 +00:00
parent 749b4d51ed
commit 6b6dcc448a
1 changed files with 3 additions and 1 deletions

View File

@ -20,6 +20,8 @@ def llc(args, cmd_args, ir):
with open(ir) as ir_file:
stdout = subprocess.check_output(args.llc_binary + ' ' + cmd_args,
shell=True, stdin=ir_file)
# Fix line endings to unix CR style.
stdout = stdout.replace('\r\n', '\n')
return stdout
@ -211,7 +213,7 @@ def main():
if args.verbose:
print>>sys.stderr, 'Writing %d fixed lines to %s...' % (
len(fixed_lines), test)
with open(test, 'w') as f:
with open(test, 'wb') as f:
f.writelines([l + '\n' for l in fixed_lines])