[PATCH] D65610: Robustify update_test_checks.py to non-autogened tests, and add a mode to skip non-autogenerated ones

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 5 11:24:58 PDT 2019


This revision was automatically updated to reflect the committed changes.
reames marked an inline comment as done.
Closed by commit rL367900: Robustify update_test_checks.py to non-autogened tests, and add a mode to skip… (authored by reames, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D65610?vs=213089&id=213414#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65610/new/

https://reviews.llvm.org/D65610

Files:
  llvm/trunk/utils/update_test_checks.py


Index: llvm/trunk/utils/update_test_checks.py
===================================================================
--- llvm/trunk/utils/update_test_checks.py
+++ llvm/trunk/utils/update_test_checks.py
@@ -62,6 +62,8 @@
                       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 @@
     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 @@
 
     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 + ' '):


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65610.213414.patch
Type: text/x-patch
Size: 1478 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190805/94c92298/attachment.bin>


More information about the llvm-commits mailing list