[PATCH] D58817: Add wildcard support to all update_*_test_checks.py scripts (PR37500)

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 1 04:59:11 PST 2019


RKSimon updated this revision to Diff 188884.
RKSimon added a comment.

Fixed mir + tested on python27 (although it still doesn't run on python3 - that needs to be fixed separately).

Dropped the cc change as like Roman said it needs some attention first.

Tested llc/opt/analyze on python3 and python27


Repository:
  rL LLVM

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

https://reviews.llvm.org/D58817

Files:
  utils/update_analyze_test_checks.py
  utils/update_llc_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
@@ -32,6 +32,7 @@
 from __future__ import print_function
 
 import argparse
+import glob
 import itertools
 import os         # Used to advertise this file's name ("autogenerated_note").
 import string
@@ -71,7 +72,8 @@
     print('ERROR: Unexpected opt name: ' + opt_basename, file=sys.stderr)
     sys.exit(1)
 
-  for test in args.tests:
+  test_paths = [test for pattern in args.tests for test in glob.glob(pattern)]
+  for test in test_paths:
     if args.verbose:
       print('Scanning for RUN lines in test file: %s' % (test,), file=sys.stderr)
     with open(test) as f:
Index: utils/update_mir_test_checks.py
===================================================================
--- utils/update_mir_test_checks.py
+++ utils/update_mir_test_checks.py
@@ -21,6 +21,7 @@
 
 import argparse
 import collections
+import glob
 import os
 import re
 import subprocess
@@ -424,7 +425,8 @@
     parser.add_argument('tests', nargs='+')
     args = parser.parse_args()
 
-    for test in args.tests:
+    test_paths = [test for pattern in args.tests for test in glob.glob(pattern)]
+    for test in test_paths:
         try:
             update_test_file(args.llc, test, args.remove_common_prefixes,
                              verbose=args.verbose)
Index: utils/update_llc_test_checks.py
===================================================================
--- utils/update_llc_test_checks.py
+++ utils/update_llc_test_checks.py
@@ -10,6 +10,7 @@
 from __future__ import print_function
 
 import argparse
+import glob
 import os         # Used to advertise this file's name ("autogenerated_note").
 import string
 import subprocess
@@ -42,7 +43,8 @@
 
   autogenerated_note = (ADVERT + 'utils/' + os.path.basename(__file__))
 
-  for test in args.tests:
+  test_paths = [test for pattern in args.tests for test in glob.glob(pattern)]
+  for test in test_paths:
     if args.verbose:
       print('Scanning for RUN lines in test file: %s' % (test,), file=sys.stderr)
     with open(test) as f:
Index: utils/update_analyze_test_checks.py
===================================================================
--- utils/update_analyze_test_checks.py
+++ utils/update_analyze_test_checks.py
@@ -32,6 +32,7 @@
 from __future__ import print_function
 
 import argparse
+import glob
 import itertools
 import os         # Used to advertise this file's name ("autogenerated_note").
 import string
@@ -48,10 +49,6 @@
 
 IR_FUNCTION_RE = re.compile('^\s*define\s+(?:internal\s+)?[^@]*@([\w-]+)\s*\(')
 
-
-
-
-
 def main():
   from argparse import RawTextHelpFormatter
   parser = argparse.ArgumentParser(description=__doc__, formatter_class=RawTextHelpFormatter)
@@ -71,7 +68,8 @@
     print('ERROR: Unexpected opt name: ' + opt_basename, file=sys.stderr)
     sys.exit(1)
 
-  for test in args.tests:
+  test_paths = [test for pattern in args.tests for test in glob.glob(pattern)]
+  for test in test_paths:
     if args.verbose:
       print('Scanning for RUN lines in test file: %s' % (test,), file=sys.stderr)
     with open(test) as f:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58817.188884.patch
Type: text/x-patch
Size: 3270 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190301/ce9b4767/attachment.bin>


More information about the llvm-commits mailing list