Skip to content

Commit dfcd465

Browse files
mkasenbergsjanc
authored andcommitted
iutctl: zaphyr: native: Move removing flash.bin to ztestcase
The iutctl.stop method was not the best place to remove the flash.bin, because some WIDs call it in the middle of a test case. Let's remove the file before each test case in TestCase.__init__.
1 parent 27b87b8 commit dfcd465

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

autopts/ptsprojects/zephyr/iutctl.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ def __init__(self, args):
3737
def stop(self):
3838
super().stop()
3939

40-
if self.iut_mode == "native":
41-
flash_bin = os.path.join(AUTOPTS_ROOT_DIR, 'flash.bin')
42-
if os.path.exists(flash_bin):
43-
os.remove(flash_bin)
40+
def remove_flash_bin(self):
41+
flash_bin = os.path.join(AUTOPTS_ROOT_DIR, 'flash.bin')
42+
if os.path.exists(flash_bin):
43+
os.remove(flash_bin)
4444

4545

4646
def get_iut():

autopts/ptsprojects/zephyr/ztestcase.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ def __init__(self, *args, **kwargs):
3838
# Await IUT ready event
3939
self.cmds.insert(2, TestFunc(self.zephyrctl.wait_iut_ready_event, False))
4040

41+
if self.zephyrctl.iut_mode == "native":
42+
self.cmds.insert(0, TestFunc(self.zephyrctl.remove_flash_bin))
43+
4144
self.cmds.append(TestFuncCleanUp(self.stack.cleanup))
4245

4346
# Last command is to stop QEMU or HW.

0 commit comments

Comments
 (0)