Make Domain's class constructor accept python object to avoid redundant
YAML serialize and unserialize which may introduce potential yaml type
errors.
Signed-off-by: Yves Wang <zhengjia.wang@nxp.com>
When output from ruff check subprocess is not in JSON format
compliance script raises an exception without any useful information
about the error. This commit improves that by printing output from
subprocess in case of error.
Signed-off-by: Lukasz Fundakowski <lukasz.fundakowski@nordicsemi.no>
use the allow-list generated by --keep-artifacts whenever
cleanup_artifacts() is called. This resolves an issue where this allow-list
was not being honored when using the --prep-artifacts-for-testing flag.
Signed-off-by: Mike Szczys <mike@golioth.io>
Reduce the test time by ~300 seconds by mocking the listed serial port
Result from running:
pytest --durations=0 ./scripts/tests/twister/test_handlers.py
Before:
60.12s test_devicehandler_handle[valid pty]
60.12s test_devicehandler_handle[communicate timeout]
60.06s test_devicehandler_handle[popen called process error]
60.05s test_devicehandler_handle[valid dev]
60.03s test_devicehandler_handle[nonzero returncode]
0.01s test_devicehandler_handle[create serial failure]
After:
0.01s test_devicehandler_handle[valid dev]
0.01s test_devicehandler_handle[valid pty]
0.01s test_devicehandler_handle[nonzero returncode]
0.01s test_devicehandler_handle[create serial failure]
0.01s test_devicehandler_handle[communicate timeout]
0.01s test_devicehandler_handle[popen called process error]
Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
Add a trailing space to the Ruff error message string in the compliance
checking script. Previously, the error message concatenated the URL and
the description with a colon (e.g., ".../unsorted-imports:Import").
This caused the terminal to interpret the description as part of the URL,
resulting in a 404 error when clicked.
Signed-off-by: Thamaraimanalan M <devthamaraimanalan.m@gmail.com>
Now that the west_commands directory has a pyproject.toml configuration
file, it should consider local packages for first party imports.
Make sure the top-level ruff config is extended, and fix some import
sorting.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
KeepSorted can fail on Windows when the active code page is
not UTF-8 (e.g. GBK), because text files in the Zephyr tree
are UTF-8. Detect file type via libmagic and only process
text/* files, avoiding attempts to decode binary content.
Open text files via GIT_TOP / <path> with encoding="utf-8"
(and errors="surrogateescape") to prevent UnicodeDecodeError
during local compliance runs without changing the KeepSorted
sorting rules.
Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
Updated unit tests from pytest-twister-harness
with wupport of multiple connextions.
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
Add support for multiple connections (e.g. UART) from one device,
enabling communication with second core UARTs. Feature implemented
by extracting connection logic from DeviceAdapter to new
DeviceConnection class with specialized implementations:
- SerialConnection for hardware UART ports
- ProcessConnection for native simulation
- FifoConnection for QEMU communication
Each connection maintains separate log files (handler.log,
handler_1.log, etc.) and can be accessed via connection_index
parameter in device methods like readline() and write().
This enables testing multi-core applications where different
cores communicate through separate UART interfaces.
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
On non-Windows systems execute a new program, replacing the west packages
call, when trying to install packages using pip.
For Windows, update the documented way of installing python packages,
or using 'west packages pip --install' print a warning.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
The combination of pytest's `-s` (--capture=no) option and
`--log-cli-level=DEBUG` was causing duplicate log output.
Fixed by replacing `--log-cli-level=DEBUG` with `--log-level=DEBUG`.
`--log-cli-format` removed as is not used.
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
When using --only-failed with required applications, twister could enter
an infinite loop during application dependency resolution.
Fixes#100808
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
Allow making the zephyr-keep-sorted check ignore cases, for example:
// zephyr-keep-sorted-start ignorecase
....
// zephyr-keep-sorted-stop
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Refresh pinned dependencies to pick filelock 3.20.1 version since 3.20.0
is subject to CVE-2025-68146.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
when in batch mode, we do not need manually 'go'.
with this, we can use `west debug` in twister run test
enable for jlink and linkserver which is tested
example:
west debug --runner jlink -- --batch
Signed-off-by: Hake Huang <hake.huang@nxp.com>
dts-linter 0.3.7-hotfix2 Security Updates:
- Update `glob` to address CVE-2025-64756
- Update `js-yaml` to address CVE-2025-64718
Formatting updates:
- Ensure that properties have 2 new lines when node is above it.
- Enures that 1 new line is required between a node and #if/#ifdef...
- Enures that 2 new line are required between #endif and node.
- Wraps property values that exceed 100 characters in length.
Signed-off-by: Kyle Bonnici <kylebonnici@hotmail.com>
Skips updating files if the output already matches the file
contents, this prevents a random occurance whereby sysbuild
reconfigures itself after a reconfiguration for no known
discernable reason
Signed-off-by: Jamie McCrae <spam@helper3000.net>
A device with zephyr,deferred-init is initialized by the application, so
we cannot check if it is initialized in "the correct order". On the other
hand, a non-deferred device must not depend on a deferred-init device: this
is guaranteed to be initialized out of order.
Also adjust existing test cases and add a new test case to validate this
behavior.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
There is a bit of logic to run every time an error is reported. Factor it
out into a dedicated function.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
This fixes ruff warnings on coredump parser scripts.
Note SIM115 is not fixed yet as it requires more intrusive
changes to handle opened file with context manager.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This fixes ruff warnings on top level coredump scripts.
This is done via "ruff check --fix" without manual editing.
Note SIM115 is not fixed yet as it requires more intrusive
changes to handle opened file with context manager.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This disables the duplicate code warnings on x86 and x86_64
gdbstubs. The exception vector tables may look the same now but
can deviate depending on supported features on architecture.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This ensures, we pick a `urllib` version >2.6.0.
See:
- CVE-2025-66418 High severity
- CVE-2025-66471 High severity
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Fix for 1d70b70. Original code used start_time (set before flashing)
to calculate serial port wait timeout, which caused wait loop
to include flash duration, leading to exceed overall timeout.
Added serial_wait_start timestamp for avoid
including flash time in serial port enumeration timeout.
Make timeout dynamic (20% of flash_timeout, minimum 10s).
Signed-off-by: Mateusz Junkier <mateusz.junkier@intel.com>
Display the total run duration to two decimal points instead of ~14,
similar to the other displayed timestamps.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Display how long it takes to build the testplan in the logs. This can
be useful since the duration to bulid the plan can vary wildly depending
on the arguments given. Without this information, it is difficult to
tell (from CI logs) whether a long execution time is from actually
building and running the tests, or just generating the testplan.
For example, in a downstream repo:
```
./zephyr/scripts/twister --integration -iv -T . --dry-run
INFO - Building initial testsuite list...
INFO - Built testsuite list in 10.58 seconds
```
vs
```
./zephyr/scripts/twister --integration -iv -T . --dry-run \
--vendor nordic --vendor zephyr
INFO - Building initial testsuite list...
INFO - Built testsuite list in 201.01 seconds
```
Signed-off-by: Jordan Yates <jordan@embeint.com>
During the actual development process, it was discovered that the
controller/device' would describe the bus type in the binding. However,
when the two sides did not match, the generated process would not be
affected and there were no any prompts. This made it very difficult for
developers to identify the problem.
I've updated the implementation to:
1. Add a `warn_bus_mismatch` kwarg to `edtlib.EDT()` constructor
(default: False)
2. Add a `--warn-bus-mismatch` flag to gen_edt.py
3. Only show the warning when explicitly opted in
4. Add some checks in the edtlib. When the bus type of the node
does not match the binding requirements, provide some auxiliary
judgment information:
a. bus position of the node
b. available binding types
c. expected binding type.
Signed-off-by: Lucien Zhao <lucien.zhao@nxp.com>
Stores data to output in a temporary buffer and only outputs data
to a file if the data is different to the file's existing data
(assuming it exists). This prevents a random occurance whereby
sysbuild reconfigures itself after a reconfiguration for no known
discernable reason
Signed-off-by: Jamie McCrae <spam@helper3000.net>
Fix checkpatch not warning when blank line after declaration
is removed. Updated regexes to also handle context lines,
ensuring consistent detection.
Fixes: #98976
Signed-off-by: Vignesh Pandian <vignesh@aerlync.com>
Add edac driver for NXP's ERM and EIM peripherals. It can inject ECC
error to specific channel within EIM and then report the error address,
syndrome and count within ERM.
Signed-off-by: Yves Wang <zhengjia.wang@nxp.com>
Now that the STM32CubeProgrammer runner supports the standard `--dev-id`
argument, replace usage of `--tool-opt` in the Twister device handler code.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Now that the STM32CubeProgrammer runner supports the standard `--dev-id`
argument, replace usage of `--tool-opt` in the pytest harness hardware
adapter.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Add support for the standard `--dev-id` argument used to select
target ST-Link debug probe based on serial number. Note that this
could already be achieved using custom argument `--conn-modifiers`.
(`--dev-id <XXX>` is equivalent to `--conn-modifiers sn=<XXX>`)
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Silence CI warning caused by line "from . import ZEPHYR_BASE". This is a
legitimate pattern, but pylint seems unable to deduce so. Many other
scripts perform a similar silencing.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Do not generate a compliance error when referring to generated Kconfig
symbols from Devicetree.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Adds a missing f in the second line of a multiline f-string.
Previously, having the wrong top-level keys in a DTS binding YAML file
could cause a partially unformatted error message to be printed.
Signed-off-by: Anton Puppe <anton-noel-flynn.puppe@zeiss.com>
on-behalf-of: @ZEISS anton-noel-flynn.puppe@zeiss.com
In addition to Zephyr's default build artifacts, other build processes
may generate additional images. Therefore, we have added the
`--flash-file` parameter to flash these supplementary images
Signed-off-by: Haoran Jiang <halfsweet@halfsweet.cn>
New nrfx release contains major rework of nrfx drivers
instantiation making it easier to integrate with dts nodes.
Now, nrfx driver instances can no longer be `const`
because they contain driver runtime state.
Additionally, all nrfx drivers return `errno` error codes
instead of deprecated `nrfx_err_t`.
Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>