Upgrades the thread user_options to 16 bits from an 8-bit value to
provide more space for future values.
Also, as the size of this field has changed, the values for the
existing architecture specific thread options have also shifted
from the upper end of the old 8-bit field, to the upper end of
the new 16-bit field.
Fixes#101034
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
Convert the DUT class from a traditional class to a dataclass to enable
proper serialization and support for future multi-device testing with
pytest-harness.
Key changes:
- Migrated DUT class to use `dataclass` decorator with proper type hints
- Renamed `baud` property to `serial_baud` for consistency
- Updated hardware map schema to support both `baud` (legacy) and
`serial_baud` fields for backward compatibility
- Updated tests
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
TwisterEnv already parses west modules during initialization, but TestPlan
was parsing them again via zephyr_module.parse_modules(), duplicating work.
Store the parsed module objects on TwisterEnv (self.modules) and have
TestPlan derive its module name list from env.modules instead. This drops
the redundant parse in TestPlan by removing handle_modules() and its call
site.
Each call to parse_modules() takes around 250-300ms on my end.
Update twister unit tests
Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
Use a single os.scandir() pass per board directory to load twister.yaml
and collect legacy *.yaml files, replacing Path checks and globbing.
On my end this reduces execution time by ~50ms on Ubuntu 24.04 and
eliminates ~80k Python function calls.
Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
The post-script was being called multiple times and during the
initialization phase when it should only run after the reader
thread has started and the device testing is complete.
Fixes#102386
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
When sysbuild is enabled globally and running west build with a
selected test scenario, the sysbuild setting was being overwritten
with False when sysbuild was not explicitly set in the test YAML file.
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
This fixes the issue where --list-tests and --test-tree commands
showed duplicated testsuite IDs in the output,
simplifies testcase name handling in harness and runner modules.
Removed feature to extend behaviour of --no-detailed-test-id to shorten
test case names - feature was introduced in #82302.
This makes the twister output more predictable and the codebase easier
to maintain.
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
Seemingly partitions (fixed-partitions) have no properties when
the edt file is loaded, work around this issue by outputting
compatibles for nodes that have them but have no properties, also
fixes some other outputs for misc. devices
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Adds a new property which outputs the absolute address of a dts
device (if it is available) which will take the parent nodes into
consideration without a user having to manually trawl through
devices (which is error prone depending upon how they are layered)
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This is to start the process of fixing the issue of the SoC series
not matching the value in the soc.yml file, which is needed to
support future build system features for automatically creating
SoC Kconfigs by the build system.
This also fixes some oddities with how the Kconfigs were set out,
which included duplicated Kconfigs and duplicate selections and
having them in the wrong (or differing) files, to actually follow
how HWMv2 should define these Kconfigs.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Specific fixes include:
- Add missing space after period in the disk space warning.
- Fix mismatched quotes in the --install-base example (usage of `...').
- Removed a typo double quote in the installation description.
This addresses the CLI help message issues reported.
Fixes#95609
Signed-off-by: Malon Tian <a3205153416@gmail.com>
Add tests to ensure 'west build' arguments are correctly forwarded to
CMake in the correct order.
Signed-off-by: Thorsten Klein <thorsten.klein@bshg.com>
Support cmake options specified via argument --cmake-opt, in order to
avoid `--` in alias commands.
Signed-off-by: Thorsten Klein <thorsten.klein@bshg.com>
The has_arg_concat check checks for ## and UTIL_CAT, but is missing
the CONCAT macro. This is causing spurious occurances of
MACRO_WITH_FLOW_CONTROL warnings for functions defined with macros
if they use the CONCAT() macro (its like UTIL_CAT but supports up
to 10 concatenations).
Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Section names may contain paths to files with special characters.
For example, a valid file path might contain '@'. Then using
CONFIG_CODE_DATA_RELOCATION to relocate section, macro
__in_section_unique() will generate section name like this:
KEEP(*file.c.obj(.noinit.WEST_TOPDIR/path_with@char/file.c.0))
Such section names cannot be processed by ld because '@'
is a special character for ld.
This fix wraps section names in double quotes to escape
special characters for ld.
Signed-off-by: Nikita Divakov <grommerin@gmail.com>
Add _openocd_cmd() helper method to reduce code duplication when
building openocd command lists. Consolidate do_flash, do_flash_elf,
and do_flash_bin into a single do_flash method using match statement
on image_type parameter.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Add --use-bin and --flash-address arguments to allow flashing BIN
files at a specific address. This is needed for targets like ESP32
where HEX files contain virtual addresses (due to MMU mapping)
rather than physical flash addresses.
The new do_flash_bin() method uses the load command with the BIN
file path and flash address, similar to how ELF flashing works.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Add support for boards to specify flash_before in their board YAML files,
which is then used by pytest and shell harnesses. This is needed for
Synopsys ARC development boards (hsdk, hsdk/arc_hsdk/2cores, hsdk4xd
and iotdk) where the USB serial port disconnects during flashing.
Signed-off-by: Mohamed Moawad <moawad@synopsys.com>
Align with native_simulator's upstream main
215ee859eee5e49dc09eda8f17a956ee7318caf2
Which includes:
215ee85: native timer_model: Fix printf format specifier warnings w
debug logs
Signed-off-by: Nakul Chauhan <nakulchauhan111@gmail.com>
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Preemptable and preemptible are both commonly used spellings. Infineon
had chosen preemptable as the spelling and lead to CI failures when
using struct members in the PDL. Removing the check in Zephyr allows
for flexibility in spellings of this word.
Signed-off-by: Tom Burdick <thomas.burdick@infineon.com>
Hardware map file generation should at least get you part way now with
Infineon boards with the Cypress derived KitProg3.
Signed-off-by: Tom Burdick <thomas.burdick@infineon.com>
When support for old "Library model" was removed, support for the new
Secure Function (SFN) model - the FF-M 1.1 spec that succeded the "Library
model" - wasn't implemented. This patch adds it.
Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
The extra_conf_files arg in testcase.yaml was being improperly
assigned to the CONF_FILE CMake arg, which caused
configuration_files.cmake to ignore soc and board Kconfig overlays.
Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
When initially introduced, the property was kept optional in an attempt
to not risk disrupting downstream users by introducing a required property
they wouldn't necessarily care about. In practice, this is causing
boards contributed upstream to sometimes miss this propery which is
important for boards to show up nicely in the boards catalog, and it is
therefore being made required.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
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>