With no tests found when pointing to a directory with no tests, which is
not wrong, we were exiting with 1, when twister was crashing because of
bad syntax or when not able to load a python module, same thing.
Now fail early when there are schema errors or other issues, and fail
with a warning when no tests are found, which should be fine given that
a warning is emitted, but not an error.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add a dco.yml workflow that runs the action-dco composite action over a
pull request's commits, verifying each carries a Signed-off-by line
matching the author (First Last <email>) as required by the DCO.
Drop the now-redundant Identity compliance check, along with its
.gitignore output entry and the dependabot exclude in compliance.yml.
The empty-body check it also did stays covered by gitlint's
body-is-missing rule.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Assisted-by: Claude:claude-opus-4.8
Update "out_dt_define" macro to allow integer types
as the value parameter. Prevents unneeded warning
when "val" is specified as an integer.
Signed-off-by: Omar Naffaa <onaffaa@qti.qualcomm.com>
tree-sitter 0.26.0 corrupts memory when traversing nodes from the
tree-sitter-cmake grammar, causing cmake_style.py to segfault. This is
reproducible by running the checker on
modules/hal_nordic/nrfx/CMakeLists.txt:
scripts/cmake/cmake_style.py modules/hal_nordic/nrfx/CMakeLists.txt
Cap the dependency at <0.26 and pin the lock back to the working 0.25.2.
Assisted-by: Claude:opus-4.8
Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
Twister exits with an error when --enable-valgrind is given but the
valgrind executable is not on PATH. The blackbox test calls twister
in-process, so that exit propagated as SystemExit and failed the test
on hosts without valgrind installed.
Add a requires_tool() helper to the blackbox conftest that builds a
skipif marker from shutil.which(), and apply it to the valgrind
parametrization. The baseline case without the option is unaffected and
still runs everywhere.
Assisted-by: Claude:opus-4.8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Replace the importlib-based module loader pattern used across blackbox
tests with direct calls to twister_main(), and overhaul the shared
conftest.py: rename fixtures for clarity, isolate logging state via a
dedicated _reset_logging() helper and autouse fixture, add helper
functions read_testplan(), active_testcases(), and active_testsuites(),
and introduce session-scoped hello_world_elf and out_path fixtures.
Add pytest markers fast, build, and run. Rename test_filename_mock to
TEST_FILENAME_MOCK and resolve TEST_DATA through os.path.realpath() to
avoid symlink mismatches. Delete test_addon.py and restructure
test_config.py and test_coverage.py into focused classes grouped by
feature.
Assisted-by: Claude:opus-4.8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The default for --ninja was computed from sys.argv:
default=not any(a in sys.argv for a in ("-k", "--make"))
sys.argv is the process argument list, which only coincides with the
argument list twister acts on when twister runs as a CLI. Calling
twister_main(args) in-process, as the blackbox tests do, therefore
selects the generator based on whatever launched the interpreter:
- twister_main(['--make', ...]) still builds with Ninja, silently
ignoring --make.
- Running the blackbox suite as 'pytest -k <expr>' puts '-k' into
sys.argv, so every build switches to Unix Makefiles.
Drop the sys.argv sniffing and derive options.ninja from options.make
after parsing, so the generator follows the arguments twister was
actually given.
Assisted-by: Claude:opus-4.8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add process-level caches to TwisterEnv.check_zephyr_version() and
get_toolchain() so repeated twister_main() calls within the same
process skip slow git/cmake subprocess re-runs, and add a module-level
cache to generate_platforms() keyed on the board/soc/arch root tuples.
This significantly speeds up in-process invocations such as the
blackbox test suite.
Assisted-by: Claude:opus-4.8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This change allows the following command to be run more than once
without crashing:
> twister --outdir directory-with-trailing-slash/
Without this fix, the 2nd run would abort with an error like this:
> shutil.Error: Cannot move a directory 'directory-with-trailing-slash/'
> into itself 'directory-with-trailing-slash/.1'.
Signed-off-by: Reto Schneider <code@reto-schneider.ch>
When the Robot Framework executable is not found, subprocess
raised an unhandled FileNotFoundError that aborted the entire
Twister run instead of just the affected test.
Catch the exception in the Robot harness, mark the instance as
skipped with a descriptive reason, and continue so remaining
tests still execute.
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
The assigner compared the PR's west.yml and MAINTAINERS.yml against the
checked-out base-branch tip. For pull_request_target the working tree is
the base branch HEAD, while pr_west.yml/pr_MAINTAINERS.yml come from the
asynchronously-recomputed pull/<N>/merge ref, whose base can lag well
behind that tip. The diff therefore reported not only the projects/areas
the PR actually changed but also everything that advanced on the base
branch after the PR was created, and added all of those maintainers and
collaborators as reviewers.
Compare instead against the merge ref's first parent (FETCH_HEAD^1), the
base the merge was computed from, so the diff isolates exactly the PR's
own changes regardless of how stale the merge ref is. The workflow now
writes base_west.yml and base_MAINTAINERS.yml from FETCH_HEAD^1 and
passes them via the new --base-manifest and --base-maintainer-file
options. Both options default to the checked-out files when omitted, so
local and manual invocations keep working.
Fixes#110422
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Now that we are building with multiple toolchains some failures will only
happen with one toolchain.
So, also print the toolchain used, so it is easier to identify the issue.
And update the twister blackbox tests reference data.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Before this patch, when a script is not found, `twister_harness.log` would
not be created.
This would result in the error reporting in runner.py to refer users to
the build.log; and if `--inline-logs` was used, it would inline the
build.log in the console output which was just a lot of confusing noise
for users.
Instead let's create twister_harness.log logging a "not found" error.
So we both refer users to it in the console output, and if we inline
anything we inline that.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
add --test-config tests/test_config_ci.yaml when executing twister
during generation of test plan, so we can get the coverage based on the
configuration.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Twister picks exactly one toolchain per platform, so a board that is
buildable with several toolchains only ever gets coverage for one of
them. The only way to build a test more than once was the test scenario
level integration_toolchains option, which cannot express "build
everything on this platform with both GCC and Clang".
Add a build_toolchains option listing the toolchains every test assigned
to a platform should be built with. Twister then creates one test
instance per toolchain, each in its own build directory. The option can
be set in the board configuration, or per platform in the twister
configuration file, which lets multi-toolchain coverage be enabled for
CI only while local runs keep building each test once. An empty list in
the twister configuration disables it for a platform that requests it.
The toolchain resolution chain moves into get_toolchains(), keeping the
existing precedence, with build_toolchains taking effect just below a
scenario's integration_toolchains.
Toolchain is also added to the platform_key deduplication key. That key
deduplicates platforms, not toolchains, and without this every extra
toolchain of a scenario using platform_key is discarded as already
covered.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
For `script` type harnesses, when `--inline_logs` is used,
the output of all the scripts which are part of the test are printed
to console first (both passed and failed ones).
And then again the failed ones.
This is quite undesirable, as it fills the console with unnecessary
logs, which makes it more difficult and slow to find the problem.
Instead, for the script harness, let's print only the failed ones.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
The pytest harness now is a child of the script harness.
And all script harnesses use twister_harness.log for their
output.
Let's correct the variable name to not confuse readers.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Add a test to check that putting common
cpu props in the parent cpus node works.
Assisted-by: GitHub Copilot:GPT-5.3-Codex
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
This allows to put common props of
cpu nodes in the parent cpus node, as
specified in the devicetree spec in 3.8.
Assisted-by: GitHub Copilot:GPT-5.3-Codex
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Add the first concrete sidecar. It shares a host directory with the
guest over virtiofs: tests run on QEMU with a vhost-user-fs-pci device,
which needs a virtiofsd daemon on a per-build-dir UNIX socket that QEMU
connects to before it boots. The sidecar starts virtiofsd in setup()
(seeding a private writable copy of the shared directory) and stops it
in teardown(), skipping the run cleanly if virtiofsd is not installed.
The runner injects the dynamic -chardev socket path via
QEMU_EXTRA_FLAGS.
Configured through the virtiofs_shared / virtiofsd_bin /
virtiofs_extra_args harness_config keys. Adds unit tests.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Some QEMU tests need a host-side process running for the guest to talk to
(a virtiofsd daemon, an ivshmem reader, a network tap). Model this as a
first-class "sidecar": a testsuite field orthogonal to the harness, so a
test keeps its normal harness (ztest, console, ...) and just declares a
sidecar, and twister may also attach one itself.
This commit adds only the plumbing and the base concept:
- A Sidecar base class with configure()/setup()/teardown() and a
SidecarImporter registry (empty here; concrete sidecars register in
later commits), in twisterlib/sidecar.py.
- The `sidecar:` testsuite field (config_parser, TestSuite) and the
per-instance sidecar/dtc_overlay attributes (TestInstance).
- The runner wraps handler.handle() with the sidecar's setup/teardown and
skips the run cleanly if setup() reports the host side is unavailable.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
"device_type" is a yaml property that needs to use an underscore
rather than a dash. This is a special case to maintain compatibility
with legacy FCode devicetrees and should not be flagged.
Signed-off-by: Omar Naffaa <onaffaa@qti.qualcomm.com>
The previous function name was a bit misleading, as the actual work it
does it using "git reset", not "git checkout".
Signed-off-by: Reto Schneider <code@reto-schneider.ch>
Add translation of DEPENDENCY_OF, CONTAINED_BY, DESCRIBED_BY,
and PREREQUISITE_FOR to SDPX3 relationships. Fix HAS_PREREQUISITE
to be mapped as hasPrerequisite relationship.
Signed-off-by: David Nepožitek <david@nepozitek.cz>
- Add XSDB subsection to Flash & Debug Host Tools (Vitis/PATH, not SDK)
- Raise a clear MissingProgram message when xsdb is absent
- Patch require() in the remaining unit tests so CI does not need xsdb
installed
Signed-off-by: Appana Durga Kedareswara rao <appana.durga.kedareswara.rao@amd.com>
Enable native XSDB interactive debugging using board-specific xsdb.cfg
files for automatic target selection and platform initialization.
- Add do_debug_native() for interactive debugging
- Auto-detect board config from support/xsdb.cfg
- Prevent auto-execution to enable breakpoint debugging
- Add --hw-server for remote board support
- Display XSDB command reference on startup
Splitting do_run() into do_flash()/do_debug_native() adds an explicit
self.require('xsdb') check on the flash path, which do_run() did not
have before.
The generated debug parameter file reuses the same ordered key/value
"boot_arg" list as flashing, so a native debug session loads the
identical set of boot artifacts, in the same board-defined order, as
a flash.
Boards with multi-stage bring-up (e.g. zynqmp_apu/zynqmp_rpu running
FSBL or PMUFW before the final application load) call "con" one or
more times before the load that should stay paused for breakpoints.
Only the LAST standalone "con" and "exit" in the board cfg are
neutralized, so earlier bring-up stages still run to completion.
Signed-off-by: Appana Durga Kedareswara rao <appana.durga.kedareswara.rao@amd.com>
Board xsdb.cfg/xsdb_cfg.tcl scripts previously read their boot
artifacts (bitstream, FSBL, PDI, bl31, system.dtb, PMU firmware) as
positional arguments. That only works if every artifact lands in
exactly the position each board's load_image proc expects, which
breaks down as soon as two boards disagree on the set or order of
artifacts they take (e.g. PDI-based Versal boots vs. bitstream+FSBL
ZynqMP/Kria boots), and gives boards no way to validate what they
were actually given.
Give each board a small shared parse_args helper
(boards/amd/common/xsdb_parse_args.tcl, sourced by every board's
xsdb.cfg/xsdb_cfg.tcl instead of duplicating it 11 times) that turns
argv into an associative array from explicit "key value" pairs,
validating required/optional/unknown keys with a clear Tcl-level
error. The west runner builds that flat key/value list instead of a
positional one; order no longer matters, and each board only has to
declare the keys it understands. Every artifact keeps the exact
required/optional status it had before this change: bl31 stays
required on versal_apu/versal2_apu/versalnet_apu (previously loaded
unconditionally, no presence check), and bitstream/FSBL/bl31/PMUFW
stay optional wherever they were guarded by a "string length" check
(zynqmp_apu, zynqmp_rpu, kv260_r5).
Also add a generic, repeatable "--param NAME VALUE" option for
anything not covered by the existing --bitstream/--fsbl/--pdi/--bl31/
--system-dtb/--pmufw options -- e.g. "--param pl_pdi <path>" to
program a PL PDI (FPGA fabric) on boards whose xsdb.cfg declares a
"pl_pdi" parameter. Repeated --param calls sharing a NAME are merged
into one space-joined Tcl list value, since Tcl's "array set" would
otherwise keep only the last value for a duplicate key; this lets
partial-reconfiguration designs load any number of PL PDIs, in order,
without the runner needing to know about that use case specifically.
Signed-off-by: Appana Durga Kedareswara rao <appana.durga.kedareswara.rao@amd.com>
TEST_CASES repeated every field as an explicit None in every case even
when unused, which is not needed: dict.get() already returns None for
an absent key. Each case now only lists the keys it overrides, and the
two runner-construction tests read the rest via tc.get(key). No
behavior change.
Signed-off-by: Appana Durga Kedareswara rao <appana.durga.kedareswara.rao@amd.com>
ManifestStrategy.analyze() returned set(manifest_files) - the set of
consumed filenames - as the calls list when west.yml changed but no
project revision differed (e.g. an unrelated field or formatting
edit). TestPlanOrchestrator.run() iterates calls and accesses
call.full_run, so a plain filename string raised:
AttributeError: 'str' object has no attribute 'full_run'
This affects any PR that touches west.yml without bumping a project
revision, independent of the actual manifest change. Return an empty
calls list instead, and add regression tests covering both the
no-revision-change and revision-change paths.
Assisted-by: Claude:claude-sonnet-5
Signed-off-by: Minyuan Xue <minyuan_xue@realsil.com.cn>
When no per-instance tracefiles exist, the merge stage built an lcov
command with just --output-file and no action option, which lcov rejects
with an opaque "capture report stage failed with 255".
Report the missing tracefiles instead.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit fixes bossac flashing for mapped-partition where
CONFIG_FLASH_LOAD_OFFSET is not available. Instead we rely on
flash_address_from_build_conf() and walk up the devicetree to
find the base address to subtract.
Assisted-by: Claude:claude-opus-4.8
Signed-off-by: Perry Naseck <pnaseck@media.mit.edu>
Move `phy-handle` to use the dependency-mode prop
key instead of the hardcoded code.
Because all ethernet drivers only need to use the
phy-handle in the iface init, we can ignore the
phy-handle dependency completly instead of only
ignoring it if the phy-handle pointing to a child
node of the ethernet node.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
add dependency-mode prop key, so it can be
changed what dependency a phandle
in the dt introduces. With this it can be set
in the dt binding that a phandle is f.e. ignored
when the dt ordinal is calculated.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Add a Coccinelle script that detects and removes redundant pointer casts
in z_vrfy_* functions, where a parameter is forwarded to z_impl_* with
an identical cast.
Signed-off-by: Flavio Ceolin <flavio@hubble.com>
There currently is no way to modify behaviour of twister during hw
features generation.
For example we run into an issue were we hit Out Of Memory errors on our
doc build instance, and wanted to modify --jobs. This adds an option
zephyr_twister_extra_flags to allow for supplying additional flags.
Signed-off-by: Antoni Duda <antoni.duda@nordicsemi.no>
This reverts commit 90555a1fe7.
This causing issues with CI due to missing colorlog module when PRs are
based on old state of main.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The 'Incorrect status assignment' reason was repeated across nine
pipeline stage handlers and 'runtime filter' twice; promote both to
module constants. report_out() also rebuilt four near-identical coloured
count sections inline; extract a _colored_count() helper. No behaviour
change; the colour output is verified byte-identical to the previous
formula.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
ExecutionCounter declared 22 shared counters, each with an identical
property getter, setter and _increment() method - roughly 300 lines of
copy-pasted lock handling. The duplication also hid a bug: the
notrun_cases setter locked and wrote the unrelated _notrun Value instead
of _notrun_cases, so assigning notrun_cases corrupted notrun and left
notrun_cases unchanged.
Introduce an AtomicCounter data descriptor that owns the locked get/set
and increment logic. Each counter is now a single class attribute, and
the <name>_increment(value=1) methods are synthesised on demand via
__getattr__, preserving the existing public API. This removes ~265 lines
and eliminates the setter bug class entirely.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
TestCase, TestSuite and TestInstance each defined a byte-identical
status property/setter validating assignments against TwisterStatus and
raising StatusAttributeError. Extract the shared logic into a StatusMixin
in statuses.py and have the three classes inherit it, dropping the now
unused Enum and StatusAttributeError imports.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Use colorlog's `ColoredFormatter` for Twister's console formatter in
both timestamped and non-timestamped modes to improve readability
without changing file log formatting.
Signed-off-by: Lukasz Fundakowski <lukasz.fundakowski@nordicsemi.no>
Currently the testsuite does not execute succesfully on Windows due to
various issues including path separator mismatch, shell command
incompatibility, and lack of proper symlink support. Fix these issues to
allow running the testsuite on Windows. Note that the compatibility
and symlink tests are skipped due to basic incompatibility.
Signed-off-by: Graham Roff <grahamr@qti.qualcomm.com>
(cherry picked from kconfiglib commit b8535af53f0650a69e52db4bf8585c09d55852e7)
Extend the "depends on" syntax to support conditional dependencies
using "depends on A if B". While functionally equivalent to "depends
on !B || A", "depends on A if B" is much more readable.
This change is implemented by converting the "A if B" syntax into the
"!B || A" syntax during "depends on" token processing.
Signed-off-by: Graham Roff <grahamr@qti.qualcomm.com>
(cherry picked from kconfiglib commit d13e125024ec1c8e573aacd463765d028515503e)
A follow-up to b96a5ad562deffa697d966c29546650aae645f48 where we stopped
having CI run tests on Python 2.x. This actually drops the few remaining
Python 2.x compatibility bits as Python 2.x has EOL'd a long time ago.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
(cherry picked from kconfiglib commit 24aef157aead07f813f874f43ee471b057e622cb)
Signed-off-by: Graham Roff <grahamr@qti.qualcomm.com>
A Doxygen group with no parent becomes a top-level entry of the API
index, which is meant to hold only a handful of broad categories. Add a
check comparing the top-level set against an allowlist, failing both on
new entries and on allowlisted groups that are no longer top-level.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-4.8