Commit graph

5615 commits

Author SHA1 Message Date
Chris Friedt
1c28ded7c3 scripts: ci: guideline_check: mitigate excessive false positives
In order to reduce excessive false positives for Coding
Guidelines checks in CI, maintain a list of paths that are
marked "safe" for reserved names to be implemented or declared.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-08-19 09:51:34 -04:00
Dmitrii Golovanov
b8bed5b077 twister: Fix TypeError at get_installed_packages
Fix confusing `TypeError: 'type' object is not subscriptable`
at _get_installed_packages() if twister runs on python version < 3.9

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-08-16 08:49:33 -04:00
Alberto Escolar Piedras
05f5390b92 twister tests: Use native_sim instead of native_posix
native_posix is deprecated. native_sim should be used in its place.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-08-16 09:21:08 +01:00
Dmitrii Golovanov
a4cb802d54 twister: DeviceHandler improve DUT selection
Improve DUT selection at DeviceHandler: for each DUT it counts
how many test instances have been failed on it during the current
twister execution, so the next available DUT will be chosen
ordering the eligible DUTs by less failures occured so far.

The new selection mechanism should increase chances to retry failed
tests on different DUTs, for instance to resolve ploblems when some
DUTs have connectivity or HW issues slowing down test plan execution,
or even block the execution when only one test suite runs whereas
the same first DUT candidate in the list is not working and others
were not chosen.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-08-15 10:15:41 +01:00
Dmitrii Golovanov
ab9cb5f8b2 twister: PyTest plugin's DUT release sequence change
Change Twister PyTest plugin's test finalizing sequence to release
the DUT it is used as the very last operation, after the Test Instance
status becomes fully updated from the execution results.

This also fix a race condition possible when pytest plugin releases
the DUT and it becomes acquired by another test while the current test
is not yet finalized completely.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-08-15 10:15:41 +01:00
Dmitrii Golovanov
c5e8ac7cbf twister: DeviceHandler count test failures on DUTs
Twister DeviceHandler - add test failure counter for how many
test instances have been failed on each DUT (Device Under Test)
when it executes the current test plan.
Output DUT falure counter summary at the end of Twister run.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-08-15 10:15:41 +01:00
Dmitrii Golovanov
bd6e1a2da4 twister: DeviceHandler make DUT counter increment atomic
Twister DeviceHandler - make DUT use counter increment
operation atomic.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-08-15 10:15:41 +01:00
Dmitrii Golovanov
21f4ec8b14 twister: Fix DeviceHandler exit on exception at 'flash before'
Fix Twister DeviceHandler exit on SerialException when
it connects to the serial device in 'flash before' mode.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-08-15 10:15:41 +01:00
Dmitrii Golovanov
44852d05ec twister: Improve DUT release at DeviceHandler
Several improvements at Twister DeviceHandler when it releases
current DUT (Device Under Test):

 - release the exact DUT which is used for the test instance
   instead of all configured DUTs which happened to have
   the same serial device configured.

 - Twister PyTtest harness plugin adjustment to the above.

 - additional debug logging to track DUT waiting/retain/release.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-08-15 10:15:41 +01:00
Grzegorz Chwierut
913434e83d twister: pytest: Capture and log error messages from subprocess
Updated the Pytest-Harness methods to capture and log error messages from
the subprocess, when pytest command fails.
Ensured that error messages are logged with `--inline-log` option
and placed in twister log reports.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2024-08-14 12:33:27 -04:00
Ederson de Souza
1893a12d37 twister/pytest: Inform pytest which platform a test is being done for
While the option to inform pytest about which platform a test is for
(platform being the board, such as mps2/an385) is available, it wasn't
being used. This patch fixes that, by building a pytest command which
includes the platform.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-08-14 09:15:40 -04:00
Ederson de Souza
55613d035b twister/pytest: Add unlaunched_dut fixture
Add a new fixture, `unlaunched_dut`, which is basically the `dut`
one, but without launching the device - thus also not building the
application. It is useful for tests who need a finer control of
the building of the application, before the dut can be launched
to run it.

It will be used on a future patch, which will use it to enable LLEXT EDK
tests.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-08-14 09:15:40 -04:00
Dmitrii Golovanov
0728358422 twister: Fix reporting filter status type mismatch
Fix after #71401 merge at Twister Reporting:
 * filter status value type mismatch;
 * tesplan.json generation incorrect error logs.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-08-14 09:14:19 -04:00
Flavio Ceolin
e00746f9b3 scripts: hardenconfig: Improve deprecated and experimental detection
Gets experimental and deprecated symbols directly from Kconfig instead
of rely on hardened.csv.

This way we keep the tool consistent with Zephyr's code.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-08-14 09:41:00 +02:00
Mikhail Kushnerov
8a76048ea4 scripts: profiling: Add stackcollapse script
Samples, that were obtained by profiling perf tool, can be be translated
into flamegraph using stackcollapse.py script.

Originally-by: Yonatan Goldschmidt <yon.goldschmidt@gmail.com>
Signed-off-by: Mikhail Kushnerov <m.kushnerov@yadro.com>
2024-08-13 18:28:44 -04:00
Lukasz Mrugala
306dba1d91 scripts: twister: Elevate status errors
Incorrect status assignments were previously just warnings in logs.
Now they are elevated to errors.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-08-12 19:23:07 -04:00
Lukasz Mrugala
f429b33d63 scripts: twister: Bring 3.7 changes into the new status system
Some 3.7 changes still used string statuses.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-08-12 19:23:07 -04:00
Lukasz Mrugala
212f48c146 scripts: twister: Unify Twister Statuses
Various different Statuses were joined into a single class,
TwisterStatus. This change anticipates further streamlining
of the Twister's approach to Status.

Code guarding Twister's Properties was shortened to a
value check only.

QEMUOutputStatus was left separate, as doubts were cast
whether it should remain a status. Leaving it separate makes
its removal easier.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-08-12 19:23:07 -04:00
Lukasz Mrugala
6f452e81f7 scripts: twister: Remove unused statuses
TestInstanceStatus of TIMEOUT and FLASH were never really used.
They were checked for, but never assigned.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-08-12 19:23:07 -04:00
Lukasz Mrugala
5c6c44a247 scripts: twister: Isolate statuses into a separate class
Now statuses are not just a str that can be easily mistyped
or assigned wrong. Now they are an Enum.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-08-12 19:23:07 -04:00
Jamie McCrae
cee15b5e5a scripts: ci: check_compliance: Add MCUboot symbols to allow list
Adds new symbols used in sysbuild for configuring MCUboot to the
allow list

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-08-12 15:14:45 +02:00
Raffael Rostagno
eca1112d5b tools: esp32: Update for esp32c2
Added argument to support custom baud rate on ESP monitor
for ESP32C2 and ESP8684.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-11 10:32:59 +02:00
Lukasz Fundakowski
857adb28e3 twister: Fix failing tests on CI with Python 3.12
This change is removing some deprecation warnings
which for some reason causing failing tests with
Python 3.12 on CI #76877.

Also, it fixes warnings from pytest like:
PytestCollectionWarning: cannot collect test class 'TestPlan'
because it has a __init__ constructor
(from: scripts/tests/twister/test_testplan.py)

Signed-off-by: Lukasz Fundakowski <lukasz.fundakowski@nordicsemi.no>
2024-08-09 09:27:59 -04:00
Pieter De Gendt
6a101ae962 scripts: ci: check_compliance.py: Add clang-format check
Add a new compliance check that reports any clang-format issues on
the git diff and prints a warning.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-08-09 08:41:33 -04:00
Pieter De Gendt
f21c97a9c5 scripts: ci: check_compliance.py: Allow multiline annotations
Encode annotation message to allow multiline messages.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-08-09 08:41:33 -04:00
Torsten Rasmussen
756869c9d7 scripts: support soc/boards in Zephyr modules
Extend check_compliance with support for soc and boards defined Zephyr
modules.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-08-09 09:55:18 +02:00
Anas Nashif
a9babb5a83 twister: tests: use platforms that do not depend on a HAL
Do not depend on platforms that need a HAL. This should speed things up
and should resolve issues where runner did not have enough space to deal
with all HALs.
t
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-08-06 08:47:01 -04:00
Chaitanya Tata
638ce2fbfd drivers: wifi: Add nRF70 Wi-Fi driver
Driver for Nordic nRF70 Wi-Fi6 companion chipset, depends on
hal_nordic/nrf_wifi for OS agnostic part of the driver.

This supports (Q)SPI interface to communicate from host to chip.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-08-06 10:27:21 +02:00
Jordan Yates
bdcd5d00d0 scripts: twister: twisterlib: cwd relative path
When presenting an example of how to run a failing test case with
`west build`, provide the source dir path relative to the current
working directory, not the zephyr root directory.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-08-05 18:41:14 -04:00
Tomasz Chyrowicz
4c541eb216 scripts: nrf_common: Use cfg for SUIT paths
It is safer to base the SUIT artifacts path on the path of the
configuration file than the HEX file that is being flashed.
The latter may be overriden by several scripts that merge/transform the
final firmware image.

Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
2024-08-05 18:38:23 -04:00
Grzegorz Chwierut
eff7f4d56a twister: pytest: Use configured shell prompt in pytest-harness
Read CONFIG_SHELL_PROMPT_UART from config file and use them
in shell fixture in pytest-harness package.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2024-08-05 16:29:13 +02:00
Grzegorz Chwierut
8e7cda75cc twister: pytest: Move helper methods to pyteste-harness package
Moved helper methods from tests/boot/with_mcumgr to pytest-harness
package. It can be reused by other tests.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2024-08-05 16:29:13 +02:00
Pieter De Gendt
2f234c627c scripts: kconfig: Add min/max functions
Similar to arithmetic functions, min/max can be useful to use in kconfig.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-08-02 13:41:07 +02:00
Mark Holden
a56e2f86cc coredump: Enable thread understanding for arm cortex m
Add support in arm_cortex_m python script to read thread
registers off of a thread's stack when switching context.

When CONFIG_ARM_STORE_EXC_RETURN is enabled, check the exc_return value
in thread's arch struct to determine accurately where the stack pointer
is. Also, set r7 (the frame pointer register) in case the frame pointer
is not omitted.

Only 8 registers are read from the top of the stack
for other threads present in the dump. So update the
script to reflect that.

Signed-off-by: Mark Holden <mholden@meta.com>
2024-08-02 03:32:09 -04:00
Mark Holden
0b9b33c540 coredump: Enable understanding of threads in scripts
Update zephyr gdb-server scripts to understand threads.

Parse the kernel_thread_info out of the elf file to be used
for finding offsets to data from _kernel structs or from
individual threads.

Update log_parser to understand latest format change, which
allows for the presence of a new section, threads metadata.

Update gdbstub to respond to various packets to describe
the threads present in a dump, and allow switching to
thread context of each thread.

Signed-off-by: Mark Holden <mholden@meta.com>
2024-08-02 03:32:09 -04:00
Grzegorz Chwierut
663786d0a4 twister: Skip scanning non-ztest tests in Twister
Twister scans C-files to find testcases that are implemented
using ZTest framework. Also runs scanning of Elf files
after building. Skip scanning files if it is not required.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2024-08-02 03:31:24 -04:00
Pieter De Gendt
9894b84a2d scripts: west_commands: build: Fix empty testcase
An empty but specified testcase does not build, check if the test key
exists instead.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-08-01 16:39:51 +02:00
Chen Xingyu
0095c224fa scripts: west_commands: runners: Add support for probe-rs
probe-rs is a new programming and debugging tool written in Rust, supports
many probes and targets.

This commit introduces initial support for probe-rs to Zephyr.

Signed-off-by: Chen Xingyu <hi@xingrz.me>
2024-08-01 12:39:28 +02:00
TOKITA Hiroshi
f99f862a79 scripts: kconfig: Add integer arithmetic functions
Added functions for integer arithmetic operations
(add, sub, mul, div, mod, inc, dec)

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2024-07-31 12:56:25 +02:00
Christophe Dufaza
2b2a0e04b2 west: blobs: verify fetched blobs after downloading
Running 'west blobs fetch' does not verify the digest of downloaded files:
1. if the checksum of the previously downloaded file does match
   that in the blob metadata (status BLOB_PRESENT), do nothing
2. if the checksum of the previously downloaded file does not match
   that in the blob metadata (status BLOB_OUTDATED),
   download the "up to date" file
3. if the blob has not yet been downloaded (status BLOB_NOT_PRESENT),
   download it

None of the 2) and 3) code paths will verify that the checksum of the file
just downloaded actually matches the digest in the blob's metadata.

In the event that the metadata of a module is incorrect, then the user
will not notice anything, and may rely on an unexpected binary,
e.g. a static library for a different architecture.

According to the Binary Blobs documentation [1], the expected
behavior is to check the blob digest after downloading.

[1] Fetching blobs, Zephyr 3.6.0 (still applies to Zephyr 3.7.0rc3)
docs.zephyrproject.org/3.6.0/contribute/bin_blobs.html#fetching-blobs

Signed-off-by: Christophe Dufaza <chris@openmarl.org>
2024-07-30 18:29:39 +01:00
Christophe Dufaza
ae9326c920 west: blobs: prefer constants to literals for blob status
Replace blob status literals with the corresponding
constants defined in zephyr_module.

Signed-off-by: Christophe Dufaza <chris@openmarl.org>
2024-07-30 18:29:39 +01:00
Théo Battrel
b764238e0d west: Update fish completion for boards
With the recent change to hwmv2, loading the
boards is extremely slow and can take several
seconds.

To solve that problem this commit add a cache
of the boards. The cache is updated based on:
    - when the latest commit of the manifest
    file directory is updated or;
    - when the manifest file directory is not
    a git directory, when the manifest file
    content itself is updated.

At the same time:
    - update how the board completion is
    displayed by including the board vendor to it;
    - add missing `--board` and `--board-dir`
    options;
    - remove `hwmv1` board completion code.

Signed-off-by: Théo Battrel <theo.util@protonmail.ch>
2024-07-30 18:25:28 +01:00
Théo Battrel
377eed6251 west: add vendor to boards format
Add the new `vendor` formatter argument to display board vendor.

Signed-off-by: Théo Battrel <theo.util@protonmail.ch>
2024-07-30 18:25:28 +01:00
Carles Cufi
539f3a1600 scripts: west_commands: nrfjprog: Change tool-opt help text
The current option used as an example, --recover, is actually a separate
option in the runner itself. Instead use --clockspeed as an example,
which is applicable to all nrfjprog commands.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2024-07-27 15:19:39 +03:00
Carles Cufi
7eb364b082 scripts: west_commands: nrfjprog: Add support for --qspiini
Allow for users to provide a --qspiini parameter that is passed directly to
the nrfjprog executable but only in the --program operation. This is
required since e073210ec2 enabled the
-O/--tool-opt for all operations, but --qspiini is only allowed combined
with --program.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2024-07-27 15:19:39 +03:00
Marcin Niestroj
35059a1b3a west: runners: esp32: respect --esp-device during erase
When --erase was specified, esp32 runner was autodetecting serial port to
be used, regardless of --esp-device argument.

Append '--port SERIAL_DEVICE' parameter earlier, so that erase command
invocation uses explicitly specified serial device.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-07-27 15:19:01 +03:00
Daniel Leung
b2f3d801b4 twister: pytest: use test timeout as the default base timeout
The default base timeout for pytest is statically set by
the TwisterHarnessConfig class to be 60 seconds. However,
sometimes it takes longer than 60s before the app starts
to run, especially on emulator/simulator where it takes
quite some time to start. So pass the test timeout as
the base timeout via pytest command line argument.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-07-27 15:18:01 +03:00
Piotr Kosycarz
b8ae3a416b scripts: ci: test_plan: use find_modules only when commits are provided
Current implementation will not work if comits were not provided.
ie. use case with list of changed files will fail as args.commits is None.

Signed-off-by: Piotr Kosycarz <piotr.kosycarz@nordicsemi.no>
2024-07-18 12:34:10 -04:00
Anas Nashif
4139f2ed60 MAINTAINERS: add bugs scripts to CI
Add script to an area and ignore in twister CI.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-07-12 16:10:13 -04:00
Anas Nashif
47aa08026f ci: scripts: do not count PRs labeled as bug in snapshot
Doing duplicates count of bugs, a PR fixing a bug is not a bug report.
Many PRs fixing an open bug are labeled with 'bug' and thuse are being
counted twice.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-07-12 16:10:13 -04:00