From 6187394dd05ea20db01370b1990a79d517d98f7e Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Wed, 20 Nov 2019 13:19:48 +0000 Subject: [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 --- llvm/utils/UpdateTestChecks/common.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'llvm/utils/UpdateTestChecks/common.py') diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py index 8a864446a8a..f0646051090 100644 --- a/llvm/utils/UpdateTestChecks/common.py +++ b/llvm/utils/UpdateTestChecks/common.py @@ -13,6 +13,14 @@ else: ##### Common utilities for update_*test_checks.py + +def parse_commandline_args(parser): + parser.add_argument('-v', '--verbose', action='store_true', + help='Show verbose output') + parser.add_argument('-u', '--update-only', action='store_true', + help='Only update test if it was already autogened') + return parser.parse_args() + def should_add_line_to_output(input_line, prefix_set): # Skip any blank comment lines in the IR. if input_line.strip() == ';': -- cgit v1.2.3