twister: apply_filter: discards is not part of TestPlan
Use class member instead of local variable of discards. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
26e3c30234
commit
dbd460fd04
3 changed files with 20 additions and 22 deletions
|
@ -3763,14 +3763,14 @@ class TestPlan(DisablePyTestCollectionMixin):
|
|||
for case in instance.testcases:
|
||||
case = instance.status
|
||||
|
||||
self.filtered_platforms = set(p.platform.name for p in self.instances.values()
|
||||
if p.status != "skipped" )
|
||||
|
||||
# Remove from discards configurations that must not be discarded (e.g. integration_platforms when --integration was used)
|
||||
# Remove from discards configurations that must not be discarded
|
||||
# (e.g. integration_platforms when --integration was used)
|
||||
for instance in remove_from_discards:
|
||||
del self.discards[instance]
|
||||
|
||||
return discards
|
||||
self.filtered_platforms = set(p.platform.name for p in self.instances.values()
|
||||
if p.status != "skipped" )
|
||||
|
||||
|
||||
def add_instances(self, instance_list):
|
||||
for instance in instance_list:
|
||||
|
|
|
@ -106,8 +106,8 @@ def test_apply_filters_part1(class_testplan, all_testsuites_dict, platforms_list
|
|||
appropriate values according to the filters
|
||||
"""
|
||||
if tc_attribute is None and plat_attribute is None:
|
||||
discards = class_testplan.apply_filters()
|
||||
assert not discards
|
||||
class_testplan.apply_filters()
|
||||
assert not class_testplan.discards
|
||||
|
||||
class_testplan.platforms = platforms_list
|
||||
class_testplan.platform_names = [p.name for p in platforms_list]
|
||||
|
@ -149,19 +149,19 @@ def test_apply_filters_part1(class_testplan, all_testsuites_dict, platforms_list
|
|||
if tc_attribute == "build_on_all":
|
||||
for _, testcase in class_testplan.testsuites.items():
|
||||
testcase.build_on_all = tc_value
|
||||
discards = class_testplan.apply_filters(exclude_platform=['demo_board_1'])
|
||||
class_testplan.apply_filters(exclude_platform=['demo_board_1'])
|
||||
elif plat_attribute == "supported_toolchains":
|
||||
discards = class_testplan.apply_filters(force_toolchain=False,
|
||||
class_testplan.apply_filters(force_toolchain=False,
|
||||
exclude_platform=['demo_board_1'],
|
||||
platform=['demo_board_2'])
|
||||
elif tc_attribute is None and plat_attribute is None:
|
||||
discards = class_testplan.apply_filters()
|
||||
class_testplan.apply_filters()
|
||||
else:
|
||||
discards = class_testplan.apply_filters(exclude_platform=['demo_board_1'],
|
||||
class_testplan.apply_filters(exclude_platform=['demo_board_1'],
|
||||
platform=['demo_board_2'])
|
||||
|
||||
for x in [expected_discards]:
|
||||
assert x in discards.values()
|
||||
assert x in class_testplan.discards.values()
|
||||
|
||||
TESTDATA_PART2 = [
|
||||
("runnable", "True", "Not runnable on device"),
|
||||
|
@ -192,9 +192,9 @@ def test_apply_filters_part2(class_testplan, all_testsuites_dict,
|
|||
'demo_board_2'
|
||||
]
|
||||
}
|
||||
discards = class_testplan.apply_filters(**kwargs)
|
||||
assert discards
|
||||
for d in discards.values():
|
||||
class_testplan.apply_filters(**kwargs)
|
||||
assert class_testplan.discards
|
||||
for d in class_testplan.discards.values():
|
||||
assert d == expected_discards
|
||||
|
||||
|
||||
|
@ -221,9 +221,9 @@ def test_apply_filters_part3(class_testplan, all_testsuites_dict, platforms_list
|
|||
for _, testcase in class_testplan.testsuites.items():
|
||||
testcase.min_ram = tc_min_ram
|
||||
testcase.min_flash = tc_min_flash
|
||||
discards = class_testplan.apply_filters(exclude_platform=['demo_board_1'],
|
||||
class_testplan.apply_filters(exclude_platform=['demo_board_1'],
|
||||
platform=['demo_board_2'])
|
||||
assert not discards
|
||||
assert not class_testplan.discards
|
||||
|
||||
def test_add_instances(test_data, class_testplan, all_testsuites_dict, platforms_list):
|
||||
""" Testing add_instances() function of TestPlan class in Twister
|
||||
|
|
|
@ -1079,8 +1079,6 @@ def main():
|
|||
print("%s%s" % (pre, node.name))
|
||||
return
|
||||
|
||||
discards = []
|
||||
|
||||
if options.report_suffix:
|
||||
last_run = os.path.join(options.outdir, "twister_{}.json".format(options.report_suffix))
|
||||
else:
|
||||
|
@ -1115,7 +1113,7 @@ def main():
|
|||
filter_platform=connected_list)
|
||||
tplan.selected_platforms = set(p.platform.name for p in tplan.instances.values())
|
||||
else:
|
||||
discards = tplan.apply_filters(
|
||||
tplan.apply_filters(
|
||||
enable_slow=options.enable_slow,
|
||||
platform=options.platform,
|
||||
exclude_platform=options.exclude_platform,
|
||||
|
@ -1148,13 +1146,13 @@ def main():
|
|||
print(f"Tests found: {count}")
|
||||
return
|
||||
|
||||
if VERBOSE > 1 and discards:
|
||||
if VERBOSE > 1 and tplan.discards:
|
||||
# if we are using command line platform filter, no need to list every
|
||||
# other platform as excluded, we know that already.
|
||||
# Show only the discards that apply to the selected platforms on the
|
||||
# command line
|
||||
|
||||
for i, reason in discards.items():
|
||||
for i, reason in tplan.discards.items():
|
||||
if options.platform and i.platform.name not in options.platform:
|
||||
continue
|
||||
logger.debug(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue