From 138692085d811db30ce700c94cea78a07b7468f5 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Thu, 22 Feb 2018 13:46:02 -0500 Subject: [PATCH] Add a black_regex flag to tempest run Now that we're using stestr internally the selection regex is more sophisticated, and lets you exclude on match from a cli regex too. To leverage this functionality this commit adds a new cli argument to use it. Change-Id: I440ab90f576e1ac333c7c40175ad6117d1299c04 --- tempest/cmd/run.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tempest/cmd/run.py b/tempest/cmd/run.py index 707a0fa5d4..49fb1bcac6 100644 --- a/tempest/cmd/run.py +++ b/tempest/cmd/run.py @@ -22,6 +22,8 @@ Tempest run has several options: * **--regex/-r**: This is a selection regex like what stestr uses. It will run any tests that match on re.match() with the regex * **--smoke/-s**: Run all the tests tagged as smoke + * **--black-regex**: It allows to do simple test exclusion via passing a + rejection/black regexp There are also the ``--blacklist-file`` and ``--whitelist-file`` options that let you pass a filepath to tempest run with the file format being a line @@ -165,7 +167,8 @@ class TempestRun(command.Command): if parsed_args.list_tests: return_code = commands.list_command( filters=regex, whitelist_file=parsed_args.whitelist_file, - blacklist_file=parsed_args.blacklist_file) + blacklist_file=parsed_args.blacklist_file, + black_regex=parsed_args.black_regex) elif not (parsed_args.config_file or parsed_args.workspace): serial = not parsed_args.parallel @@ -174,6 +177,7 @@ class TempestRun(command.Command): serial=serial, concurrency=parsed_args.concurrency, blacklist_file=parsed_args.blacklist_file, whitelist_file=parsed_args.whitelist_file, + black_regex=parsed_args.black_regex, load_list=parsed_args.load_list, combine=parsed_args.combine) if return_code > 0: sys.exit(return_code) @@ -227,6 +231,8 @@ class TempestRun(command.Command): regex.add_argument('--regex', '-r', default='', help='A normal stestr selection regex used to ' 'specify a subset of tests to run') + parser.add_argument('--black-regex', dest='black_regex', + help='A regex to exclude tests that match it') parser.add_argument('--whitelist-file', '--whitelist_file', help="Path to a whitelist file, this file " "contains a separate regex on each "