diff options
author | Philip Reames <listmail@philipreames.com> | 2019-08-05 18:25:08 +0000 |
---|---|---|
committer | Philip Reames <listmail@philipreames.com> | 2019-08-05 18:25:08 +0000 |
commit | 9bf59384c640959421b3e8005dec31f78d472750 (patch) | |
tree | e7857285ac917a5b8974e3a82e31aec2651ad821 /llvm/utils/update_test_checks.py | |
parent | 42ad452c1e69c01e4cdf58f8684cffae283f6bdb (diff) | |
download | bcm5719-llvm-9bf59384c640959421b3e8005dec31f78d472750.tar.gz bcm5719-llvm-9bf59384c640959421b3e8005dec31f78d472750.zip |
Robustify update_test_checks.py to non-autogened tests, and add a mode to skip non-autogenerated ones
Intended use case is:
./utils/update_test_checks.py test/Transform/PassDir/* --update-only
(i.e. rapidly be able to see changes in autogened filed, before handing non-autogened tests individually)
Differential Revision: https://reviews.llvm.org/D65610
llvm-svn: 367900
Diffstat (limited to 'llvm/utils/update_test_checks.py')
-rwxr-xr-x | llvm/utils/update_test_checks.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/utils/update_test_checks.py b/llvm/utils/update_test_checks.py index e9f5e6c333b..55258631fec 100755 --- a/llvm/utils/update_test_checks.py +++ b/llvm/utils/update_test_checks.py @@ -62,6 +62,8 @@ def main(): help='The opt binary used to generate the test case') parser.add_argument( '--function', help='The function in the test file to update') + parser.add_argument('--update-only', action='store_true', + help='Only update test if it was already autogened') parser.add_argument('tests', nargs='+') args = parser.parse_args() @@ -86,6 +88,11 @@ def main(): with open(test) as f: input_lines = [l.rstrip() for l in f] + if args.update_only: + if len(input_lines) == 0 or 'autogenerated' not in input_lines[0]: + print('Skipping test which isn\'t autogenerated: %s' % (test), file=sys.stderr) + continue; + raw_lines = [m.group(1) for m in [common.RUN_LINE_RE.match(l) for l in input_lines] if m] run_lines = [raw_lines[0]] if len(raw_lines) > 0 else [] @@ -102,6 +109,10 @@ def main(): prefix_list = [] for l in run_lines: + if '|' not in l: + print('WARNING: Skipping unparseable RUN line: %s' % (l,), file=sys.stderr) + continue + (tool_cmd, filecheck_cmd) = tuple([cmd.strip() for cmd in l.split('|', 1)]) common.verify_filecheck_prefixes(filecheck_cmd) if not tool_cmd.startswith(opt_basename + ' '): |