]> granicus.if.org Git - llvm/commitdiff
Add wildcard support to all update_*_test_checks.py scripts (PR37500)
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 5 Mar 2019 10:44:37 +0000 (10:44 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 5 Mar 2019 10:44:37 +0000 (10:44 +0000)
We can already update multiple files in each update call, this extends it to work with wildcards as well in the same way as update_mca_test_checks.py (to support shells that won't do this for us - windows command prompt etc.)

Differential Revision: https://reviews.llvm.org/D58817

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355386 91177308-0d34-0410-b5e6-96231b3b80d8

utils/update_analyze_test_checks.py
utils/update_llc_test_checks.py
utils/update_mir_test_checks.py
utils/update_test_checks.py

index 4d1d912aba865565c070568c1735b6665d30a6a7..df09108937cf1da254433b18f272d54773b3f5da 100755 (executable)
@@ -32,6 +32,7 @@ designed to be authoratitive about what constitutes a good test!
 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 @@ ADVERT = '; NOTE: Assertions have been autogenerated by '
 
 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 @@ def main():
     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 5d2aac2509ec17184c5d7f2fed8159afb2c99b5b..9dd25d386b18fdc7edd85258ffc51c2bbb98600a 100755 (executable)
@@ -10,6 +10,7 @@ a single test function.
 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 @@ def main():
 
   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 cf7528f57609708a7867d91e8094789c9cf1c674..b42a38bd55a654176d0956a8fe884fb17d313261 100755 (executable)
@@ -21,6 +21,7 @@ from __future__ import print_function
 
 import argparse
 import collections
+import glob
 import os
 import re
 import subprocess
@@ -426,7 +427,8 @@ def main():
     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 b63a9174208d74082a425490af634ea8bbac8938..f108e8c74b1769a56105070a7fe933a01d4a8508 100755 (executable)
@@ -32,6 +32,7 @@ designed to be authoratitive about what constitutes a good test!
 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 @@ def main():
     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: