[UptestTestChecks][NFC] Share some common command line options code
Summary:
Add a function common.parse_commandline_args() that adds options common
to all tools (--verbose and --update-only) and returns the parsed
commandline arguments. I plan to use the shared parsing of --verbose in a
follow-up commit to remove most of the `if args.verbose:` checks in the
scripts.
Reviewers: xbolva00, MaskRay
Reviewed By: MaskRay
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70428
GitOrigin-RevId: 6187394dd05ea20db01370b1990a79d517d98f7e
diff --git a/utils/update_mir_test_checks.py b/utils/update_mir_test_checks.py
index e6c1671..6e90613 100755
--- a/utils/update_mir_test_checks.py
+++ b/utils/update_mir_test_checks.py
@@ -430,17 +430,13 @@
def main():
parser = argparse.ArgumentParser(
description=__doc__, formatter_class=argparse.RawTextHelpFormatter)
- parser.add_argument('-v', '--verbose', action='store_true',
- help='Show verbose output')
parser.add_argument('--llc-binary', dest='llc', default='llc', type=LLC,
help='The "llc" binary to generate the test case with')
parser.add_argument('--remove-common-prefixes', action='store_true',
help='Remove existing check lines whose prefixes are '
'shared between multiple commands')
- parser.add_argument('-u', '--update-only', action='store_true',
- help='Only update test if it was already autogened')
parser.add_argument('tests', nargs='+')
- args = parser.parse_args()
+ args = common.parse_commandline_args(parser)
test_paths = [test for pattern in args.tests for test in glob.glob(pattern)]
for test in test_paths: