twister: fix platform len check for device-testing

For using --device-testing with --device-serial or --device-serial-pty
it is necessary to provide the platform to be used for testing.
Not specifying a platform or specifying more than one is an error.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
This commit is contained in:
Luca Burelli 2024-03-21 14:31:26 +01:00 committed by Alberto Escolar
commit 568f754f59

View file

@ -786,10 +786,10 @@ def parse_arguments(parser, args, options = None):
logger.error("valgrind enabled but valgrind executable not found") logger.error("valgrind enabled but valgrind executable not found")
sys.exit(1) sys.exit(1)
if options.device_testing and (options.device_serial or options.device_serial_pty) and len(options.platform) > 1: if options.device_testing and (options.device_serial or options.device_serial_pty) and len(options.platform) != 1:
logger.error("""When --device-testing is used with logger.error("When --device-testing is used with --device-serial "
--device-serial or --device-serial-pty, "or --device-serial-pty, exactly one platform must "
only one platform is allowed""") "be specified")
sys.exit(1) sys.exit(1)
if options.device_flash_with_test and not options.device_testing: if options.device_flash_with_test and not options.device_testing: