Commit Graph

382 Commits

Author SHA1 Message Date
Pieter De Gendt 95195b5574 scripts: ci: check_compliance: Add text encoding check
Add a check for text files to make sure these are encoded in ascii
or utf-8.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-10-17 10:49:08 -04:00
Pieter De Gendt ca3dc019b7 scripts: Read yaml files using utf-8 encoding
By default Windows does not use utf-8 encoding for reading files,
set is explicitly.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-10-17 09:43:16 +02:00
Pieter De Gendt f7e130f982 scripts: ci: check_compliance: Order list alphabetically
Print the compliance checks alphabetically by default.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-10-15 19:08:20 -04:00
Gerard Marull-Paretas c39ad845f3 scripts: ci: check_compliance: add BOARD_REVISION in Kconfig.board.v2
This is required if boards make use of such definition in their Kconfig
files. In Kconfig.board.v2, only `boards/Kconfig.v2` is loaded, but
BOARD_REVISION is part of `boards/Kconfig`, which can't be loaded in this
context.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-10-07 18:42:14 +02:00
Jukka Rissanen eb7b3f67d4 ci: tags: Add wifi tag to hostap and other wifi related files
Make sure we run wifi tests for all hostap related files
that are changed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-10-04 16:35:44 +01:00
Dmitrii Golovanov 883d9e3a6c ci: elasticsearch: Upload script index map examples
Add several examples for `upload_test_results_es.py` script usage
with ElasticSearch index map files for the following use cases:

 * Twister test results.

 * Twister test results with recordings.

 * Memory Footprint data (`twister-footprint.json`).

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-09-26 17:44:01 -04:00
Anas Nashif b45992159d ci: compliance: remove dropped pylint rules
new pylint dropped few rules.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-09-26 13:30:12 -05:00
Johan Hedberg db88324f26 scripts: check_compliance: Fix incorrect soc root lookup
The script was only looking at the Zephyr base repository and failing to
look for soc roots e.g. in other modules.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2024-09-18 15:29:32 +02:00
Torsten Rasmussen fc741d5344 compliance: Revert "scripts: handle auto defined ZEPHYR_<name>_MODULE"
With the requirement in #78316 for Zephyr modules to always define
ZEPHYR_<name>_MODULE Kconfig setting then there is no longer a need
for this commit. Simplify check_compliance by reverting ths commit.

This reverts commit 35e28e6315.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-09-18 15:29:06 +02:00
Lukasz Mrugala 14a72b5158 scripts: Plug TwisterStatus type gaps
Some dict.get() calls did not use a TwisterStatus
as a default value, thus using a NoneType where
TwisterStatus should appear.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-09-16 20:18:09 +02:00
Benjamin Cabé fd4f3ce246 scripts: compliance: add sphinx-lint linter
ReStructuredText can sometimes be tricky to get right, especially for
folks that might be more familiar with Markdown.

This adds a Sphinx/RST linter to the compliance check script to help
catch common issues that can easily go unnoticed and cause rendering
issues.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-09-13 11:43:04 -05:00
Dmitrii Golovanov d9f567051e ci: elasticsearch: Upload script improvements
Multiple improvements of the `upload_test_results_es.py` script:

 * JSON objects flattening.

   This feature allows `twister.json` file preprocessing to simplify
   its Elasticsearch index structure for complex hierarhical objects,
   for example with memory footprint, or code coverage data.

   A new command line option `--flatten` is added to change testsuite data
   structure in regard of one of its list objects: either `testcases` or
   `recording`, so each item there becomes an independent data record
   inheriting all other testsuite properties, whereas the children
   object's properties are renamed with the parent object's name
   as a prefix: 'testcases_' or 'recording_' respectively.
   Only one testsuite property can be flattened this way per index upload.
   Other children objects will be treated accorging to the index structure.

   Related new command line options (with help text explanations):
    `--flatten-dict-name`,
    `--flatten-list-names`,
    `--flatten-separator`,
    `--transpose-separator`,
    `--escape-separator`

 * A new command line option `--transform` is added to allow regexp group
   parsing in string propertites extracting additional derived properties.

 * A new command line option `--exclude` is added to exclude testsuite
   properties not needed to store at Elasticsearch index.

 * Branch name `--run-branch` and Workflow ID `--run-workflow` command
   line options as additional key fields to allow data from different
   branches, workflows and triggering events in the same index.

 * A new command line option `--map-file` is added to apply
   an explicit index structure to the `twister.json` input data.

 * Add bulk operation timeout parameter for heavy/long uploads.

Other changes:
  * batch upload error handling and logging;
  * inline documentation improvements;
  * some corner case fixes on empty objects.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-09-09 15:24:26 +03:00
Jamie McCrae 9354e181d6 scripts: ci: check_compliance: Add MCUboot Kconfig
Adds a Kconfig used by MCUboot to the allow list

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-09-09 15:23:16 +03:00
Vinicius Miguel 0492235d0d scripts: ci: Fix crash when vendor list is malformed
Also introduces friendly error message.

Signed-off-by: Vinicius Miguel <vmiguel1@gmail.com>
2024-09-02 12:03:03 +02:00
Pieter De Gendt 2c496c094b scripts: ci: Fix clang-format compliance for additions or removals
If a diff only has added or removed lines we need to match both '-' and '+'
characters in the hunk context.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-08-28 16:35:20 -04:00
Anas Nashif a5e3c0a792 ci: do not run twister on some script changes
Do not run twister on some script changes that do not require a twister
run.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-08-28 13:58:56 -04:00
Anas Nashif 4077249cc7 ci: rerun issue check on PR edit
Re-run issue check when a PR is updated, i.e. when someone adds
'Fixes...` to the PR body.

This is mostly for release branches and has no effect on main branch.

Also, add concurrency check in the workflow.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-08-27 11:33:55 -04:00
Torsten Rasmussen 35e28e6315 scripts: handle auto defined ZEPHYR_<name>_MODULE settings in compliance
Update check_compliance to handle auto defined ZEPHYR_<name>_MODULE
Kconfig symbols.

check_compliance runs three levels of Kconfig check.
A basic and a full, both which uses the generated Kconfig.modules
created according to Zephyr modules present.

A Kconfig check where no Zephyr modules are sourced. This check ensures
that Zephyr Kconfig tree doesn't refer to Kconfig symbols defined in
Zephyr module's local Kconfig trees.

However, there are a few auto generated symbols which are allowed,
such as: `ZEPHYR_<name>_MODULE` and `ZEPHYR_<name>_MODULE_BLOBS`.

Therefore, when testing no blobs, filter the generated Kconfig.modules
file, so that no sourcing of extra Kconfig files are performed but
lines defining `ZEPHYR_<name>_MODULE` and `ZEPHYR_<name>_MODULE_BLOBS`
are preserved.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-08-27 10:50:08 -04:00
Pieter De Gendt fda5ca34c2 scripts: ci: Fix clang-format notice at file beginning/end
The clang-format check outputs a git diff with surrounding context. It
naively removed the first and last 3 lines, but this does not work if
there are less lines.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-08-27 12:45:21 +02:00
Anas Nashif b2a9fca9c8 ci: twister: remove reference to opensearch
We have been using elasticsearch for a while now. Remove references and
old script.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-08-27 12:44:31 +02:00
Anas Nashif 420ffdd8a8 ci: compliance: in case of too many errors, send as a single failure
Do not try to format each single failure, this will take too long to
process and will run for hours and spam GH.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-08-22 14:20:50 -04:00
Arkadiusz Cholewinski 65051c8a24 Coverage Analysis: Update Test Case Status
Modify the condition in the parse_testplan
function to align with the changes in the Status class.

Signed-off-by: Arkadiusz Cholewinski <arkadiuszx.cholewinski@intel.com>
2024-08-22 08:49:28 -04:00
Pieter De Gendt 8fcccf1aad scripts: ci: Fix clang-format compliance on Windows
Clang-format installs an exe instead of a python script.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-08-21 18:29:24 +01:00
Pieter De Gendt dde46a94ba scripts: ci: compliance: ClangFormat only check .c/.h files
The clang format compliance check should only be applied to .c and .h
files.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-08-20 19:07:48 -04:00
Tomi Fontanilles 4ea0e88687 scripts: ci: check_compliance: allow Kconfig references with '(' and '.'
For regexes such as `CONFIG_DEBUG_(OPTIMIZATIONS|INFO)` and
to be able to use `.*` as this syntax is used in the Kconfig search.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-08-19 21:50:10 -04:00
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
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
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
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
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
Henrik Brix Andersen c4c5f168e8 ci: ignore changes to the CANopen program download runner
Ignore changes to the CANopen program download west runner in CI.

This script is only executed when performing a DFU using the CANopen
protocol via CAN, which is never triggered in CI anyways.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2024-07-01 16:05:44 -04:00
Yong Cong Sin 88c96f7986 drivers: counter: stm32: remove deprecated clock source Kconfigs
These clock selection Kconfigs should have been deprecated for
more than 2 releases, remove them:

- `CONFIG_COUNTER_RTC_STM32_CLOCK_SRC`
- `CONFIG_COUNTER_RTC_STM32_CLOCK_LSI`
- `CONFIG_COUNTER_RTC_STM32_CLOCK_LSE`

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-06-18 14:33:58 -04:00
Luca Burelli 38b0460de3 check_compliance: allow _MODULE variant of Kconfig options
Since b53a792ff0 Zephyr has the ability to define tristate Kconfig
options. When a tristate option FOO is selected as a "module", this
results in autoconf.h defining CONFIG_FOO_MODULE, not CONFIG_FOO.

This patch allows the check_compliance script to also accept references
to a Kconfig symbol ending in _MODULE if the prefix is defined.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-06-18 15:54:39 +02:00
Anas Nashif 252ca99d0c ci: testplan: do not run tests on all platforms when a test changes
With many tests having 10s or scenarios and variants, anytime we make a
change to a test right now, we end up building all scenarios on all
platforms which ends up in multiple 10s of the thousands of instances
that need to run on 30 or 40 runners blocking CI for hours. We do not
really need that, a test needs to be smart about its coverage and not
rely on boiling the ocean to catch, mostly build errors that are
platform specific.

Change this to do the normal coverage we get on push events.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-06-14 13:59:24 -04:00
Tomasz Chyrowicz f15a2e8ca8 scripts: nrf_common: Handle SUIT artifacts
Handle MPI and root manifest for radio core separately from the main
build system logic.

Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
2024-06-10 17:03:14 +03:00
Anas Nashif 94b9790941 ci: test_plan: fix handling of v2 boards
Handling of board changes was broken and did not support v2 boards, fix
this to optimize CI execution on localized changes of board files.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-06-06 07:50:34 -04:00
Arkadiusz Cholewinski 5cfb4bd3f5 CI: Fix Coverage Analysis
The coverage_analysis.py while generating report, duplicates
files and functions of components.

Signed-off-by: Arkadiusz Cholewinski <arkadiuszx.cholewinski@intel.com>
2024-05-29 07:33:45 +02:00
Maciej Perkowski 48665f2636 scripts: Allow using quarantine mechanism with test_plan.py script
In twister, applying quarantine is a part of apply_filters() function.
However, this function is not called when --load-test is used.
Therefore, if one wants to use quarantines in combination with
dynamic scope from the test_plan.py script, one has to pass such
info through the script.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2024-05-24 08:25:20 -04:00
Valerio Setti e58ebe12f4 mbedtls: add configuration file for PSA features
Adding a Kconfig and a header file to control which PSA features
are to be used from MbedTLS:

- new kconfig symbols are placed in a separate header file
  (Kconfig.psa) and are guarded by MBEDTLS_PSA_CRYPTO_CLIENT. The
  reason for this is that TLS/X509 can either rely on PSA functions
  provided by MbedTLS (when MBEDTLS_PSA_CRYPTO_C is defined) or
  TFM (when BUILD_WITH_TFM is selected). Therefore we could
  not make these new Kconfigs depending on MBEDTLS_PSA_CRYPTO_C.

- by default all PSA symbols are enabled, but they can be
  disabled by respective Kconfigs in order to reduce the image
  size.

- the new header file (config-psa-generic.h) mimics what
  config-tls-generic.h does for MbedTLS builtin symbols: it
  enables a build symbol for every Kconfig one. The name is
  kept identical in the 2 cases (a part from the initial CONFIG_
  in order to simplify the mechanism).

- MBEDTLS_PSA_CRYPTO_CONFIG is finally enabled whenever there
  is any PSA crypto provider (either MBEDTLS_PSA_CRYPTO_C or
  TFM)

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-05-23 11:53:02 -04:00
Piotr Kosycarz a7cb8659bd scripts: ci: test_plan: add parameter for no of testcase roots
Allow to provide from CLI, threshold value for number of test case roots
selected for execution base on changed files.
When such threshold will be exceeded, full scope will be executed.

Signed-off-by: Piotr Kosycarz <piotr.kosycarz@nordicsemi.no>
2024-05-21 16:43:28 -04:00
Piotr Kosycarz 65703a80af scripts: ci: test_plan: fix usage with files
When modified files list is used instead of commit range,
repo object was incorrect.

Signed-off-by: Piotr Kosycarz <piotr.kosycarz@nordicsemi.no>
2024-05-21 16:43:28 -04:00
Carles Cufi ae9096fe62 scripts: compliance: handle multi-line output from pylint
Switch from plain text to JSON output in the pylint compliance check in
order to handle multi-line messages, which were so far being dropped
by the regex.

Fixes #68037.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2024-05-14 18:20:41 -04:00
Arkadiusz Cholewinski 60aeb4e6bc CI: Fix coverage reporting
The fix applies to parse_testplan function.

Signed-off-by: Arkadiusz Cholewinski <arkadiuszx.cholewinski@intel.com>
2024-05-13 14:23:00 +02:00
Anas Nashif 7b9d4a2eff ci: check_compliance: use inclusive language
UNDEF_KCONFIG_WHITELIST ->   UNDEF_KCONFIG_ALLOWLIS

Fixes #72044

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-05-01 19:48:52 +01:00
Alberto Escolar Piedras ec5d127f1f ci: coverage: typo fix in platform list
Fix quemu => qemu

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-04-29 17:40:56 +01:00
Arkadiusz Cholewinski a1cdf27610 CI: Fix coverage analysis
Add mps2/an385 and unit_testing to the simulator
criteria while parsing testsuites. Now the testsuit
will count as a simulator only where the platform
is quemu*, native*, unit_testing, mps2/an385.

Signed-off-by: Arkadiusz Cholewinski <arkadiuszx.cholewinski@intel.com>
2024-04-29 12:52:25 +02:00
Théo Battrel 4a30aab2ae ci: compliance: Update Kconfig check
Take into account the Kconfig symbols in tests and samples that are
defined using the logging template.

This avoid using the `UNDEF_KCONFIG_WHITELIST` for those symbols.

Update the list to remove the symbols that were added for that reason.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-04-13 07:17:45 -04:00