Skip to content

Commit

Permalink
trunner: assert jffs2 via output instead of time
Browse files Browse the repository at this point in the history
JIRA: CI-375
  • Loading branch information
maska989 committed Oct 30, 2023
1 parent a37c915 commit 545bacb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
19 changes: 15 additions & 4 deletions trunner/harness/plo.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,24 @@ def erase(self, device: str, offset: int, size: int, timeout: Optional[int] = No
e.cmd = cmd
raise e

def jffs2(self, device: str, erase: bool, cleanmarkers: PloJffs2CleanmarkerSpec, timeout: Optional[int] = None):
def jffs2(self, device: str, erase: bool, cleanmarkers: PloJffs2CleanmarkerSpec, block_timeout: int):
"""Performs jffs2 command."""

block_count = cleanmarkers.number_of_blocks

cmd = f"jffs2 -d {device} -c {cleanmarkers}"
if erase:
cmd += " -e"

self.cmd(cmd, timeout)
self.send_cmd(cmd)

for i in range(0, block_count):
try:
self.dut.expect_exact(f"jffs2: block {i}/{block_count}", timeout=block_timeout)
except pexpect.TIMEOUT as e:
raise PloError("Wrong jffs2 command output!", cmd=cmd, output=self.dut.before) from e

self._assert_prompt()

def app(
self, device: str, file: str, imap: str, dmap: str, exec: bool = False
Expand Down Expand Up @@ -220,7 +230,8 @@ class PloJffsImageProperty(PloImageProperty):

flash_device_id: str
cleanmarkers_args: PloJffs2CleanmarkerSpec
timeout: int
# optimal timeout for erasing 1 block using jffs2 command
block_timeout: Optional[int] = 1


class PloImageLoader(TerminalHarness, PloInterface):
Expand Down Expand Up @@ -258,7 +269,7 @@ def __call__(self):
self.plo_loader()

if isinstance(self.image, PloJffsImageProperty):
self.jffs2(self.image.flash_device_id, True, self.image.cleanmarkers_args, self.image.timeout)
self.jffs2(self.image.flash_device_id, True, self.image.cleanmarkers_args, self.image.block_timeout)

with self.phoenixd.run():
self.copy_file2mem(
Expand Down
1 change: 0 additions & 1 deletion trunner/target/armv7a7.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ class IMX6ULLEvkTarget(ARMv7A7Target):
block_size=0x10000,
cleanmarker_size=0x10,
),
timeout=275,
)
name = "armv7a7-imx6ull-evk"

Expand Down
1 change: 0 additions & 1 deletion trunner/target/armv7a9.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ class Zynq7000ZedboardTarget(ARMv7A9Target):
block_size=0x10000,
cleanmarker_size=0x10,
),
timeout=140,
)
name = "armv7a9-zynq7000-zedboard"

Expand Down

0 comments on commit 545bacb

Please sign in to comment.