scripts: twister: update twister to support QEMU platforms with sysbuild
Update twister to support running QEMU platforms with sysbuild, by parsing domains.yaml and executing the "run" target of the default application. This will allow twister to test QEMU targets with sysbuild. It is assumed that QEMU targets will add any external images they need in the build phase Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit is contained in:
parent
a13e5d0a2d
commit
b579a44e9c
3 changed files with 22 additions and 10 deletions
|
@ -19,6 +19,8 @@ import select
|
|||
import re
|
||||
import psutil
|
||||
from twisterlib.environment import ZEPHYR_BASE
|
||||
sys.path.insert(0, os.path.join(ZEPHYR_BASE, "scripts/pylib/build_helpers"))
|
||||
from domains import Domains
|
||||
|
||||
try:
|
||||
import serial
|
||||
|
@ -823,8 +825,21 @@ class QEMUHandler(Handler):
|
|||
# We pass this to QEMU which looks for fifos with .in and .out
|
||||
# suffixes.
|
||||
|
||||
if self.instance.testsuite.sysbuild:
|
||||
# Load domain yaml to get default domain build directory
|
||||
# Note: for targets using QEMU, we assume that the target will
|
||||
# have added any additional images to the run target manually
|
||||
domain_path = os.path.join(self.build_dir, "domains.yaml")
|
||||
domains = Domains.from_file(domain_path)
|
||||
logger.debug("Loaded sysbuild domain data from %s" % (domain_path))
|
||||
build_dir = domains.get_default_domain().build_dir
|
||||
else:
|
||||
build_dir = self.build_dir
|
||||
|
||||
# QEMU fifo will use main build dir
|
||||
self.fifo_fn = os.path.join(self.instance.build_dir, "qemu-fifo")
|
||||
self.pid_fn = os.path.join(self.instance.build_dir, "qemu.pid")
|
||||
# PID file will be created in the main sysbuild app's build dir
|
||||
self.pid_fn = os.path.join(build_dir, "qemu.pid")
|
||||
|
||||
if os.path.exists(self.pid_fn):
|
||||
os.unlink(self.pid_fn)
|
||||
|
@ -849,7 +864,7 @@ class QEMUHandler(Handler):
|
|||
|
||||
logger.debug("Running %s (%s)" % (self.name, self.type_str))
|
||||
command = [self.generator_cmd]
|
||||
command += ["-C", self.build_dir, "run"]
|
||||
command += ["-C", build_dir, "run"]
|
||||
|
||||
is_timeout = False
|
||||
qemu_pid = None
|
||||
|
|
|
@ -14,13 +14,13 @@ import queue
|
|||
import time
|
||||
import multiprocessing
|
||||
import traceback
|
||||
import scl
|
||||
from colorama import Fore
|
||||
from multiprocessing import Lock, Process, Value
|
||||
from multiprocessing.managers import BaseManager
|
||||
from twisterlib.cmakecache import CMakeCache
|
||||
from twisterlib.environment import canonical_zephyr_base
|
||||
from twisterlib.log_helper import log_command
|
||||
from domains import Domains
|
||||
|
||||
logger = logging.getLogger('twister')
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
@ -364,15 +364,11 @@ class FilterBuilder(CMake):
|
|||
return {}
|
||||
|
||||
if self.testsuite.sysbuild:
|
||||
# We must parse the domains.yaml file to determine the
|
||||
# default sysbuild application
|
||||
# Load domain yaml to get default domain build directory
|
||||
domain_path = os.path.join(self.build_dir, "domains.yaml")
|
||||
domain_yaml = scl.yaml_load(domain_path)
|
||||
domains = Domains.from_file(domain_path)
|
||||
logger.debug("Loaded sysbuild domain data from %s" % (domain_path))
|
||||
default_domain = domain_yaml['default']
|
||||
for domain in domain_yaml['domains']:
|
||||
if domain['name'] == default_domain:
|
||||
domain_build = domain['build_dir']
|
||||
domain_build = domains.get_default_domain().build_dir
|
||||
cmake_cache_path = os.path.join(domain_build, "CMakeCache.txt")
|
||||
defconfig_path = os.path.join(domain_build, "zephyr", ".config")
|
||||
edt_pickle = os.path.join(domain_build, "zephyr", "edt.pickle")
|
||||
|
|
|
@ -193,6 +193,7 @@ if not ZEPHYR_BASE:
|
|||
print(f'ZEPHYR_BASE unset, using "{ZEPHYR_BASE}"')
|
||||
|
||||
sys.path.insert(0, os.path.join(ZEPHYR_BASE, "scripts/pylib/twister/"))
|
||||
sys.path.insert(0, os.path.join(ZEPHYR_BASE, "scripts/pylib/build_helpers"))
|
||||
|
||||
from twisterlib.testplan import TestPlan
|
||||
from twisterlib.environment import TwisterEnv, parse_arguments
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue