Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 30 additions & 7 deletions arm-software/embedded/arm-runtimes/test-support/run_fvp.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import re
import subprocess
import sys
from os import environ
from os import path
from dataclasses import dataclass
import shlex
Expand Down Expand Up @@ -55,6 +56,25 @@ def run_fvp(
raise Exception(f"{fvp_model} is not a recognised model name")
model = MODELS[fvp_model]

env = environ.copy()
if fvp_model == "corstone-310":
# Corstone-310 v11.27 requires PYTHONHOME to be set to the version of
# python included in the install, and fmtplib and python/lib to be found
# in LD_LIBRARY_PATH. If the installed version include these, then add
# them to the environment.
fmtplib_dir = path.join(fvp_install_dir, "Corstone-310", "fmtplib")
python_dir = path.join(fvp_install_dir, "Corstone-310", "python")
ld_library_paths = []
if path.exists(fmtplib_dir):
ld_library_paths.append(fmtplib_dir)
if path.exists(python_dir):
ld_library_paths.append(path.join(python_dir, "lib"))
env["PYTHONHOME"] = python_dir
if len(ld_library_paths) > 0:
if "LD_LIBRARY_PATH" in env:
ld_library_paths.append(env["LD_LIBRARY_PATH"])
env["LD_LIBRARY_PATH"] = ":".join(ld_library_paths)

command = [path.join(fvp_install_dir, model.model_exe)]
command.extend(["--quiet"])
for config in fvp_configs:
Expand Down Expand Up @@ -103,6 +123,7 @@ def run_fvp(
timeout=timeout,
cwd=working_directory,
check=False,
env=env,
)

# Corstone-310 prints out boilerplate text on stdout alongside the actual
Expand All @@ -111,16 +132,18 @@ def run_fvp(
# failure. To work around this, we cut out the model's boilerplate output.
if fvp_model == "corstone-310":
decoded_stdout = result.stdout.decode()
expected_stdout_format = r"""
Ethos-U rev [0-9a-z]+ --- \w{3} \d{2} \d{4} \d{2}:\d{2}:\d{2}
boilerplate_pattern = r"""
Ethos-U rev [0-9a-z]+ --- \w{3} {1,2}\d{1,2} \d{4} \d{2}:\d{2}:\d{2}
\(C\) COPYRIGHT (?:\d{4}|\d{4}-\d{4})(?:,\s?(?:\d{4}|\d{4}-\d{4}))* Arm Limited
ALL RIGHTS RESERVED

(.*)
Info: /OSCI/SystemC: Simulation stopped by user.
\[warning \]\[main@0\]\[\d+ ns\] Simulation stopped by user
"""

# Not all Corstone-310 versions print the "Info" message.
stop_info_pattern = "\nInfo: /OSCI/SystemC: Simulation stopped by user.\n"
stop_warning_pattern = r"""\[warning \]\[main@0\]\[\d+ ns\] Simulation stopped by user
"""
expected_stdout_format = (
f"{boilerplate_pattern}(.*?)(?:{stop_info_pattern})?{stop_warning_pattern}"
)
regex_result = re.fullmatch(
expected_stdout_format, decoded_stdout, flags=re.DOTALL
)
Expand Down
1 change: 0 additions & 1 deletion arm-software/embedded/fvp/config/m-pacbti.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@

# Enable M-profile PAC and BTI
cpu0.CFGPACBTI=1
cpu0.ID_ISAR5.PACBTI=1