Commit graph

381 commits

Author SHA1 Message Date
Arkadiusz Cholewinski
f58a4c4b1c ztest: expand ztest functionality.
Expanding the ZTEST shell to include a command that
accepts additional parameters, such as ztest run_testcase
<suite:test> -p any_value.

Adding the new ZTEST_P macro, to create the
parameterized test.

Signed-off-by: Arkadiusz Cholewinski <arkadiuszx.cholewinski@intel.com>
2024-08-23 15:48:57 +01:00
Maciej Perkowski
ed97f4f7d5 docs: twister: Add section explaining how to choose platform scope
A common question is how twister decides on which platform to run
a given test. Added section is meant to explain those rules.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2024-08-20 14:54:08 -04:00
Grzegorz Chwierut
7cca59c81a twister: pytest: Allow using pytest-args from command file and yaml
Extend pytest-args from configuration yaml file with args
from command line instead of overwriting.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2024-08-19 10:00:47 -04:00
Eric Southam
97d9876e82 doc: gsg: Update index.rst for macOS
Added python-tk to the brew install statement.
In order to use the zephyr gui tools python must also have the
"tkinter" (python tk interface) tools available.

tkinter is NOT part of 'python3' through homebrew on macOS.

fixes #76811

Signed-off-by: Eric Southam <eric.southam@lvt.com>
2024-08-17 08:54:36 -04:00
Alberto Escolar Piedras
e60ad59e9f docs: api_lifecycle: Use a better release as example for deprecation
1.16 was not meant to be a release, and 1.14 was long ago.
Let's use as example something much more recent.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-08-15 12:40:16 +02:00
Alberto Escolar Piedras
3f48089874 docs: api_lifecycle: Change where to list deprecated items
When deprecating APIs,
let's tell users to add to one GitHub issue tracking all
deprecated APIs meant to be removed,
so the process is simpler and hopefully developers do it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-08-15 12:40:16 +02: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
Gerard Marull-Paretas
33d92b4acd doc: getting_started: remove global Python setup
As it was already outlined, installing Python dependencies at a system
level or user level can be dangerous. For this reason, the default setup
instructions already pointed users to use Python virtual environments. On
newer Ubuntu installations (23.04 onwards) system-level pip installs are
not allowed. Let's make Zephyr _Python-safe_ as well by removing dangerous
instructions.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-08-05 10:17:17 +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
Benjamin Cabé
b7166032cc doc: misc fixes to C domain types
Breathe is not very strict about the types used to reference C domain
objects (ex. referencing a struct using `:c:type:` would work, and vice
versa) but other tooling might be. This commit fixes some of such
incorrectly documented elements.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-08-01 09:14:38 +01:00
Benjamin Cabé
f0b901085e Revert "doc: develop: tools: Exclude webp images from PDF"
This reverts commit a156b619d4.
Now that Sphinx 7.4 is out, it is possible to use webp images
in the PDF documentation (they're converted to png).

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-07-20 10:17:55 +02:00
Gerard Marull-Paretas
0cfb8a4d10 doc: toolchains: zephyr: remove mentions to M1
Apple has released other processors, e.g. M2 or M3, so Apple Silicon is no
longer a synonym of M1.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-07-15 15:12:48 -04:00
Dmitrii Golovanov
5d763534d6 doc: twister: ztest: Add test application diagram
Add a diagram to illustrate a test application's project
components with relationships between Ztest and Twister
objects.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-07-10 11:49:59 -04:00
Dmitrii Golovanov
b826805a44 doc: twister: Move diagrams to sub-directory
Move diagrams to a sub-directory.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-07-10 11:49:59 -04:00
Pisit Sawangvonganan
eead5104fc doc: fix typo in multiple directories before v3.7.0 release
Utilize a code spell-checking tool to scan for and correct spelling errors
in various files within the `doc` directory.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-07-08 09:21:24 +02:00
Yong Cong Sin
a6e672f9b2 doc: modules: fix indentation
Fix the indentation of `bar` in the code block.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-07-03 08:53:46 +02:00
Gerson Fernando Budke
768b8bbca3 scripts: west robot & simulation: Fix OOT
The current version of scipts do not consider OOT boards use cases and
the tests with robot now are strict to only one robot file, which is
not realistic for real environment. This address those issues and allow
multiple testsuits at command line and lists at tests entries. It add
another test parameter to allow configure robotframework options.

Fixes: #74563

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2024-07-01 16:10:35 -04:00
Carles Cufi
457994816b doc: west: Clarify basic west terms
Terms like the west workspace or even west projects and modules were not
documented prominently enough, prompting users to ask for additional
clarification. This patch attempts to resolve this by adding terms and
explanation of concepts to the glossary and west doc pages.

Fixes #67376.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2024-06-28 12:22:41 -04:00
Enguerrand de Ribaucourt
dc987267ac doc: develop: tools: add VS Code setup guide
This basic guide only covers linting so far. It could be expanded in the
future to be more accurate and detailed. The current configuration
allows to navigate the code but some symbols are not recognized by the
linter, and the native compiler is always used.

Co-authored-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
Co-authored-by: Luc BEAUFILS <luc.beaufils@savoirfairelinux.com>
Signed-off-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
Signed-off-by: Luc BEAUFILS <luc.beaufils@savoirfairelinux.com>
2024-06-25 10:26:55 -04:00
Anas Nashif
e0f8a8f16e twister: remove some of the confusion in terminology
Remove legacy use of 'test case' and replace with `test scenario` where
applicable.
Update terminology and some other parts of twister docs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-06-25 10:25:51 -04:00
Anas Nashif
6829210775 doc: ztest: Fix confusing terminology and align with twister.
Testcase definition to match what we use in twister.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-06-25 10:25:51 -04:00
Lingao Meng
302422ad9d everywhere: replace double words
import os
import re

common_words = set([
    'about', 'after', 'all', 'also', 'an', 'and',
     'any', 'are', 'as', 'at',
    'be', 'because', 'but', 'by', 'can', 'come',
    'could', 'day', 'do', 'even',
    'first', 'for', 'get', 'give', 'go', 'has',
    'have', 'he', 'her',
    'him', 'his', 'how', 'I', 'in', 'into', 'it',
    'its', 'just',
    'know', 'like', 'look', 'make', 'man', 'many',
    'me', 'more', 'my', 'new',
    'no', 'not', 'now', 'of', 'one', 'only', 'or',
    'other', 'our', 'out',
    'over', 'people', 'say', 'see', 'she', 'so',
    'some', 'take', 'tell', 'than',
    'their', 'them', 'then', 'there', 'these',
    'they', 'think',
    'this', 'time', 'two', 'up', 'use', 'very',
    'want', 'was', 'way',
    'we', 'well', 'what', 'when', 'which', 'who',
    'will', 'with', 'would',
    'year', 'you', 'your'
])

valid_extensions = set([
    'c', 'h', 'yaml', 'cmake', 'conf', 'txt', 'overlay',
    'rst', 'dtsi',
    'Kconfig', 'dts', 'defconfig', 'yml', 'ld', 'sh', 'py',
    'soc', 'cfg'
])

def filter_repeated_words(text):
    # Split the text into lines
    lines = text.split('\n')

    # Combine lines into a single string with unique separator
    combined_text = '/*sep*/'.join(lines)

    # Replace repeated words within a line
    def replace_within_line(match):
        return match.group(1)

    # Regex for matching repeated words within a line
    within_line_pattern =
	re.compile(r'\b(' +
		'|'.join(map(re.escape, common_words)) +
		r')\b\s+\b\1\b')
    combined_text = within_line_pattern.
		sub(replace_within_line, combined_text)

    # Replace repeated words across line boundaries
    def replace_across_lines(match):
        return match.group(1) + match.group(2)

    # Regex for matching repeated words across line boundaries
    across_lines_pattern = re.
		compile(r'\b(' + '|'.join(
			map(re.escape, common_words)) +
			r')\b(\s*[*\/\n\s]*)\b\1\b')
    combined_text = across_lines_pattern.
		sub(replace_across_lines, combined_text)

    # Split the text back into lines
    filtered_text = combined_text.split('/*sep*/')

    return '\n'.join(filtered_text)

def process_file(file_path):
    with open(file_path, 'r', encoding='utf-8') as file:
        text = file.read()

    new_text = filter_repeated_words(text)

    with open(file_path, 'w', encoding='utf-8') as file:
        file.write(new_text)

def process_directory(directory_path):
    for root, dirs, files in os.walk(directory_path):
        dirs[:] = [d for d in dirs if not d.startswith('.')]
        for file in files:
            # Filter out hidden files
            if file.startswith('.'):
                continue
            file_extension = file.split('.')[-1]
            if
	file_extension in valid_extensions:  # 只处理指定后缀的文件
                file_path = os.path.join(root, file)
                print(f"Processed file: {file_path}")
                process_file(file_path)

directory_to_process = "/home/mi/works/github/zephyrproject/zephyr"
process_directory(directory_to_process)

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2024-06-25 06:05:35 -04:00
Benjamin Cabé
0bd8a2faca doc: use proper pygment for Kconfig code-blocks
Kconfig snippets should use "kconfig" pygment to get proper highlighting

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-06-20 14:07:32 -04:00
Benjamin Cabé
b4b623c26c doc: use proper pygment for .conf code-blocks
config file snippets should use "cfg" pygment to get proper highlighting
This commit updates all occurences where "kconfig" or other languages
were used.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-06-20 14:07:32 -04:00
Daniel DeGrasse
a837117403 doc: flash_debug: fix some issues with probes documentation
Fix a few issues with the probes documentation for NXP boards:
- fix references to debug probe type in probes page introduction
- add an explicit "Install the host tools" step for the LPC-Link and
  MCU-Link based debug probe update steps.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-06-18 14:34:47 -04:00
Noah Pendleton
f61950a782 cmake: sca: Enable CodeChecker error exit status
Normally the return code of `CodeChecker analyze` and `CodeChecker parse`
is suppressed, so all the enabled commands can execute instead of
crashing the build.

Add a new option, `CODECHECKER_PARSE_EXIT_STATUS`, to permit failing the
build if `CodeChecker parse` returns non-zero.

Signed-off-by: Noah Pendleton <noah.pendleton@gmail.com>
2024-06-15 05:14:48 -04:00
Thomas Gagneret
0d05318c96 scripts: zephyr_module: Add URL, version to SPDX
Improve the SPDX with the current values:
 - URL: extracted from `git remote`. If more than one remote, URL is not
 set.
 - Version: extracted from `git rev-parse` (commit id).
 - PURL and CPE for Zephyr: generated from URL and version.

For zephyr, the tag is extracted, if present, and replace the commit id for
the version field.
Since official modules does not have tags, tags are not yet extracted for
modules.

To track vulnerabilities from modules dependencies, a new SBOM,
`modules-deps.spdx` was created. It contains the `external-references`
provided by the modules. It allows to easily track vulnerabilities from
these external dependencies.

Signed-off-by: Thomas Gagneret <thomas.gagneret@hexploy.com>
2024-06-14 19:07:48 -04:00
Dmitrii Golovanov
35e313f9e5 twister: recording: Allow JSON data fields
Extend Twister Harness recording feature to allow selected data fields,
extracted from the log by a regular expression, to be parsed into JSON
objects and eventually reported in `twister.json` as `recording` list
property of the test suite.

With this extension, log records can convey layered data structures
passed from a test image as summary results, traces, statistics, etc.

This extension also allows flexible recording structure: a test image
can output different types of data records incapsulated into a fixed
set of fields, so `recording.csv` file columns are respected, whereas
some of the columns keep strings with json-encoded semi-structured data.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-06-14 09:41:52 -04:00
Marc Herbert
d3a1ce8791 doc: languages: add new section "headers and C/C++ compatibility"
Writing headers compatible with both C and C++ _and_ a range of
toolchains can be very challenging, see for instance long discussions in
commit c15f029a71 ("init.h: restore designated initializers in
SYS_INIT_NAMED()"), PR #69411 and a few others linked from there.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-06-13 08:03:13 -04:00
Benjamin Cabé
a156b619d4 doc: develop: tools: Exclude webp images from PDF
Until Sphinx 7.4.0 is out, it's not possible to use .webp in Latex/PDF
See https://github.com/sphinx-doc/sphinx/pull/12224

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-06-13 08:02:45 -04:00
Wilfried Chauveau
42ce6d1b90 doc: develop: optimizations: make pahole example independent from arch
The paths in the output snippet no longer reflect realistic paths in
zephyr.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2024-06-12 18:29:12 -04:00
Daniel DeGrasse
eff681d50d doc: flash_debug: update NXP flash debug probes section
Update NXP flash debug probes section, to attempt to clarify the
differences between OpenSDA, LPC-Link2, and MCU-Link probes.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-06-11 19:45:34 -04:00
Benjamin Cabé
35e04ef6f3 doc: ztest: fix reference to kconfig options
Use proper identifiers and sphinx roles to reference Kconfigs.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-06-07 21:42:46 +02:00
Bartosz Bilas
2c08e9698d drivers: spi: remove deprecated functions
`spi_transceive_async`, `spi_read_async` and `spi_write_async`
are deprecated since v3.2.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2024-06-06 15:19:29 -05:00
Nelson Ferragut
0d56a3c3f4 doc: unittest: add instructions
Implemented suggestions from Benjamin Cabé.

Signed-off-by: Nelson Ferragut <nelson_ferragut@whirlpool.com>
2024-06-06 07:54:31 -04:00
Nelson Ferragut
7054d01dc8 doc: unittest: add instructions
Add instructions for implementing unit testing.

Signed-off-by: Nelson Ferragut <nelson_ferragut@whirlpool.com>
2024-06-06 07:54:31 -04:00
Henrik Brix Andersen
3eb3c33096 scripts: twister: allow fixtures to contain extra configuration
Allow twister fixtures to contain extra information, which can be used for
test suite configuration. The extra information can be appended to existing
fixtures separated by a colon (i.e. <fixture>:<configuration>).

This is especially useful for the pytest harness, where a fixture of a
given type may need to refer to an instance of a particular piece of host
hardware needed by the pytest suite (e.g. a network interface, a UART, or a
CAN interface connected to the device under test).

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2024-06-04 21:27:35 -05:00
Michał Szprejda
7c084b6649 West: Add west robot command
Introduce `robot` command for running Robot Framework test suites.
Initial implementation consists of one runner dedicated for renode-test,
which is a Renode wrapper for running Robot tests.

Signed-off-by: Michał Szprejda <mszprejda@antmicro.com>
2024-05-28 12:54:52 +02:00
Michał Szprejda
80900cbc3b West: Add west simulate command
Introduce `simulate `command for running samples on a simulator of
choice. Initial implementation consists of one runner, dedicated for
Renode.

Signed-off-by: Michał Szprejda <mszprejda@antmicro.com>
2024-05-28 12:54:52 +02:00
Michał Szprejda
7bc9a98a70 Twister: Rework integration with renode-test
Initial integration with renode-test was introduced in commit bdf02ff,
which added support for calling the `renode-test` command from both west
and twister.

This commit removes the custom run_renode_test target used for running
Robot tests with the `west build` command and makes twister call
`renode-test` directly instead.

Signed-off-by: Michał Szprejda <mszprejda@antmicro.com>
2024-05-28 12:54:52 +02:00
Nikolay Agishev
84898f62a3 DOC: ARCMWDT: Add tip for arc-gnu-toolchain installation
Installation of single toolchain causes problems for customers who
are not familiar with Zephyr infrastructure. This tip is supposed
to help them.

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
2024-05-24 08:05:39 -04:00
Alberto Escolar Piedras
c542b06df1 develop/test/bsim: Reference new nrf54l15bsim target
Add links to the new nrf54l15 from this doc.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-05-16 15:19:08 +01:00
Benjamin Cabé
8b978ac1dc doc: ci: Zephyr now requires Python 3.10 or higher
Update getting started guide, release notes, and CI actions to
use Python 3.10 as minimum supported version.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-05-06 14:56:08 +01:00
Lukasz Mrugala
ad210f7579 scripts: twister: Remove harness repeat field
Removed Harness's repeat field.

Added to schemas in e722db14ad,
together with the rest of harness_config.
Added to Harness when it was created.

Now present only in one sample -
mec15xxevb_assy6853 power management sample.

Could not find definitive proof whether it has ever been used.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-04-30 18:23:23 +02:00
Anas Nashif
b306e80e00 doc: fix duplicate lable data_structures
Fix duplication of label.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-04-30 12:00:58 +02:00
Daniel DeGrasse
7150877801 doc: develop: flash_debug: add note for LinkServer breakpoints
LinkServer does not set a breakpoint at reset by default when debugging
platforms, so if the user single steps after loading an application they
will likely step through ROM code for the target. Add a note clarifying
that users need to set a breakpoint at the reset handler or "main" in
order to pause their application there.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-04-25 08:59:44 -04:00
Jamie McCrae
3d48ad90c9 doc: develop: application: Fix missed HWMv2 changes
Fixes outdated information that was missed with the HWMv2 migration

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-04-18 08:06:49 -07:00
Benjamin Cabé
9ebf341977 west: spdx: introduce support for SPDX 2.3
Minor update to existing zspdx implementation to add support for
PrimaryPackagePurpose introduced in SPDX 2.3.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-04-16 10:07:49 -07:00
Jonathan Rico
f818cbd8cc tests: Bluetooth: Add example bsim test
This test is intended to teach the conventions and best practices to a
potential contributor that wants to add a test, for say a new feature.

It is liberally commented on purpose, so new contributors don't have to
spend two weeks understanding the intricacies of the simulator, the bsim
test framework, the native builds, backchannels, etc..

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-10 07:43:41 -04:00
Toon Stegen
ca527d9f12 doc: add openocd as a dependency for mac
openocd is not part of the mac Zephyr SDK, so it should be installed
through brew

Signed-off-by: Toon Stegen <toon@toostsolutions.be>
2024-04-10 09:22:49 +02:00