Skip to content

Commit

Permalink
CoreValidation: Initial support to run tests in Qemu
Browse files Browse the repository at this point in the history
  • Loading branch information
JonatanAntoni committed Mar 5, 2024
1 parent 4d18b8d commit fd54c9a
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions CMSIS/CoreValidation/Project/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ class OptimizationAxis(Enum):
# DeviceAxis.CA9NEON: ("_VE_Cortex-A9x1", [])
}

QEMU_MACHINE = {
DeviceAxis.CM3: ("mps2-an385"),
DeviceAxis.CM4: ("mps2-an386"),
DeviceAxis.CM7: ("mps2-an500"),
DeviceAxis.CM33: ("mps2-an505"),
DeviceAxis.CM55: ("mps3-an547")
}

def config_suffix(config, timestamp=True):
suffix = f"{config.compiler[0]}-{config.optimize[0]}-{config.device[1]}"
if timestamp:
Expand Down Expand Up @@ -208,6 +216,16 @@ def run(config, results):
logging.exception(ex)


@matrix_action
def qemu(config, results):
"""Run the selected configurations."""
if not config.device in QEMU_MACHINE:
logging.error("Qemu doesn't support target device '%s'!", config.device)
return
logging.info("Running Core Validation on Qemu ...")
yield qemu_exec(config)


@matrix_command()
def cbuild_clean(project):
return ["cbuild", "-c", project]
Expand Down Expand Up @@ -246,6 +264,19 @@ def model_exec(config):
return cmdline


@matrix_command(test_report=ConsoleReport() |
CropReport('<\?xml version="1.0"\?>', '</report>') |
TransformReport('validation.xsl') |
JUnitReport(title=lambda title, result: f"{result.command.config.compiler}."
f"{result.command.config.optimize}."
f"{result.command.config.device}."
f"{title}"))
def qemu_exec(config):
cmdline = ["qemu-system-arm", "-semihosting-config", "enable=on", "-monitor", "none", "-serial", "none", "-nographic"]
cmdline += ["-machine", QEMU_MACHINE[config.device]]
cmdline += ["-kernel", f"{build_dir(config)}/{output_dir(config)}/Validation.{config.compiler.image_ext}"]
return cmdline

@matrix_filter
def filter_iar(config):
return config.compiler == CompilerAxis.IAR
Expand Down

0 comments on commit fd54c9a

Please sign in to comment.