diff options
Diffstat (limited to 'llvm/utils/update_analyze_test_checks.py')
-rwxr-xr-x | llvm/utils/update_analyze_test_checks.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/llvm/utils/update_analyze_test_checks.py b/llvm/utils/update_analyze_test_checks.py index b9175ae7327..0463bc01982 100755 --- a/llvm/utils/update_analyze_test_checks.py +++ b/llvm/utils/update_analyze_test_checks.py @@ -29,6 +29,8 @@ The script is designed to make adding checks to a test case fast, it is *not* designed to be authoratitive about what constitutes a good test! """ +from __future__ import print_function + import argparse import itertools import os # Used to advertise this file's name ("autogenerated_note"). @@ -66,12 +68,12 @@ def main(): opt_basename = os.path.basename(args.opt_binary) if (opt_basename != "opt"): - print >>sys.stderr, 'ERROR: Unexpected opt name: ' + opt_basename + print('ERROR: Unexpected opt name: ' + opt_basename, file=sys.stderr) sys.exit(1) for test in args.tests: if args.verbose: - print >>sys.stderr, 'Scanning for RUN lines in test file: %s' % (test,) + print('Scanning for RUN lines in test file: %s' % (test,), file=sys.stderr) with open(test) as f: input_lines = [l.rstrip() for l in f] @@ -85,20 +87,20 @@ def main(): run_lines.append(l) if args.verbose: - print >>sys.stderr, 'Found %d RUN lines:' % (len(run_lines),) + print('Found %d RUN lines:' % (len(run_lines),), file=sys.stderr) for l in run_lines: - print >>sys.stderr, ' RUN: ' + l + print(' RUN: ' + l, file=sys.stderr) prefix_list = [] for l in run_lines: (tool_cmd, filecheck_cmd) = tuple([cmd.strip() for cmd in l.split('|', 1)]) if not tool_cmd.startswith(opt_basename + ' '): - print >>sys.stderr, 'WARNING: Skipping non-%s RUN line: %s' % (opt_basename, l) + print('WARNING: Skipping non-%s RUN line: %s' % (opt_basename, l), file=sys.stderr) continue if not filecheck_cmd.startswith('FileCheck '): - print >>sys.stderr, 'WARNING: Skipping non-FileChecked RUN line: ' + l + print('WARNING: Skipping non-FileChecked RUN line: ' + l, file=sys.stderr) continue tool_cmd_args = tool_cmd[len(opt_basename):].strip() @@ -119,8 +121,8 @@ def main(): func_dict.update({prefix: dict()}) for prefixes, opt_args in prefix_list: if args.verbose: - print >>sys.stderr, 'Extracted opt cmd: ' + opt_basename + ' ' + opt_args - print >>sys.stderr, 'Extracted FileCheck prefixes: ' + str(prefixes) + print('Extracted opt cmd: ' + opt_basename + ' ' + opt_args, file=sys.stderr) + print('Extracted FileCheck prefixes: ' + str(prefixes), file=sys.stderr) raw_tool_outputs = common.invoke_tool(args.opt_binary, opt_args, test) @@ -134,7 +136,7 @@ def main(): is_in_function_start = False prefix_set = set([prefix for prefixes, _ in prefix_list for prefix in prefixes]) if args.verbose: - print >>sys.stderr, 'Rewriting FileCheck prefixes: %s' % (prefix_set,) + print('Rewriting FileCheck prefixes: %s' % (prefix_set,), file=sys.stderr) output_lines = [] output_lines.append(autogenerated_note) @@ -181,7 +183,7 @@ def main(): is_in_function = is_in_function_start = True if args.verbose: - print>>sys.stderr, 'Writing %d lines to %s...' % (len(output_lines), test) + print('Writing %d lines to %s...' % (len(output_lines), test), file=sys.stderr) with open(test, 'wb') as f: f.writelines([l + '\n' for l in output_lines]) |