Skip to content

Commit

Permalink
trunner: add armv8r52-mps3an536-qemu target
Browse files Browse the repository at this point in the history
JIRA: CI-468
  • Loading branch information
adamdebek committed Oct 11, 2024
1 parent 0733d9f commit 5db56db
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 6 deletions.
41 changes: 36 additions & 5 deletions psh/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,72 +8,103 @@ test:
# additional resources may be necessary for psh tests, especially on smaller syspage targets
# ensure no other binaries are loaded from the previous tests during the psh tests
reboot: True
targets:
include: [armv8r52-mps3an536-qemu]

- name: auth
harness: test-auth.py
targets:
include: [armv8r52-mps3an536-qemu]


#FIXME - test-pshlogin.py is only for targets with root
- name: pshlogin
harness: test-pshlogin.py
targets:
exclude: [armv7m7-imxrt106x-evk, armv7m7-imxrt117x-evk, armv7m4-stm32l4x6-nucleo, sparcv8leon3-generic-qemu]
exclude: [armv7m7-imxrt106x-evk, armv7m7-imxrt117x-evk, armv7m4-stm32l4x6-nucleo, sparcv8leon3-generic-qemu, armv8r52-mps3an536-qemu]

- name: echo
harness: test-echo.py
targets:
include: [armv8r52-mps3an536-qemu]

- name: date
harness: test-date.py
targets:
include: [armv8r52-mps3an536-qemu]

- name: prompt
harness: test-prompt.py
targets:
include: [armv8r52-mps3an536-qemu]

- name: autocompletion
harness: test-autocompletion.py
targets:
include: [armv8r52-mps3an536-qemu]

- name: ps
harness: test-ps.py
targets:
include: [armv8r52-mps3an536-qemu]

- name: cat
harness: test-cat.py
targets:
include: [armv8r52-mps3an536-qemu]

- name: cat-shells
harness: test-cat-shells.py
targets:
exclude: [armv7m7-imxrt106x-evk, armv7m7-imxrt117x-evk, armv7m4-stm32l4x6-nucleo, sparcv8leon3-generic-qemu]
exclude: [armv7m7-imxrt106x-evk, armv7m7-imxrt117x-evk, armv7m4-stm32l4x6-nucleo, sparcv8leon3-generic-qemu, armv8r52-mps3an536-qemu]

- name: kill
harness: test-kill.py
targets:
include: [armv8r52-mps3an536-qemu]

- name: mkdir
harness: test-mkdir.py
targets:
include: [armv8r52-mps3an536-qemu]

- name: touch
harness: test-touch.py
targets:
include: [armv8r52-mps3an536-qemu]

- name: touch-rootfs
harness: test-touch-rootfs.py
targets:
exclude: [armv7m7-imxrt106x-evk, armv7m7-imxrt117x-evk, armv7m4-stm32l4x6-nucleo, sparcv8leon3-generic-qemu]
exclude: [armv7m7-imxrt106x-evk, armv7m7-imxrt117x-evk, armv7m4-stm32l4x6-nucleo, sparcv8leon3-generic-qemu, armv8r52-mps3an536-qemu]

- name: ls
harness: test-ls.py
targets:
include: [armv8r52-mps3an536-qemu]

- name: ls-rootfs
harness: test-ls-rootfs.py
targets:
exclude: [armv7m7-imxrt106x-evk, armv7m7-imxrt117x-evk, armv7m4-stm32l4x6-nucleo, sparcv8leon3-generic-qemu]
exclude: [armv7m7-imxrt106x-evk, armv7m7-imxrt117x-evk, armv7m4-stm32l4x6-nucleo, sparcv8leon3-generic-qemu, armv8r52-mps3an536-qemu]

- name: runfile
harness: test-runfile.py
targets:
# runfile applet is not intended for non-rootfs targets
exclude: [armv7m7-imxrt106x-evk, armv7m7-imxrt117x-evk, armv7m4-stm32l4x6-nucleo, sparcv8leon3-generic-qemu]
exclude: [armv7m7-imxrt106x-evk, armv7m7-imxrt117x-evk, armv7m4-stm32l4x6-nucleo, sparcv8leon3-generic-qemu, armv8r52-mps3an536-qemu]

- name: history
harness: test-history.py
targets:
include: [armv8r52-mps3an536-qemu]

- name: help
harness: test-help.py
targets:
include: [armv8r52-mps3an536-qemu]

- name: exit
harness: test-exit.py
targets:
include: [armv8r52-mps3an536-qemu]
2 changes: 2 additions & 0 deletions runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
RISCV64GenericQemuTarget,
SPARCV8Leon3GenericQemuTarget,
ARMv7A9Zynq7000QemuTarget,
ARMv8R52MPS3AN536QemuTarget,
STM32L4x6Target,
Zynq7000ZedboardTarget,
IMX6ULLEvkTarget,
Expand Down Expand Up @@ -232,6 +233,7 @@ def resolve_targets_and_hosts() -> Tuple[Dict[str, Type[TargetBase]], Dict[str,
IA32GenericQemuTarget,
RISCV64GenericQemuTarget,
ARMv7A9Zynq7000QemuTarget,
ARMv8R52MPS3AN536QemuTarget,
STM32L4x6Target,
IMXRT106xEvkTarget,
IMXRT117xEvkTarget,
Expand Down
36 changes: 36 additions & 0 deletions trunner/dut.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,42 @@ def open(self):
# on proper guest OSes this results in `\r\r\n` which might be incorrectly interpreted by CI log viewers
# use custom preexec_fn to setup termios of child PTY
self.pexpect_proc = pexpect.spawn(*self.args, preexec_fn=self._set_termios_raw, **self.kwargs)
time.sleep(0.2)
self._set_logfiles()

class fdspawncustom(pexpect.spawn):

Check failure on line 208 in trunner/dut.py

View workflow job for this annotation

GitHub Actions / build (3.9)

E302 expected 2 blank lines, found 1

Check failure on line 208 in trunner/dut.py

View workflow job for this annotation

GitHub Actions / build (3.10)

E302 expected 2 blank lines, found 1

Check failure on line 208 in trunner/dut.py

View workflow job for this annotation

GitHub Actions / build (3.11)

E302 expected 2 blank lines, found 1
"""
The current UART implementation on the ARMv8R52MPS3AN536 breaks when bytes are sent too fast.
To alleviate this problem, we override the pexpect class and introduce a delay in the send function.
"""

def send(self, s):
ret = 0
for c in s:
ret += super().send(c)
time.sleep(0.03)

return ret


class ARMv8R52MPS3AN536_Dut(ProcessDut):
@staticmethod
def _set_termios_raw():
"""set current tty not to process newlines"""
attr = termios.tcgetattr(STDOUT_FILENO)

# disable any newline manilpulations in c_oflag
attr[1] &= ~(termios.ONLCR | termios.OCRNL | termios.ONOCR | termios.ONLRET)

termios.tcsetattr(STDOUT_FILENO, termios.TCSANOW, attr)

def open(self):
# qemu when using stdio serial enforces ONLCR termios flag (converting `\n` to `\r\n`)
# on proper guest OSes this results in `\r\r\n` which might be incorrectly interpreted by CI log viewers
# use custom preexec_fn to setup termios of child PTY
self.pexpect_proc = fdspawncustom(
*self.args, preexec_fn=self._set_termios_raw, **self.kwargs
)
self._set_logfiles()


Expand Down
2 changes: 2 additions & 0 deletions trunner/target/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
RISCV64GenericQemuTarget,
ARMv7A9Zynq7000QemuTarget,
SPARCV8Leon3GenericQemuTarget,
ARMv8R52MPS3AN536QemuTarget
)
from .host import HostPCGenericTarget

Expand All @@ -19,6 +20,7 @@
"RISCV64GenericQemuTarget",
"SPARCV8Leon3GenericQemuTarget",
"ARMv7A9Zynq7000QemuTarget",
"ARMv8R52MPS3AN536QemuTarget",
"HostPCGenericTarget",
"STM32L4x6Target",
"Zynq7000ZedboardTarget",
Expand Down
18 changes: 17 additions & 1 deletion trunner/target/emulated.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Callable

from trunner.ctx import TestContext
from trunner.dut import QemuDut
from trunner.dut import QemuDut, ARMv8R52MPS3AN536_Dut
from trunner.harness import HarnessBuilder, RebooterHarness, ShellHarness, TestStartRunningHarness
from trunner.types import TestOptions, TestResult
from .base import TargetBase
Expand Down Expand Up @@ -107,3 +107,19 @@ def __init__(self):
@classmethod
def from_context(cls, _: TestContext):
return cls()


class ARMv8R52MPS3AN536QemuTarget(QemuTarget):
name = "armv8r52-mps3an536-qemu"
rootfs = False
experimental = True

def __init__(self):
super().__init__("armv8r52-mps3an536-qemu.sh")
self.dut = ARMv8R52MPS3AN536_Dut(f"{self.project_dir}/scripts/{self.script}", encoding="utf-8")
self.rebooter = QemuDutRebooter(self.dut)


@classmethod

Check failure on line 123 in trunner/target/emulated.py

View workflow job for this annotation

GitHub Actions / build (3.9)

E303 too many blank lines (2)

Check failure on line 123 in trunner/target/emulated.py

View workflow job for this annotation

GitHub Actions / build (3.10)

E303 too many blank lines (2)

Check failure on line 123 in trunner/target/emulated.py

View workflow job for this annotation

GitHub Actions / build (3.11)

E303 too many blank lines (2)
def from_context(cls, _: TestContext):
return cls()

0 comments on commit 5db56db

Please sign in to comment.