Skip to content

Commit 48665f2

Browse files
PerMacnashif
authored andcommitted
scripts: Allow using quarantine mechanism with test_plan.py script
In twister, applying quarantine is a part of apply_filters() function. However, this function is not called when --load-test is used. Therefore, if one wants to use quarantines in combination with dynamic scope from the test_plan.py script, one has to pass such info through the script. Signed-off-by: Maciej Perkowski <[email protected]>
1 parent 418210d commit 48665f2

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

scripts/ci/test_plan.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def __repr__(self):
9595

9696
class Filters:
9797
def __init__(self, modified_files, ignore_path, alt_tags, testsuite_root,
98-
pull_request=False, platforms=[], detailed_test_id=True, tc_roots_th=20):
98+
pull_request=False, platforms=[], detailed_test_id=True, quarantine_list=None, tc_roots_th=20):
9999
self.modified_files = modified_files
100100
self.testsuite_root = testsuite_root
101101
self.resolved_files = []
@@ -108,6 +108,7 @@ def __init__(self, modified_files, ignore_path, alt_tags, testsuite_root,
108108
self.detailed_test_id = detailed_test_id
109109
self.ignore_path = ignore_path
110110
self.tag_cfg_file = alt_tags
111+
self.quarantine_list = quarantine_list
111112
self.tc_roots_th = tc_roots_th
112113

113114
def process(self):
@@ -129,6 +130,9 @@ def get_plan(self, options, integration=False, use_testsuite_root=True):
129130
cmd+=["-T", root]
130131
if integration:
131132
cmd.append("--integration")
133+
if self.quarantine_list:
134+
for q in self.quarantine_list:
135+
cmd += ["--quarantine-list", q]
132136

133137
logging.info(" ".join(cmd))
134138
_ = subprocess.call(cmd)
@@ -414,6 +418,12 @@ def parse_args():
414418
"testcase.yaml files under here will be processed. May be "
415419
"called multiple times. Defaults to the 'samples/' and "
416420
"'tests/' directories at the base of the Zephyr tree.")
421+
parser.add_argument(
422+
"--quarantine-list", action="append", metavar="FILENAME",
423+
help="Load list of test scenarios under quarantine. The entries in "
424+
"the file need to correspond to the test scenarios names as in "
425+
"corresponding tests .yaml files. These scenarios "
426+
"will be skipped with quarantine as the reason.")
417427

418428
# Include paths in names by default.
419429
parser.set_defaults(detailed_test_id=True)
@@ -442,7 +452,7 @@ def parse_args():
442452
print("=========")
443453

444454
f = Filters(files, args.ignore_path, args.alt_tags, args.testsuite_root,
445-
args.pull_request, args.platform, args.detailed_test_id,
455+
args.pull_request, args.platform, args.detailed_test_id, args.quarantine_list,
446456
args.testcase_roots_threshold)
447457
f.process()
448458

0 commit comments

Comments
 (0)