[PATCH] D64589: [UpdateTestChecks] Emit warning when invalid value for -check-prefix option

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 12 14:21:45 PDT 2019


xbolva00 updated this revision to Diff 209590.
xbolva00 added a comment.

Add checker to all update scripts.


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

https://reviews.llvm.org/D64589

Files:
  utils/UpdateTestChecks/common.py
  utils/update_analyze_test_checks.py
  utils/update_cc_test_checks.py
  utils/update_llc_test_checks.py
  utils/update_mca_test_checks.py
  utils/update_mir_test_checks.py
  utils/update_test_checks.py


Index: utils/update_test_checks.py
===================================================================
--- utils/update_test_checks.py
+++ utils/update_test_checks.py
@@ -103,7 +103,7 @@
     prefix_list = []
     for l in run_lines:
       (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 + ' '):
         print('WARNING: Skipping non-%s RUN line: %s' % (opt_basename, l), file=sys.stderr)
         continue
Index: utils/update_mir_test_checks.py
===================================================================
--- utils/update_mir_test_checks.py
+++ utils/update_mir_test_checks.py
@@ -122,6 +122,7 @@
         commands = [cmd.strip() for cmd in l.split('|', 1)]
         llc_cmd = commands[0]
         filecheck_cmd = commands[1] if len(commands) > 1 else ''
+        common.verify_filecheck_prefixes(filecheck_cmd)
 
         if not llc_cmd.startswith('llc '):
             warn('Skipping non-llc RUN line: {}'.format(l), test_file=test)
Index: utils/update_mca_test_checks.py
===================================================================
--- utils/update_mca_test_checks.py
+++ utils/update_mca_test_checks.py
@@ -116,6 +116,7 @@
       _warn('could not split tool and filecheck commands: {}'.format(run_line))
       continue
 
+    common.verify_filecheck_prefixes(filecheck_cmd)
     tool_basename = os.path.splitext(os.path.basename(args.llvm_mca_binary))[0]
 
     if not tool_cmd.startswith(tool_basename + ' '):
Index: utils/update_llc_test_checks.py
===================================================================
--- utils/update_llc_test_checks.py
+++ utils/update_llc_test_checks.py
@@ -89,6 +89,7 @@
       filecheck_cmd = ''
       if len(commands) > 1:
         filecheck_cmd = commands[1]
+      common.verify_filecheck_prefixes(filecheck_cmd)
       if not llc_cmd.startswith('llc '):
         print('WARNING: Skipping non-llc RUN line: ' + l, file=sys.stderr)
         continue
Index: utils/update_cc_test_checks.py
===================================================================
--- utils/update_cc_test_checks.py
+++ utils/update_cc_test_checks.py
@@ -168,6 +168,7 @@
 
       # Extract -check-prefix in FileCheck args
       filecheck_cmd = commands[-1]
+      common.verify_filecheck_prefixes(filecheck_cmd)
       if not filecheck_cmd.startswith('FileCheck '):
         print('WARNING: Skipping non-FileChecked RUN line: ' + l, file=sys.stderr)
         continue
Index: utils/update_analyze_test_checks.py
===================================================================
--- utils/update_analyze_test_checks.py
+++ utils/update_analyze_test_checks.py
@@ -92,6 +92,7 @@
     prefix_list = []
     for l in run_lines:
       (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 + ' '):
         print('WARNING: Skipping non-%s RUN line: %s' % (opt_basename, l), file=sys.stderr)
Index: utils/UpdateTestChecks/common.py
===================================================================
--- utils/UpdateTestChecks/common.py
+++ utils/UpdateTestChecks/common.py
@@ -264,3 +264,12 @@
 def add_analyze_checks(output_lines, comment_marker, prefix_list, func_dict, func_name):
   check_label_format = '{} %s-LABEL: \'%s\''.format(comment_marker)
   add_checks(output_lines, comment_marker, prefix_list, func_dict, func_name, check_label_format, False, True)
+
+def verify_filecheck_prefixes(fc_cmd):
+  fc_cmd_parts = fc_cmd.split()
+  for part in fc_cmd_parts:
+    if "check-prefix=" in part:
+      prefix = part.split('=')[1]
+      if ',' in prefix:
+        print('WARNING: Prefix \'%s\' is invalid. Did you mean \'--check-prefixes=%s\'?' %
+              (prefix, prefix), file=sys.stderr)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64589.209590.patch
Type: text/x-patch
Size: 3896 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190712/6bc1839a/attachment.bin>


More information about the llvm-commits mailing list