Commit graph

6,360 commits

Author SHA1 Message Date
Jordan Yates
325c354913 scripts: build: ruff compliance
Update scripts in the build folder to pass all enabled `ruff` checks.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-11-27 11:33:18 +01:00
Jordan Yates
b9a3f42d18 scripts: build: apply ruff format
Apply `ruff` formatting rules to all scripts in the build folder.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-11-27 11:33:18 +01:00
Mathieu Choplain
e784a030f2 scripts: runners: stlink_gdbserver: add support for --no-load
Add support for the --load/--no-load argument from the base runner class.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2025-11-26 12:15:53 -05:00
Mathieu Choplain
2240f10f16 scripts: runners: generalize --no-load argument
Move the existing "--no-load" argument from the OpenOCD and Intel Cyclone V
runners into an argument in the runners base class such that it can be used
by all runners. Also update the existing runners to work with the common
option instead of their own.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2025-11-26 12:15:53 -05:00
Anas Nashif
5f91f5fb38 doc: fix reference to kernel.h
Fix reference to kernel.h and add zephyr namespace where it was missing.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-11-26 12:11:27 -05:00
Jiafei Pan
0ec9360cf4 scripts: requirements: update pyocd version
Update pyocd version to be greater than or equal to 0.36.0 to fix
the potential hang issue when execute "west packages pip --install"

This PR is to fix the issue #99115.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2025-11-26 07:10:39 +00:00
Beleswar Prasad Padhi
7e6215e140 scripts: west_commands: Log a hint for rate-limit failure during install
`west sdk install` may fail with a GitHub API rate-limit (HTTP 403)
error. This typically occurs when the command is run multiple times
after previous failures, which is common for new users setting up
the project. Currently, the thrown exception only links to a generic
GitHub rate-limit documentation page, which may be confusing to users.

Users can bypass the rate limit by authenticating with GitHub using a
Personal Access Token. The install script supports this via the
`--personal-access-token` argument. Therefore, detect rate-limit related
failures and print a helpful message suggesting the use of this
argument or netrc based authentication.

Signed-off-by: Beleswar Prasad Padhi <b-padhi@ti.com>
2025-11-25 17:37:19 +00:00
Thorsten Klein
bdbdbcbe8d scripts: west_commands: blobs: support blobs cache
An auto-cache directory can be provided via the `west blobs fetch
--auto-cache` argument or the `blobs.auto-cache-dir` config option.
When enabled, the auto-cache is automatically filled whenever a blob is
missing and must be downloaded.

One or more additional cache directories can be specified via argument
`west blobs fetch --cache-dirs` or the `blobs.cache-dir` config option
(multiple paths separated by `;`).

`west blobs fetch` searches all configured cache directories (including
the auto-cache) for a matching blob filename. Cached files may be stored
either under their original filename or with a SHA-256 suffix
(`<filename>.<sha>`).
If found, the blob is copied from the cache to the blob path; otherwise
it is downloaded from its url to the blob path.

Signed-off-by: Thorsten Klein <Thorsten.Klein@bshg.com>
2025-11-25 13:06:06 +01:00
Thorsten Klein
8fab89e521 scripts: west_commands: format blobs.py
blobs.py is formatted with `ruff format`

Signed-off-by: Thorsten Klein <Thorsten.Klein@bshg.com>
2025-11-25 13:06:06 +01:00
Nakul Chauhan
0172845b3d ci/compliance: update requirements of check_compliance.py script
add missing modules to requirements-compliance.txt to run compliance script

Signed-off-by: Nakul Chauhan <nakulchauhan111@gmail.com>
2025-11-25 13:04:34 +01:00
Morten Kristensen
4f2ad9a53d scripts: ci: use vermin 1.8.0
Update workflow to use the new version of Vermin to enrich the Python
minimum version checks in the CI pipelines.

Signed-off-by: Morten Kristensen <me@mortens.dev>
2025-11-24 14:56:36 -05:00
Eemil Visakorpi
1d70b705b0 twister: Fix serial open for UART devices that do not immediately appear
Testing on linux, --flash-before argument did not work to wait for jlink
upload to complete. Instead Serial port opening throws file not found. The
fix ensures that the code waits for the serial port to appear before
attempting to connect. Tested on a proprietary platform with virtual UART
through usb.

Signed-off-by: Eemil Visakorpi <eemil@doublepoint.com>
2025-11-24 17:22:22 +01:00
Anas Nashif
c9b01e8257 ci: set_assignee: remove size: XS label on updates
The script currently only adds the 'size: XS' label for small PRs (1
commit with ≤1 addition and ≤1 deletion), but it doesn't remove this
label if the PR grows larger after subsequent updates.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-11-24 08:47:51 +01:00
Arkadiusz Cholewinski
1d6e0d533a Power harness: Update path for the raw data file.
Change direction for raw data file from $ZEPHYR_BASE
to <path_to>twister-out/../<test>/

Signed-off-by: Arkadiusz Cholewinski <arkadiuszx.cholewinski@intel.com>
2025-11-22 11:45:44 +01:00
Simone Orru
5f7c451671 west: spdx: Fix copyright parsing in REUSE 0.6.x
Fix broken copyright parsing. Since REUSE 6.0.0 the copyright_lines
attribute has been removed. The new attribute copyright_notices is used.
Additionally, the python package REUSE should now be at least v0.6.0.
This will require an update of REUSE for users that were using a
version earlier than 0.6.

Fixes #98378

Signed-off-by: Simone Orru <simone.orru@secomind.com>
2025-11-22 05:13:26 -05:00
Carles Cufi
353dadf54b scripts: test_plan: Fix issue introduced in 3f77560
The rewrite by ruff seems to wrongly pass a single argument to filter(),
as seen in the logs:

```
    f.process()
  File "/home/runner/work/zephyr/zephyr/zephyr/./scripts/ci/test_plan.py",
  line 145, in process
    self.find_boards()
  File "/home/runner/work/zephyr/zephyr/zephyr/./scripts/ci/test_plan.py",
  line 292, in find_boards
    self.resolved_files.extend(list(filter(resolved_filter)))
                                    ^^^^^^^^^^^^^^^^^^^^^^^
TypeError: filter expected 2 arguments, got 1
```

Split things up properly to avoid this.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2025-11-21 09:48:12 -05:00
Carles Cufi
d6f5aa9258 scripts: west: nrfutil: Use build dir to store generated json
Until now the code was using the path to the .hex file to select the
directory where the generated JSON file required for nrfutil would be
generated. But this has a problem: if the .hex file in a sysbuild
project is located in the tree as a precompiled binary, the runner would
place a file in there and make the tree dirty. Instead use the build_dir
folder which always corresponds (in both sysbuild and regular builds)
to the current target build directory.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2025-11-21 09:46:41 -05:00
Jordan Yates
f8eb167619 scripts: ci: simple ruff formatting
Basic `ruff` format operations to allow CI to enforce from now on.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-11-21 10:08:50 +02:00
Jordan Yates
3f77560b92 scripts: ci: test_plan: fix ruff reports
Fix problems reported by `ruff` and remove exclusions from the config
file.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-11-21 10:08:50 +02:00
Jordan Yates
2186558f37 scripts: ci: coverage: fix ruff reports
Fix problems reported by `ruff` and remove exclusions from the config
file.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-11-21 10:08:50 +02:00
Jordan Yates
3a165b6f5d scripts: ci: stats: merged_prs: fix ruff reports
Fix problems reported by `ruff` and remove exclusions from the config
file.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-11-21 10:08:50 +02:00
Jordan Yates
764ad5562a scripts: ci: version_mgr: fix ruff reports
Fix problems reported by `ruff` and remove exclusions from the config
file.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-11-21 10:08:50 +02:00
Jordan Yates
dc1c23312d scripts: ci: errno: fix ruff reports
Fix problems reported by `ruff` and remove exclusions from the config
file.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-11-21 10:08:50 +02:00
Jordan Yates
f2af864712 scripts: ci: check_compliance: fix ruff reports
Fix problems reported by `ruff` and remove exclusions from the config
file.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-11-21 10:08:50 +02:00
Jordan Yates
4c6bbae9cc scripts: ci: guideline_check: fix ruff reports
Fix problems reported by `ruff` and remove exclusions from the config
file.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-11-21 10:08:50 +02:00
Anas Nashif
909373f10c scripts: set_assignee: get area object before before collabs
In the manifest case, we were operating on a str instead of the area
object.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-11-20 06:05:26 -05:00
Lukasz Fundakowski
3a1428f957 twister: Keep pytest output formatting in log
Fixed formatting of pytest output in log by not removing
leading whitespaces.

Signed-off-by: Lukasz Fundakowski <lukasz.fundakowski@nordicsemi.no>
2025-11-20 06:02:15 -05:00
Anas Nashif
75f69425dd ci: tags: add posix headers to posix group in tags
When posix headers change, make sure we verify the posix portability
layer.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-11-19 09:18:36 -05:00
Anas Nashif
c55d2eafff scripts: get_maintainer: file group pattern inherit top area patterns
File groups inherit file patterns from their parent area. A file will only
match a file group if it first matches the parent area's patterns, and then
also matches the file group's own patterns. This allows file groups to
further filter and subdivide files that are already covered by the area.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-11-18 17:44:53 -05:00
Anas Nashif
19cb7f031b scripts: set_assignee: request review from maintainers of changed areas
Also request reviewes from maintainers of changes areas in the
maintainer file.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-11-18 17:44:53 -05:00
Anas Nashif
616e8d6602 scripts: move set_assignee.py into scripts/ci
Scripts only used by CI, so move it into that directory.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-11-18 17:44:53 -05:00
Anas Nashif
c4b9497b3d scripts: set_assignee.py: Support file groups
Deal with new section in the maintainer file defining file groups.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-11-18 17:44:53 -05:00
Anas Nashif
9165fb4927 scripts: get_maintainer: support file groups
This new section allows defining a group of files in an area and makes
it possible to assign collaborators to the file group being defined.

The purpose of this new section is to allow fine tuning who is added as
reviewer when files change in a group. It is especially useful in large
areas with hundreds of files, for example platform areas.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-11-18 17:44:53 -05:00
Mirai SHINJO
039013f8ef scripts: west_commands: patch: treat all subprocess output as text
Pass 'encoding="utf-8"' to all 'subprocess.run()' calls.
This treats the captured stdout and stderr streams as text rather than
byte sequences.

Example without this patch:
west patch apply --roll-back
ERROR: b'error: patch failed: examples/csp_server_client.py:32\n
error: examples/csp_server_client.py: patch does not apply\n'
FATAL ERROR: failed to apply patch libcsp/test.patch

Example with this patch:
west patch apply --roll-back
ERROR: error: patch failed: examples/csp_server_client.py:32
error: examples/csp_server_client.py: patch does not apply

FATAL ERROR: failed to apply patch libcsp/test.patch

Signed-off-by: Mirai SHINJO <oss@mshinjo.com>
2025-11-17 09:27:56 +02:00
Mirai SHINJO
634b45eddd scripts: west_commands: patch: capture subprocess output in apply() method
Pass 'capture_output=True' to the 'subprocess.run()' call in the 'apply()'
method.
This ensures that stdout and stderr are captured, so 'proc.stderr'
is not 'None' when 'self.err()' is called on a failed process.

Example without this patch:
west patch apply --roll-back
error: patch failed: examples/csp_server_client.py:32
error: examples/csp_server_client.py: patch does not apply
ERROR: None
FATAL ERROR: failed to apply patch libcsp/test.patch

Example with this patch:
west patch apply --roll-back
ERROR: b'error: patch failed: examples/csp_server_client.py:32\n
error: examples/csp_server_client.py: patch does not apply\n'
FATAL ERROR: failed to apply patch libcsp/test.patch

Signed-off-by: Mirai SHINJO <oss@mshinjo.com>
2025-11-17 09:27:56 +02:00
Daniel Leung
fb055ea77e logging: dictionary: format scripts with ruff
Simple formatting via ruff on dictionary logging scripts.
No manual editing was done on the scripts.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-11-15 11:38:48 +01:00
Anas Nashif
95b48cd5ba west_commands: do not depend on CONFIG_SOF
Do not depend on SOF config, use RIMAGE_SCHEMA instead, defined in SOF.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-11-15 11:28:47 +01:00
Sebastian Bøe
70f6cf7ea0 soc: nordic: uicr: Move GEN_UICR options into the main Zephyr tree
I initially added the GEN_UICR options to the gen_uicr image's Kconfig
tree only to not pollute the main tree.

But there is a lot of useful help text in the GEN_UICR option's
Kconfig file that I would like users to be able to read/reference from
the docs.

To not increase the complexity of the Kconfig doc generator, we add
the GEN_UICR options to the main tree and have them all be disabled
for builds other than the gen_uicr image.

Being in the main tree has the added benefit of being recognzied by
the compliance checker.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2025-11-14 15:26:06 +02:00
Lukasz Fundakowski
03eff37921 twister: Remove unnecessary code
Removed some old code which is not used/needed any more.

Signed-off-by: Lukasz Fundakowski <lukasz.fundakowski@nordicsemi.no>
2025-11-14 15:25:41 +02:00
Lukasz Fundakowski
bd187425f7 twister: Don't print full stack trace in readlines_until method
The readlines_until method is part of the testing framework
(pytest harness) and should not print a full stack trace
when the expected line isn't found. It should also raise
an AssertionError instead of a TwisterHarnessTimeoutException,
allowing users to know that a test failed because the expected
condition did not happen.

Signed-off-by: Lukasz Fundakowski <lukasz.fundakowski@nordicsemi.no>
2025-11-14 15:25:41 +02:00
Carles Cufi
ffe2028dcf scripts: runners: Enable reusing the core dry run logic
In order to avoid duplication of logic in runners, allow subclasses
of ZephyrBinaryRunner to set self.dry_run so that they can then reuse
the logic in core.py to log instead of execute.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2025-11-14 09:25:32 +01:00
Carles Cufi
48e0481746 scripts: runners: Generalize the --dry-run option
Move the argparse.add_argument() call to the abstract base class and
augment the RunnerCaps class with a dry_run parameter.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2025-11-14 09:25:32 +01:00
Grzegorz Chwierut
b33387c44a scripts: twister: Add support for passing extra serial port to pytest
Extend twister's device serial handling to support multiple serial ports
for pytest-based tests. This enables testing scenarios that require
communication with multiple UART interfaces on the same device.
This enhancement enables comprehensive testing of multi-UART devices
while maintaining backward compatibility with single serial setups.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2025-11-13 20:42:31 -05:00
Appana Durga Kedareswara rao
639739169e twister: handlers: pass platinfo to serialPTY reorder pre-script execution
This commit makes two key improvements to the DeviceHandler:

1. Pass TWISTER_PLATFORM environment variable to serial PTY scripts
   - Enables serial PTY scripts to access platform-specific configuration
   - The platform name is now available via TWISTER_PLATFORM env variable
   - Allows board-specific serial port and baudrate configuration in
     external serial forwarding scripts

2. Reorder pre-script execution before serial PTY initialization
   - Moved pre-script execution before serial PTY setup to avoid conflicts
   - Prevents race conditions when pre-script performs board power cycling
     or reset operations that might interfere with active serial
     connections

These changes enable more flexible hardware testing scenarios where:
- Serial configuration can be automatically selected based on board type
- Board initialization (power cycling, FPGA programming) completes
  before establishing serial connections

Signed-off-by: Appana Durga Kedareswara rao <appana.durga.kedareswara.rao@amd.com>
2025-11-13 23:19:28 +02:00
Jordan Yates
5e5ac8e078 llext: optional syscall symbol exports
Make the export of syscall symbols optional.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-11-13 23:19:19 +02:00
Patryk Koscik
8b20699475 west: boards: remove arch format option
HWMv2 boards do not support this field

Signed-off-by: Patryk Koscik <pkoscik@antmicro.com>
2025-11-13 23:14:53 +02:00
Gerhard Jörges
b7d2355dbf west: completion: change skip-rebuild to no-rebuild
the west flash --skip-rebuild option was changed to --no-rebuild in
de6b5dba60

Signed-off-by: Gerhard Jörges <joerges@metratec.com>
2025-11-13 23:13:48 +02:00
Benjamin Cabé
4a1d4b0c19 twister: harness: display_capture: drop requirements.txt
This requirements file can be confusing and will only get stale over
time. Drop it since these dependencies are actually captured in
scripts/requirements-run-test.txt

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-11-13 23:11:32 +02:00
Benjamin Cabé
dc0b225919 twister: harness: display_capture: remove duplicate code
Introduce a helper function to check if an exception is expected in
headless environment.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-11-13 23:11:32 +02:00
Benjamin Cabé
4b67237aaa twister: harness: display_capture: remove unnecessary "noqa: B007"
Properly ignore the unused loop variable

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-11-13 23:11:32 +02:00