From 7fb5ec839a11156c8df46e0097b921590012eed7 Mon Sep 17 00:00:00 2001 From: Armin Kessler Date: Thu, 31 Oct 2024 08:33:02 +0100 Subject: [PATCH] scripts: twister: Fix serial_py referenced before assignment This fixes `serial_py referenced before assignment` if `flash_before` is set. (cherry picked from commit 78f688a3e710fc8294fbc99d1bc4e676100ef213) Original-Signed-off-by: Armin Kessler GitOrigin-RevId: 78f688a3e710fc8294fbc99d1bc4e676100ef213 Cr-Build-Id: 8732478031671813841 Cr-Build-Url: https://cr-buildbucket.appspot.com/build/8732478031671813841 Copybot-Job-Name: zephyr-main-copybot-downstream Change-Id: I7fd0d843783f2d00085c9b999c498c8e7ffac89a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5984633 Reviewed-by: Ting Shen Commit-Queue: Ting Shen Tested-by: ChromeOS Prod (Robot) --- scripts/pylib/twister/twisterlib/hardwaremap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pylib/twister/twisterlib/hardwaremap.py b/scripts/pylib/twister/twisterlib/hardwaremap.py index 3b03b830aef..2bb0a5a54eb 100644 --- a/scripts/pylib/twister/twisterlib/hardwaremap.py +++ b/scripts/pylib/twister/twisterlib/hardwaremap.py @@ -258,6 +258,7 @@ def load(self, map_file): flash_with_test = dut.get('flash_with_test') if flash_with_test is None: flash_with_test = self.options.device_flash_with_test + serial_pty = dut.get('serial_pty') flash_before = dut.get('flash_before') if flash_before is None: flash_before = self.options.flash_before and (not (flash_with_test or serial_pty)) @@ -265,7 +266,6 @@ def load(self, map_file): id = dut.get('id') runner = dut.get('runner') runner_params = dut.get('runner_params') - serial_pty = dut.get('serial_pty') serial = dut.get('serial') baud = dut.get('baud', None) product = dut.get('product')