Skip to content

Commit

Permalink
[nrf fromlist] scripts: Allow using quarantine mechanism with test_pl…
Browse files Browse the repository at this point in the history
…an.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]>

Upstream PR: zephyrproject-rtos/zephyr#66659
  • Loading branch information
PerMac committed Feb 16, 2024
1 parent 962eb73 commit a8dec43
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions scripts/ci/test_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def __repr__(self):

class Filters:
def __init__(self, modified_files, ignore_path, alt_tags, testsuite_root,
pull_request=False, platforms=[], detailed_test_id=True):
pull_request=False, platforms=[], detailed_test_id=True, quarantine_list=None):
self.modified_files = modified_files
self.testsuite_root = testsuite_root
self.resolved_files = []
Expand All @@ -108,6 +108,7 @@ def __init__(self, modified_files, ignore_path, alt_tags, testsuite_root,
self.detailed_test_id = detailed_test_id
self.ignore_path = ignore_path
self.tag_cfg_file = alt_tags
self.quarantine_list = quarantine_list

def process(self):
self.find_modules()
Expand All @@ -128,6 +129,9 @@ def get_plan(self, options, integration=False, use_testsuite_root=True):
cmd+=["-T", root]
if integration:
cmd.append("--integration")
if self.quarantine_list:
for q in self.quarantine_list:
cmd += ["--quarantine-list", q]

logging.info(" ".join(cmd))
_ = subprocess.call(cmd)
Expand Down Expand Up @@ -415,6 +419,12 @@ def parse_args():
"testcase.yaml files under here will be processed. May be "
"called multiple times. Defaults to the 'samples/' and "
"'tests/' directories at the base of the Zephyr tree.")
parser.add_argument(
"--quarantine-list", action="append", metavar="FILENAME",
help="Load list of test scenarios under quarantine. The entries in "
"the file need to correspond to the test scenarios names as in "
"corresponding tests .yaml files. These scenarios "
"will be skipped with quarantine as the reason.")

# Include paths in names by default.
parser.set_defaults(detailed_test_id=True)
Expand Down Expand Up @@ -443,7 +453,7 @@ def parse_args():
print("=========")

f = Filters(files, args.ignore_path, args.alt_tags, args.testsuite_root,
args.pull_request, args.platform, args.detailed_test_id)
args.pull_request, args.platform, args.detailed_test_id, args.quarantine_list)
f.process()

# remove dupes and filtered cases
Expand Down

0 comments on commit a8dec43

Please sign in to comment.