From 399da62d2975adc8cc138bdb9c845b6baa8ae3fe Mon Sep 17 00:00:00 2001 From: Mateusz Bloch Date: Tue, 25 Jul 2023 13:59:57 +0200 Subject: [PATCH] test_commit --- trunner/target/armv7a7.py | 17 ++--------------- trunner/target/armv7m7.py | 18 ++---------------- trunner/target/base.py | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 31 deletions(-) diff --git a/trunner/target/armv7a7.py b/trunner/target/armv7a7.py index 251f0d1a9..2557ceae2 100644 --- a/trunner/target/armv7a7.py +++ b/trunner/target/armv7a7.py @@ -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, @@ -12,11 +12,10 @@ 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): @@ -24,18 +23,6 @@ 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" diff --git a/trunner/target/armv7m7.py b/trunner/target/armv7m7.py index ce4556b53..c35227074 100644 --- a/trunner/target/armv7m7.py +++ b/trunner/target/armv7m7.py @@ -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, @@ -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): @@ -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" diff --git a/trunner/target/base.py b/trunner/target/base.py index e7412d234..2cfbd7540 100644 --- a/trunner/target/base.py +++ b/trunner/target/base.py @@ -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 @@ -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.