twister: print dut name when testing on hardware

When using the hardware map and testing on device, print out the name of
the dut (from the hardware map) on the script and report it in the json
output as well.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2023-08-17 16:42:42 -04:00 committed by Carles Cufí
commit b28b6a0687
4 changed files with 7 additions and 0 deletions

View file

@ -467,6 +467,8 @@ class DeviceHandler(Handler):
def handle(self, harness): def handle(self, harness):
runner = None runner = None
hardware = self.get_hardware() hardware = self.get_hardware()
if hardware:
self.instance.dut = hardware.id
if not hardware: if not hardware:
return return

View file

@ -273,6 +273,8 @@ class Reporting:
suite['retries'] = instance.retries suite['retries'] = instance.retries
if instance.dut:
suite["dut"] = instance.dut
if available_ram: if available_ram:
suite["available_ram"] = available_ram suite["available_ram"] = available_ram
if available_rom: if available_rom:

View file

@ -932,6 +932,8 @@ class ProjectBuilder(FilterBuilder):
if instance.handler.ready and instance.run: if instance.handler.ready and instance.run:
more_info = instance.handler.type_str more_info = instance.handler.type_str
htime = instance.execution_time htime = instance.execution_time
if instance.dut:
more_info += f": {instance.dut},"
if htime: if htime:
more_info += " {:.3f}s".format(htime) more_info += " {:.3f}s".format(htime)
else: else:

View file

@ -54,6 +54,7 @@ class TestInstance:
self.name = os.path.join(platform.name, testsuite.name) self.name = os.path.join(platform.name, testsuite.name)
self.run_id = self._get_run_id() self.run_id = self._get_run_id()
self.dut = None
self.build_dir = os.path.join(outdir, platform.name, testsuite.name) self.build_dir = os.path.join(outdir, platform.name, testsuite.name)
self.domains = None self.domains = None