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:
|
for case in instance.testcases:
|
||||||
case = instance.status
|
case = instance.status
|
||||||
|
|
||||||
self.filtered_platforms = set(p.platform.name for p in self.instances.values()
|
# Remove from discards configurations that must not be discarded
|
||||||
if p.status != "skipped" )
|
# (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:
|
for instance in remove_from_discards:
|
||||||
del self.discards[instance]
|
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):
|
def add_instances(self, instance_list):
|
||||||
for instance in 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
|
appropriate values according to the filters
|
||||||
"""
|
"""
|
||||||
if tc_attribute is None and plat_attribute is None:
|
if tc_attribute is None and plat_attribute is None:
|
||||||
discards = class_testplan.apply_filters()
|
class_testplan.apply_filters()
|
||||||
assert not discards
|
assert not class_testplan.discards
|
||||||
|
|
||||||
class_testplan.platforms = platforms_list
|
class_testplan.platforms = platforms_list
|
||||||
class_testplan.platform_names = [p.name for p in 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":
|
if tc_attribute == "build_on_all":
|
||||||
for _, testcase in class_testplan.testsuites.items():
|
for _, testcase in class_testplan.testsuites.items():
|
||||||
testcase.build_on_all = tc_value
|
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":
|
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'],
|
exclude_platform=['demo_board_1'],
|
||||||
platform=['demo_board_2'])
|
platform=['demo_board_2'])
|
||||||
elif tc_attribute is None and plat_attribute is None:
|
elif tc_attribute is None and plat_attribute is None:
|
||||||
discards = class_testplan.apply_filters()
|
class_testplan.apply_filters()
|
||||||
else:
|
else:
|
||||||
discards = class_testplan.apply_filters(exclude_platform=['demo_board_1'],
|
class_testplan.apply_filters(exclude_platform=['demo_board_1'],
|
||||||
platform=['demo_board_2'])
|
platform=['demo_board_2'])
|
||||||
|
|
||||||
for x in [expected_discards]:
|
for x in [expected_discards]:
|
||||||
assert x in discards.values()
|
assert x in class_testplan.discards.values()
|
||||||
|
|
||||||
TESTDATA_PART2 = [
|
TESTDATA_PART2 = [
|
||||||
("runnable", "True", "Not runnable on device"),
|
("runnable", "True", "Not runnable on device"),
|
||||||
|
@ -192,9 +192,9 @@ def test_apply_filters_part2(class_testplan, all_testsuites_dict,
|
||||||
'demo_board_2'
|
'demo_board_2'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
discards = class_testplan.apply_filters(**kwargs)
|
class_testplan.apply_filters(**kwargs)
|
||||||
assert discards
|
assert class_testplan.discards
|
||||||
for d in discards.values():
|
for d in class_testplan.discards.values():
|
||||||
assert d == expected_discards
|
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():
|
for _, testcase in class_testplan.testsuites.items():
|
||||||
testcase.min_ram = tc_min_ram
|
testcase.min_ram = tc_min_ram
|
||||||
testcase.min_flash = tc_min_flash
|
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'])
|
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):
|
def test_add_instances(test_data, class_testplan, all_testsuites_dict, platforms_list):
|
||||||
""" Testing add_instances() function of TestPlan class in Twister
|
""" Testing add_instances() function of TestPlan class in Twister
|
||||||
|
|
|
@ -1079,8 +1079,6 @@ def main():
|
||||||
print("%s%s" % (pre, node.name))
|
print("%s%s" % (pre, node.name))
|
||||||
return
|
return
|
||||||
|
|
||||||
discards = []
|
|
||||||
|
|
||||||
if options.report_suffix:
|
if options.report_suffix:
|
||||||
last_run = os.path.join(options.outdir, "twister_{}.json".format(options.report_suffix))
|
last_run = os.path.join(options.outdir, "twister_{}.json".format(options.report_suffix))
|
||||||
else:
|
else:
|
||||||
|
@ -1115,7 +1113,7 @@ def main():
|
||||||
filter_platform=connected_list)
|
filter_platform=connected_list)
|
||||||
tplan.selected_platforms = set(p.platform.name for p in tplan.instances.values())
|
tplan.selected_platforms = set(p.platform.name for p in tplan.instances.values())
|
||||||
else:
|
else:
|
||||||
discards = tplan.apply_filters(
|
tplan.apply_filters(
|
||||||
enable_slow=options.enable_slow,
|
enable_slow=options.enable_slow,
|
||||||
platform=options.platform,
|
platform=options.platform,
|
||||||
exclude_platform=options.exclude_platform,
|
exclude_platform=options.exclude_platform,
|
||||||
|
@ -1148,13 +1146,13 @@ def main():
|
||||||
print(f"Tests found: {count}")
|
print(f"Tests found: {count}")
|
||||||
return
|
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
|
# if we are using command line platform filter, no need to list every
|
||||||
# other platform as excluded, we know that already.
|
# other platform as excluded, we know that already.
|
||||||
# Show only the discards that apply to the selected platforms on the
|
# Show only the discards that apply to the selected platforms on the
|
||||||
# command line
|
# 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:
|
if options.platform and i.platform.name not in options.platform:
|
||||||
continue
|
continue
|
||||||
logger.debug(
|
logger.debug(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue