Skip to content

Commit

Permalink
test_commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusz-bloch committed Jul 25, 2023
1 parent e38da69 commit 399da62
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 31 deletions.
17 changes: 2 additions & 15 deletions trunner/target/armv7a7.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Callable, Optional

from trunner.dut import Dut, SerialDut
from trunner.dut import SerialDut
from trunner.harness import (
HarnessBuilder,
PloInterface,
Expand All @@ -12,30 +12,17 @@
PloJffs2CleanmarkerSpec,
)

from trunner.harness import TerminalHarness
from trunner.host import Host
from trunner.tools import Phoenixd, Psu
from trunner.types import TestResult, TestOptions
from .base import TargetBase, find_port
from .base import TargetBase, PsuPloLoader, find_port


class ARMv7A7TargetRebooter(Rebooter):
def _set_flash_mode(self, flash):
self.host.set_flash_mode(not flash)


class PsuPloLoader(TerminalHarness, PloInterface):
def __init__(self, dut: Dut, psu: Psu):
TerminalHarness.__init__(self)
PloInterface.__init__(self, dut)
self.psu = psu

def __call__(self):
"""Loads plo image to RAM using psu tool and erases an area intended for rootfs."""
self.psu.run()
self.wait_prompt()


class ARMv7A7Target(TargetBase, PloInterface, Rebooter):
plo_psu_script = "plo-ram.sdp"

Expand Down
18 changes: 2 additions & 16 deletions trunner/target/armv7m7.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from typing import Callable, Optional
from trunner.dut import Dut, SerialDut
from trunner.dut import SerialDut
from trunner.harness import (
HarnessBuilder,
PloInterface,
PloImageLoader,
PloImageProperty,
PloPhoenixdAppLoader,
Expand All @@ -11,11 +10,10 @@
RebooterHarness,
ShellHarness,
)
from trunner.harness.base import TerminalHarness
from trunner.host import Host
from trunner.tools import Phoenixd, Psu
from trunner.types import TestOptions, TestResult
from .base import TargetBase, find_port
from .base import TargetBase, PsuPloLoader, find_port


class ARMv7M7TargetRebooter(Rebooter):
Expand All @@ -29,18 +27,6 @@ def _reboot_hard(self):
self._reboot_soft()


class PsuPloLoader(TerminalHarness, PloInterface):
def __init__(self, dut: Dut, psu: Psu):
TerminalHarness.__init__(self)
PloInterface.__init__(self, dut)
self.psu = psu

def __call__(self):
"""Loads plo image to RAM using psu tool."""
self.psu.run()
self.wait_prompt()


class ARMv7M7Target(TargetBase):
image = PloImageProperty(file="phoenix.disk", source="usb0", memory_bank="flash0")
plo_psu_script = "plo-ram.sdp"
Expand Down
15 changes: 15 additions & 0 deletions trunner/target/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

from serial.tools import list_ports

from trunner.dut import Dut
from trunner.tools import Psu
from trunner.harness import TerminalHarness, PloInterface
from trunner.dut import PortNotFound
from trunner.types import TestOptions, TestResult

Expand All @@ -29,6 +32,18 @@ def find_port(port_hint: str) -> str:
return port.device


class PsuPloLoader(TerminalHarness, PloInterface):
def __init__(self, dut: Dut, psu: Psu):
TerminalHarness.__init__(self)
PloInterface.__init__(self, dut)
self.psu = psu

def __call__(self):
"""Loads plo image to RAM using psu tool and erases an area intended for rootfs."""
self.psu.run()
self.wait_prompt()


class TargetBase(ABC):
"""Base class to represent the target device.
Expand Down

0 comments on commit 399da62

Please sign in to comment.