sanitycheck: cleanup fixture processing

Cleanup fixture processing and allow ztest testcases to support
harness_config with fixture definition.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2020-05-21 09:11:40 -04:00 committed by Carles Cufí
parent 24729bb7c6
commit ce8c12eb5a
3 changed files with 12 additions and 9 deletions

View file

@ -149,3 +149,6 @@ class Test(Harness):
self.capture_coverage = False
self.process_test(line)
class Ztest(Test):
pass

View file

@ -1533,7 +1533,7 @@ class TestInstance(DisablePyTestCollectionMixin):
return self.name < other.name
# Global testsuite parameters
def check_build_or_run(self, build_only=False, enable_slow=False, device_testing=False, fixture=[]):
def check_build_or_run(self, build_only=False, enable_slow=False, device_testing=False, fixtures=[]):
# right now we only support building on windows. running is still work
# in progress.
@ -1571,13 +1571,13 @@ class TestInstance(DisablePyTestCollectionMixin):
runnable = False
# console harness allows us to run the test and capture data.
if self.testcase.harness == 'console':
if self.testcase.harness in [ 'console', 'ztest']:
# if we have a fixture that is also being supplied on the
# command-line, then we need to run the test, not just build it.
if "fixture" in self.testcase.harness_config:
fixture_cfg = self.testcase.harness_config['fixture']
if fixture_cfg in fixture:
fixture = self.testcase.harness_config.get('fixture')
if fixture:
if fixture in fixtures:
_build_only = False
else:
_build_only = True
@ -2234,7 +2234,7 @@ class TestSuite(DisablePyTestCollectionMixin):
self.cleanup = False
self.enable_slow = False
self.device_testing = False
self.fixture = []
self.fixtures = []
self.enable_coverage = False
self.enable_lsan = False
self.enable_asan = False
@ -2580,7 +2580,7 @@ class TestSuite(DisablePyTestCollectionMixin):
self.build_only,
self.enable_slow,
self.device_testing,
self.fixture
self.fixtures
)
instance.create_overlay(platform, self.enable_asan, self.enable_coverage, self.coverage_platform)
instance_list.append(instance)
@ -2641,7 +2641,7 @@ class TestSuite(DisablePyTestCollectionMixin):
self.build_only,
self.enable_slow,
self.device_testing,
self.fixture
self.fixtures
)
if not force_platform and plat.name in exclude_platform:
discards[instance] = "Platform is excluded on command line."

View file

@ -774,7 +774,7 @@ def main():
suite.test_only = options.test_only
suite.enable_slow = options.enable_slow
suite.device_testing = options.device_testing
suite.fixture = options.fixture
suite.fixtures = options.fixture
suite.enable_asan = options.enable_asan
suite.enable_lsan = options.enable_lsan
suite.enable_coverage = options.enable_coverage