[llvm] r355386 - Add wildcard support to all update_*_test_checks.py scripts (PR37500)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 5 02:44:37 PST 2019
Author: rksimon
Date: Tue Mar 5 02:44:37 2019
New Revision: 355386
URL: http://llvm.org/viewvc/llvm-project?rev=355386&view=rev
Log:
Add wildcard support to all update_*_test_checks.py scripts (PR37500)
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
Modified:
llvm/trunk/utils/update_analyze_test_checks.py
llvm/trunk/utils/update_llc_test_checks.py
llvm/trunk/utils/update_mir_test_checks.py
llvm/trunk/utils/update_test_checks.py
Modified: llvm/trunk/utils/update_analyze_test_checks.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/update_analyze_test_checks.py?rev=355386&r1=355385&r2=355386&view=diff
==============================================================================
--- llvm/trunk/utils/update_analyze_test_checks.py (original)
+++ llvm/trunk/utils/update_analyze_test_checks.py Tue Mar 5 02:44:37 2019
@@ -32,6 +32,7 @@ designed to be authoratitive about what
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 a
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:
Modified: llvm/trunk/utils/update_llc_test_checks.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/update_llc_test_checks.py?rev=355386&r1=355385&r2=355386&view=diff
==============================================================================
--- llvm/trunk/utils/update_llc_test_checks.py (original)
+++ llvm/trunk/utils/update_llc_test_checks.py Tue Mar 5 02:44:37 2019
@@ -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:
Modified: llvm/trunk/utils/update_mir_test_checks.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/update_mir_test_checks.py?rev=355386&r1=355385&r2=355386&view=diff
==============================================================================
--- llvm/trunk/utils/update_mir_test_checks.py (original)
+++ llvm/trunk/utils/update_mir_test_checks.py Tue Mar 5 02:44:37 2019
@@ -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)
Modified: llvm/trunk/utils/update_test_checks.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/update_test_checks.py?rev=355386&r1=355385&r2=355386&view=diff
==============================================================================
--- llvm/trunk/utils/update_test_checks.py (original)
+++ llvm/trunk/utils/update_test_checks.py Tue Mar 5 02:44:37 2019
@@ -32,6 +32,7 @@ designed to be authoratitive about what
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:
More information about the llvm-commits
mailing list