twister: Cleanup redundant if / else

Convert following construction:

elif self.options.device_serial or self.options.device_serial_pty:
 if self.options.device_serial:
   ...
 else
   ...

to the construction:

elif self.options.device_serial:
  ...
else self.options.device_serial_pty:
  ...

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commit is contained in:
Andrei Emeltchenko 2023-04-18 11:35:36 +03:00 committed by Anas Nashif
parent 186d706c73
commit 29dc4b68ec

View file

@ -169,24 +169,24 @@ class HardwareMap:
if d.connected:
self.options.platform.append(d.platform)
elif self.options.device_serial or self.options.device_serial_pty:
if self.options.device_serial:
self.add_device(self.options.device_serial,
self.options.platform[0],
self.options.pre_script,
False,
baud=self.options.device_serial_baud,
flash_timeout=self.options.device_flash_timeout,
flash_with_test=self.options.device_flash_with_test
)
else:
self.add_device(self.options.device_serial_pty,
self.options.platform[0],
self.options.pre_script,
True,
flash_timeout=self.options.device_flash_timeout,
flash_with_test=self.options.device_flash_with_test
)
elif self.options.device_serial:
self.add_device(self.options.device_serial,
self.options.platform[0],
self.options.pre_script,
False,
baud=self.options.device_serial_baud,
flash_timeout=self.options.device_flash_timeout,
flash_with_test=self.options.device_flash_with_test
)
elif self.options.device_serial_pty:
self.add_device(self.options.device_serial_pty,
self.options.platform[0],
self.options.pre_script,
True,
flash_timeout=self.options.device_flash_timeout,
flash_with_test=self.options.device_flash_with_test
)
# the fixtures given by twister command explicitly should be assigned to each DUT
if self.options.fixture: