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
In the case the required file is locate in the root directory of the
application, the parent directory is named "app.dir". So, it does not match
with the existing rule.
Add a second pass to check if the object file can be found in "app.dir".
Note this bug has not been found earlier because the application source are
usually placed in "src/" subdirectory.
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
requests < 2.33.0 is subject to GHSA-gc5v-m9x4-r6x2
gitpython < 3.1.47 is subject to GHSA-rpm5-65cw-6hj4
gitpython < 3.1.47 is subject to GHSA-x2qx-6953-8485
gitpython < 3.1.48 is subject to GHSA-7545-fcxq-7j24
gitpython < 3.1.49 is subject to GHSA-v87r-6q3f-2j67
gitpython < 3.1.50 is subject to GHSA-mv93-w799-cj2w
Pillow < 12.1.1 is subject to GHSA-cfh3-3jmp-rvhc
Pillow < 12.2.0 is subject to GHSA-pwv6-vv43-88gr
Pillow < 12.2.0 is subject to GHSA-r73j-pqj5-w3x7
Pillow < 12.2.0 is subject to GHSA-whj4-6x5x-4v2j
Pillow < 12.2.0 is subject to GHSA-wjx4-4jcj-g98j
protobuf < 5.29.6 is subject to GHSA-7gcm-g887-7qv7
pytest < 9.0.3 is subject to GHSA-6w46-j5rx-g56g
python-dotenv < 1.2.2 is subject to GHSA-mf9w-mj56-hr94
pytest and python-dotenv had no minimum version, which OSV-based
scanners treat as being subject to every advisory for the package.
Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Emit a warning trace message when a DT property is required but
also provides a default value.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
The partition MTD path is required to correctly check if two partitions
overlap with each other.
Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
Twister resolves filesystem paths from test YAML through
os.path.expandvars(), which only substitutes process environment
variables. The most useful pointer to a module's root,
ZEPHYR_<MODULE>_MODULE_DIR, is a CMake build-system variable and is
not available at test-discovery time.
Add a helper that expands ZEPHYR_<MODULE>_MODULE_DIR and
ZEPHYR_<MODULE>_MODULE_NAME, mirroring the CMake variables defined for
every module, with the name sanitized and upper-cased exactly as the
build system does. Apply it when resolving required_applications and
required_devices paths and pytest_root, so the same spelling works in
both CMake and Twister contexts.
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
Each SPDX 3.0 document re-serialized every element it referenced, so
packages and files defined in one document were duplicated in full into
every other document that mentioned them.
Declare such cross-document references with an ExternalMap import
instead of copying their definitions and effectively do something
similar to what the SPDX 2 serializer did.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Add scripts/gen_test_matrix_dashboard.py, a standalone tool that turns a
Twister per-test coverage matrix (test_matrix.json) into a self-contained,
interactive HTML dashboard. It has no dependency on Twister and can be run
on any previously generated matrix.
The dashboard shows, per test, how many files and lines it covers
alongside how many lines it covers uniquely -- lines no other test
reaches -- with sortable columns so redundant tests (zero unique) and
load-bearing tests stand out. Selecting a test lists the files it covers
with per-file line and unique-line counts, and a file lookup shows which
tests cover each line, highlighting uniquely-covered lines. All derived
metrics are computed in the browser from the matrix inlined into the page.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add a --coverage-per-test mode that collects an isolated coverage
artifact for every Ztest test case and post-processes them into a
test-to-code coverage matrix, answering "which tests covered line X of
file foo.c".
The mode builds on CONFIG_ZTEST_COVERAGE_PER_TEST. On platforms that
support semihosting (ARM/RISC-V/Xtensa under QEMU, e.g. mps2/*) the
transport is switched to semihosting so per-test data is written straight
to the host as "<gcda>@@<suite>.<test>", avoiding the large amount of
serial traffic per-test dumping would otherwise generate; other platforms
fall back to the console transport. The required Kconfig is injected into
the build overlay.
Each test is captured by invoking gcov directly -- one
"gcov --stdout --json-format" per test over its gcda set, materialized in
a temporary object tree with symlinks to the shared gcno -- and its JSON
is converted to an lcov tracefile. This is far cheaper than a full lcov
capture per test; lcov capture remains a fallback for non-GCC toolchains.
To keep the end-of-run aggregation proportional to the number of
instances rather than the number of tests, each instance's per-test
tracefiles are collapsed into a single untagged union, and the aggregate
matrix is built by merging the per-instance matrices. Function records
are omitted from the tracefiles because gcov reports per-function counts
and end lines inconsistently across per-test dumps, which would fail
lcov's merge consistency checks; line and branch coverage are unaffected.
Per-test mode requires the lcov coverage tool (the matrix relies on lcov
TN records; gcovr has no equivalent) and this is validated at
argument-parsing time. Output is one <scenario>.<test>.info per test
under each build's coverage/tests/ directory plus a test_matrix.json with
by_line ({file:{line:[tests]}}) and by_test views.
Covered by unit tests for the tracefile conversion, tracefile union,
matrix build and merge, and the tagged-dump discovery and parsing
helpers.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
With --coverage-per-instance, run_coverage_instance() generates a
coverage report for every test instance, and each generate() call
emitted an info-level '<FORMAT> report generated: ...' line. On a run
with many instances this floods the console with one line per instance.
Log the per-instance report messages at debug level and keep only the
final aggregated report at info level, so the console stays readable
while the detail is still available with -vv.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
When --gcov-tool was not given, coverage relied on ZEPHYR_SDK_INSTALL_DIR
being exported and then hardcoded the x86_64-zephyr-elf gcov path. That
fails when the variable is not in the environment (even though the build
itself resolves the SDK via CMake), and the hardcoded architecture is
wrong for non-x86 targets.
Each Zephyr build already records the resolved gcov binary as CMAKE_GCOV
in its CMakeCache.txt, which for the Zephyr SDK points at the SDK's cross
gcov matching the toolchain. Read it back and use it so the gcov tool is
detected automatically without any environment setup and matches the
gcno/gcda data for any target architecture.
Keep ZEPHYR_SDK_INSTALL_DIR as a fallback, sourced from the environment
or, failing that, from a build's CMakeCache.txt, before erroring out.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
choose_gcov_tool() called .endswith() directly on the result of
os.environ.get("ZEPHYR_TOOLCHAIN_VARIANT"). When the variable is not
exported in the environment, get() returns None and the coverage run
aborts with:
AttributeError: 'NoneType' object has no attribute 'endswith'
Provide an empty-string default so an unset variant safely falls
through to the system gcov / Zephyr SDK gcov branches instead of
crashing.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Some simulators resolve their executable at CMake configure time via
find_program() instead of being known during test planning, and the
binary that gets used can depend on the build configuration. Arm FVP is
the motivating case: Corstone-300 selects a different model depending on
the Ethos-U NPU, so armfvp cannot be listed in SUPPORTED_SIMS_WITH_EXEC
and checked up front. As a result, when the FVP binary was not installed
Twister still considered the test runnable, attempted to run nothing, and
reported a misleading status.
Inspect CMakeCache after the build instead: add a SIM_PROGRAM_CMAKE_VARS
mapping of simulator name to the cache variable recording its resolved
executable. When the variable is absent or holds a *-NOTFOUND value
(e.g. ARMFVP:FILEPATH=ARMFVP-NOTFOUND), mark the instance as NOTRUN with
a clear reason and propagate that status to its test cases, so the test
is no longer reported as runnable.
This check is done in the post_build stage, which now always runs after a
successful build; the --post-build-checks option only gates the optional
build-failing checks, which are skipped inside post_build when it is not
set. This keeps the not-run determination separate from gather_metrics,
where it did not belong.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Compiler-reported paths may contain "." or "..", causing the same header
to be treated as multiple files. This substantially increases ownership,
license, hash, and relationship processing during --analyze-includes.
Normalize paths before deduplication. In a test build pulling in LVGL,
this reduced the include set from 50,000+ entries to ~1,200.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
domains.py is imported during west command discovery, before the
missing dependencies are installed. Since jsonschema is not a west
dependency, this broke `west update`. Wrap the import in a try-except
and only fail when a domains.yaml is actually parsed.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Look for xsdb_cfg.tcl before xsdb.cfg under boards/<board>/support/
so new boards can use a .tcl extension for correct syntax highlighting
while existing xsdb.cfg scripts keep working unchanged.
Signed-off-by: Appana Durga Kedareswara rao <appana.durga.kedareswara.rao@amd.com>
The ZynqMP APU boot flow needs bitstream, FSBL, BL31, and PMU firmware
in addition to the application ELF. Add a --pmufw CLI option to pass the
PMU firmware ELF path to the board xsdb.cfg script.
Replace the growing if/elif dispatch logic in do_run() with ordered
appending of non-None optional arguments (bitstream, fsbl, pdi, bl31,
system-dtb, pmufw). Each board TCL script continues to interpret argv
according to its own boot flow.
Extend the unit tests to cover the ZynqMP APU argument combination.
Signed-off-by: Appana Durga Kedareswara rao <appana.durga.kedareswara.rao@amd.com>
Extend the `SEMIHOST` data dump function with support for multiple dumps
per application run, such as when the test application is intentionally
testing reboot paths.
Instead of the final `filename.gcda` file being overwritten on each
boot, create a unique `filename.gcda.{X}` file per boot, which are then
merged back into `filename.gcda` by `coverage.py`. The merging step is
required as the coverage tools expect specific paths for the GCDA files
derived from the source filename, they are not searching through the
folders for any filenames containing 'gcda'.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Collect the deferred area's label when a file is matched by both a
deferred file-group and a non-deferred area. The deferral removed the
area before labels were gathered, so its area label was silently lost
even though its maintainer stayed on as a reviewer.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Fixes this missing output, which helps with repducible build
debugging, to use the zephyr prefix when the bindings are located
there irrespective of if the (long deprecated) environmental value
is set
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Replace the regex-based CMakeStyle check with one that runs
scripts/cmake/cmake_style.py on changed CMake files and reports the style
issues on the touched lines.
Create a common parent class for Kconfig and CMake style checks.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Assisted-by: Claude Code:claude-opus-4.8
Add scripts/cmake/cmake_style.py, a tree-sitter based checker for the CMake
style guidelines: line length, indentation, lowercase commands, no space
before '(', cache-variable casing and unquoted booleans.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Assisted-by: Claude Code:claude-opus-4.8
junitparser merge cant deal with the large number of files and sizes in
the weekly build. Introduce this helper script to merge 200 files into
one in a more efficient way.
Assisted-by: Claude:claude-opus-4.8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add a TestMetadataFilename compliance check that fails when a change
introduces a new sample or test metadata file named sample.yaml or
testcase.yaml. Sample and test metadata are now stored in a single,
consistently named tests.yaml file across the tree, and this check
keeps the legacy names from creeping back in via new PRs. The failure
message tells the contributor to rename the file to tests.yaml.
Only newly added files (diff-filter=A) are inspected, so the check does
not flag pre-existing files and does not require a tree-wide cleanup to
pass.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Support using a different toolchain for a specific platform.
A platform can now set preferred_toolchain in the yaml file and this
toolchain will be used instead of the the default. This allows us to
test multiple toolchains and have some platforms build using the
preferred toolchain in CI. This applies only when running twister,
everything behaves as usual when building with west.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add support for the common `--dev-id` runner option to the minichlink
runner. The value is passed to minichlink with its `-c` option so boards
can select a specific serial port or USB VID/PID from board_runner_args().
This allows board.cmake to set a default probe identifier, for example:
board_runner_args(minichlink "--dev-id=0x1209b803")
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Clean up Twister OpenOCD runner by removing
deprecated cmsis_dap_serial argument and
replacing with adapter serial
Signed-off-by: Shankar Ramasamy <shankar.ramasamy@microchip.com>
Processing the raw coverage data into the output `html` can take a
significant amount of time. Add a display for the duration, similar to
the timers for building the testsuite list and test build/execute times.
Example output:
```
INFO - Built testsuite list in 0.04 seconds
...
INFO - 16 of 16 executed test configurations passed (100.00%), 0 \
built (not run), 0 failed, 0 errored, with no warnings in \
25.85 seconds.
...
INFO - Coverage data processed in 11.45 seconds
```
Signed-off-by: Jordan Yates <jordan@embeint.com>
Fixing missing support for --soc, --soc-family and --soc-series
arguments, which previously would just return all SoCs irrespective
of what was wanted
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Use suite id instead of name as the key in the testsuites
registry. With --detailed-test-id enabled, the suite name
includes the path, which caused a false duplicate error when a
required application was passed via -T on the command line and
was also listed in the required_application section of another
test.
Duplicated scenarios are reported as an error regardless of
whether --detailed-test-id is used.
Update the twister unit tests.
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
Enrich the Build profile with per-target compile flags and defines and
the key build inputs (board, arch, toolchain), mirroring the
Build-profile output of projects such as the Linux kernel.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>