scripts: twister: allow fixtures to contain extra configuration
Allow twister fixtures to contain extra information, which can be used for test suite configuration. The extra information can be appended to existing fixtures separated by a colon (i.e. <fixture>:<configuration>). This is especially useful for the pytest harness, where a fixture of a given type may need to refer to an instance of a particular piece of host hardware needed by the pytest suite (e.g. a network interface, a UART, or a CAN interface connected to the device under test). Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
parent
a7d55cfa13
commit
3eb3c33096
3 changed files with 6 additions and 2 deletions
|
@ -1082,6 +1082,10 @@ can be used multiple times and all given fixtures will be appended as a list. An
|
|||
given fixtures will be assigned to all boards, this means that all boards set by
|
||||
current twister command can run those testcases which request the same fixtures.
|
||||
|
||||
Some fixtures allow for configuration strings to be appended, separated from the
|
||||
fixture name by a ``:``. Only the fixture name is matched against the fixtures
|
||||
requested by testcases.
|
||||
|
||||
Notes
|
||||
+++++
|
||||
|
||||
|
|
|
@ -456,7 +456,7 @@ class DeviceHandler(Handler):
|
|||
dut_found = False
|
||||
|
||||
for d in self.duts:
|
||||
if fixture and fixture not in d.fixtures:
|
||||
if fixture and fixture not in map(lambda f: f.split(sep=':')[0], d.fixtures):
|
||||
continue
|
||||
if d.platform != device or (d.serial is None and d.serial_pty is None):
|
||||
continue
|
||||
|
|
|
@ -180,7 +180,7 @@ class TestInstance:
|
|||
# command-line, then we need to run the test, not just build it.
|
||||
fixture = testsuite.harness_config.get('fixture')
|
||||
if fixture:
|
||||
can_run = fixture in fixtures
|
||||
can_run = fixture in map(lambda f: f.split(sep=':')[0], fixtures)
|
||||
|
||||
return can_run
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue