Commit Graph

65 Commits

Author SHA1 Message Date
Alberto Escolar Piedras
b9977592a5 doc/develop/test/bsim: Update with nrf5340bsim info
Update this page to account for the fact that now
we have several bsim boards in tree.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-16 17:53:25 +01:00
Andrej Butok
287b30eb78 doc: Fix double 'the'
Fix double 'the' in all .rst documentation.

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2023-11-15 14:25:11 +00:00
Alberto Escolar Piedras
373f2d21c1 doc/develop/test: Replace references to native_posix w native_sim
Replace the references to native_posix with native_sim.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-14 06:51:38 -05:00
Alberto Escolar Piedras
f9e0a3dbd0 doc: pytest: Correct native device type name
The native device type name is "native", "native posix" is just
one of the possible target boards (which is going to be deprecated
in the next release).

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-13 09:50:26 +01:00
Grzegorz Chwierut
fffe0b9fad twister: pytest: Parametrize scope of the dut fixture
Added pytest_dut_scope keyword under harness_config section.
New keyword is used to determine the scope of dut and shell
fixtures in pytest-twister-harness plugin.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-10-27 13:35:14 -05:00
Anas Nashif
719fee2bbc doc: ztest: adapt ztest docs
Remove remaining usage and documenation of dropped kconfig that is now
the default.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-20 15:04:29 +02:00
Benjamin Cabé
822904733e doc: twister: syntax highlight + formatting cleanups
- Added language info to code-blocks when relevant (ex. for yaml
  snippets)
- Formatted grammar for expression language as antlr and added
  syntax highlighting
- Fixed various formatting issues with lists, definition lists...

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-10-18 10:13:19 +01:00
Evgeniy Paltsev
5133f62523 doc: twister: add chapter about managing tests timeouts
Document timeout_multiplier board.yaml option and
--timeout-multiplier twister option.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-09-29 12:59:31 +02:00
Grzegorz Chwierut
033afe1c0c twister: doc: Update pytest and twister docs
Document how to use pytest_root keyword. Update docs
with changes in pytest-twister-harness plugin.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-09-18 05:59:35 -04:00
Jamie McCrae
e6d5b3f9a6 doc: twister: Add details on required_snippets
Adds information on the new required_snippets feature

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-09-06 16:40:53 +02:00
Andrei Hutanu
868450ce53 docs: develop: ztest: fix for ztest example build
the Test Framework example present in documentation does not work
out of the box and has to be slightly modified. This is an attempt
to fix the example so it would just work directly from documentation.

Signed-off-by: Andrei Hutanu <andrei.hutanu.i@gmail.com>
2023-09-06 15:18:37 +02:00
Aaron Massey
7692623970 ztest: Document ZTEST_DMEM & ZTEST_BMEM
We use ZTEST_DMEM and ZTEST_BMEM for running tests with memory shared
between userspace and kernelspace. This ought to be documented.

Document ZTEST_DMEM and ZTEST_BMEM.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-08-15 21:34:49 -04:00
Andreas Deininger
571f8591b9 documentation: Fix several typos
Correcting typos in various documentation files

Signed-off-by: Andreas Deininger <andreas@deininger.net>
2023-08-07 13:07:50 +02:00
Yong Cong Sin
9239599277 twister: add support for custom emulator in simulator
Enable the possibility for boards to implement a custom `run` target in
its board.cmake to run any arbitrary commands. This is helpful for devs
who would like to add support for proprietary simulator to their boards
that can't be upstreamed.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-08-02 17:35:26 +02:00
Grzegorz Chwierut
57c27cd736 twister: pytest: Added fixture for mcumgr with unittests
Added mcumgr fixture to pytest-twister-harness. Added unittests for
new fixture.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-07-17 16:23:59 -04:00
Piotr Golyzniak
65d0216f1d doc: bsim: fix typo in build link
Fix typo in link to BabbleSim build page.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2023-07-06 17:07:20 +02:00
Anas Nashif
54fcffb2c7 doc: twister: adapt docs for --enable-slow-only
Minor modification to accomodate for --enable-slow-only.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-06-22 17:14:02 -04:00
Grzegorz Chwierut
732dd4843d twister: pytest: Simplify interface to pytest-twister-harness
Add DeviceAbstract class to default imports from pytest-twister-harness
package to simplify importing DUT package, when creating tests.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-06-20 14:46:55 -04:00
Maciej Perkowski
1158a70e5f doc: twister: add documentation for pytest plugin
Adding documentation for integration of twister with pytest plugin.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-05-26 13:52:15 -04:00
Michał Szprejda
bdf02ff5d6 Twister: Add integration with renode-test
Add support for calling the `renode-test` command from west and twister.
Enable running Robot Framework tests suites in Renode.

Signed-off-by: Michał Szprejda <mszprejda@antmicro.com>
Signed-off-by: Mateusz Hołenko <mholenko@antmicro.com>
2023-05-26 09:43:49 -04:00
Yuval Peress
64c41022e2 twister: Add support for gTest as a harness
Some 3P logic (Pigweed for example) is already heavily invested in
gTest as a testing framework. Adding the `gtest` harness enables
running the existing 3P tests on various Zephyr platforms and configs.

Signed-off-by: Yuval Peress <peress@google.com>
2023-05-24 19:39:10 -04:00
Manoel Brunnen
f0e054634f doc: ztest: Use directives for ZTEST_SHUFFLE
ZTEST_SHUFFLE is a Kconfig, so the appropriate directive should be used.

Signed-off-by: Manoel Brunnen <mb@lee-brunnen.de>
2023-05-08 09:59:05 +02:00
Manoel Brunnen
dbbcfa6749 doc: ztest: Fix broken link
Fix for #55450

Signed-off-by: Manoel Brunnen <mb@lee-brunnen.de>
2023-05-08 09:59:05 +02:00
Alberto Escolar Piedras
ad3c3909ae tests/bsim: Add a script to generate coverage reports
For users convenience, as it is a typical usecase to
want to see the actual coverage of a set of tests.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-04-21 16:23:35 +02:00
Alberto Escolar Piedras
54c2febd4c docs/test: Add a section about BabbleSim
About how do we use it in general, and with lots of links so
people can find more details.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-04-20 10:51:58 +02:00
Dmitrii Golovanov
f31aab58d5 twister: Add configurable flashing timeout
Use explicit flash command execution timeout at DeviceHandler
instead of the hardcoded value of 60 sec.

When a HW platform executes test cases right after the flash command,
the test case remaining timeout is affected by how much time the flash
operation consumes. Some simulation platforms need to spend significant
amount of time on each 'flash' cycle, usually adding the same delay on
each test case.

This improvement adds two new command line options and device map fields:

  --device-flash-timeout - for the flash operation timeout
  ('flash-timeout' device map field).

  --device-flash-with-test - to indicate that the platform flash
  command also runs a test case, so the overall timeout should be
  calculated as a sum of the flash timeout and the current test case
  timeout to receive all console output from the platform
  ('flash-with-test' device map field).

The device map field values override command line values for the
particular platform where configured.

Default behavior is backward compatible: flash operation fixed timeout
is 60 sec. not including the test case timeout.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-04-08 18:37:33 +02:00
Hake Huang
148c0e1773 doc: twister: test-config: enhance test config
update twister document on how to use test config

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2023-04-06 14:23:32 -05:00
Anas Nashif
b6bf269cc6 docs: remove intel_cavs platforms from docs
Remove references to dropped CAVS platforms.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-06 18:51:56 +02:00
Ivan Herrera Olivares
1cc226a283 doc: testing: Fix testing expectations example
This fixes a typo in the testing framework docs where the
ZTEST_EXPECT_SKIP MACRO seems to be referring to the wrong function.

Signed-off-by: Ivan Herrera Olivares <ivan.herreraolivares@gmail.com>
2023-04-04 14:31:52 +02:00
Gregory Shue
5623f54a35 fff: Add fff_extensions.h, RETURN_HANDLED_CONTEXT()
Add supplementary header <zephyr/fff_extensions.h>.  Add macro
to fff_extensions.h for simplifying definition of custom fake functions
needing call-unique information for producing desired output data.
When an array of custom fake context structures is defined and
the return field within the first structure instance is registered
with the standard SET_RETURN_SEQ() macro of FFF, the
RETURN_HANDLED_CONTEXT() macro provides the inverse logic to
recover the context structure for this called instance. The body of
the custom fake handler is provided to the RETURN_HANDLED_CONTEXT()
macro for appropriate execution and access to the custom fake
parameters.

A test suite is also provided to verify macro implementation and
illustrate usage. It is at:
zephyr/tests/subsys/testsuite/fff_fake_contexts/

This code was verified by:

1. (Pass) west build -p always \
            -b unit_testing tests/subsys/testsuite/fff_fake_contexts/ && \
         ./build/testbinary
2. (Pass) west build -p always \
            -b native_posix tests/subsys/testsuite/fff_fake_contexts/ && \
         ./build/zephyr/zephyr.exe
3. (Pass) ./scripts/twister -p unit_testing \
            -T tests/subsys/testsuite/fff_fake_contexts/
4. (Pass) ./scripts/twister -p native_posix \
            -T tests/subsys/testsuite/fff_fake_contexts/
5. (Pass) cd doc && build html-fast

Fix #55246

Signed-off-by: Gregory Shue <gregory.shue@legrand.com>
2023-03-16 13:43:33 -04:00
Anas Nashif
f4dc918d53 twister: doc: test configuration and test levels
Document test configurations and levels.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-03-07 15:49:16 +01:00
Martí Bolívar
9c18b3854a doc: ztest: various fixes
This page is:

- using literal blocks [1] where it should be using code
  blocks [2], which won't produce the desired results [3]

- missing required whitespace between code block directives and their
  pygments syntax arguments [4]

  In other words, this:

    .. code-block::foo

  should be:

    .. code-block:: foo

- using an incorrect syntax (option:`CONFIG_FOO` or
  :kconfig:option:`CONFIG_FOO=y1) to refer to Kconfig
  options (should be :kconfig:option:`CONFIG_FOO`, etc)

Fix these issues so we get syntax-highlighted code blocks in the
correct pygments highlight syntax and valid references to Kconfig
options.

Adjust directive content indentation to match the usual .rst style and
make some grammar tweaks as well.

[1] https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#literal-blocks

[2] https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-code-block

[3] Use of literal blocks can produce the same results if there is a
    consistent choice of highlight language specified for the file, but
    this file is intermixing code blocks that should be highlighted as
    either C or shell commands, so there is no single choice of
    highlight syntax that works.

[4] https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#directives

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-03-06 09:14:02 -08:00
Maciej Perkowski
85dd4975a4 twister: cmake: Add prefiltration based on cmake package helper script
Twister allows filtering based on kconfigs and dts, however the
filtration is a part of the cmake stage, i.e. the stage has to pass
first and then twister checks if required properties are available.
This causes problems, when the full cmake stage is unable to pass.
If so, other filtration methods had to be used, e.g. platform_allow.
The commit modifies the twister workflow:
if a test defines filters based on kconfig/dts first a cmake package
helper script is used to extract dt and/or kconfigs and if the
conditions are fulfilled  it proceeds to a regular cmake stage.
If not, test is skipped.

Co-authored-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-03-02 15:38:08 -05:00
Anas Nashif
1d5fc67b40 twister: doc: clarify build_only keyword
Add more details on the build_only keyword and where it should be used.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-02-27 08:14:22 -08:00
Anas Nashif
f78040e5bd twister: doc: clarify harness keyword in test metadata
Clarify the harness keyword in test metadata.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-02-27 08:14:22 -08:00
Aaron Massey
107cb86bb3 ztest: Add initial zexpect API for delayed failing
Add the zexpect API, inspired by GoogleTest's EXPECT API. This API reports
test failures while allowing test execution to continue. This enables test
reports to show more than a singule failing property on a failing test.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-02-23 20:34:39 +01:00
Benjamin Cabé
5ed3b678ba doc: tests: Fix incorrect table syntax
This fixes an incorrect use of the reStructuredText grid table syntax.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-02-23 07:53:24 -05:00
Torsten Rasmussen
a8a4df0476 doc: document the Static Code Analysis (SCA) tool infrastructure
This commit documents the new SCA tool infrastructure.

The existing documentation for sparse are relocated into a dedicated
documentation folder for SCA tools.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2023-01-27 20:28:58 +09:00
Grzegorz Chwierut
0a7a61f15c twister: docs: Update twister docs with quarantine
Docs updated with changes proposed in #52179
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-01-19 06:51:00 -05:00
Andrei Emeltchenko
86f48609fb doc: ztest: Include ztress to API reference
Include ztress documentation to ztest API section.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-13 09:43:40 +01:00
Tom Burdick
54832687bc docs: Document the simulation platform metadata
Adds a quick note about what the simulation platorm metadata for twister.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-01-12 10:30:57 -05:00
Tom Burdick
38385ed3ff twister: Platform key for test suites
Adds an option to inform twister a testsuite should only be built and
run for platforms with unique sets of attributes. This enables
for example keying on unique (arch, simulation) platforms to run the test
suite on.

The most common usage may be test suites configured to run once per
(arch, simulation) pair as being enough. Additional information about
platforms may enable running a test once per hardware IP block or once
per soc family or soc avoiding duplicated effort in building and running
tests when once suffices.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-01-12 10:30:57 -05:00
Anas Nashif
73584dfe8d twister: support namespacing of extra configs
We want to be able to have platform or architecture extra configs
without having to duplicate a whole section of the test specification.

This adds support for namespacing of extra configs, for example:

arch:nios2:CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000

or

platform:qemu_x86:CONFIG_FOO=y

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-01-12 10:00:05 +01:00
Yuval Peress
47b675c6ee twister: Set a default gcov-tool for llvm
When using llvm we need to set the gcov-tool to "llvm-cov gcov" but
the lcov tool is incapable of passing arguments to the gcov-tool. i.e.
the following cannot work:

$ lcov --gcov-tool "llvm-cov gcov" ...

Instead, create a symlink to llvm-cov prefixed as `gcov` which by the
documentation of llvm-cov will alias to `llvm-cov gcov` subcommand.

Signed-off-by: Yuval Peress <peress@google.com>
2023-01-03 11:01:16 +01:00
Henrik Brix Andersen
2ade879de2 doc: develop: test: ztest: mention the newly added fake EEPROM driver
Mention the newly added FFF-based fake EEPROM driver in the test
documentation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-11-15 09:43:42 -06:00
Henrik Brix Andersen
10c37a3ab4 doc: develop: test: ztest: list FFF-based fake drivers
List the FFF-based fake drivers present in Zephyr.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-11-02 08:19:33 -07:00
Martin Jäger
d218fd9843 doc: develop: test: twister: remove outdated comment
The options --testcase-report and --detailed-report are not existing
anymore.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-10-31 16:14:14 -04:00
Cong Nguyen Huu
708fee8f61 doc: develop: test: update twister guide
add run steps guide for windows

Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
2022-10-06 07:23:17 -04:00
Daniel DeGrasse
50c7341070 doc: test: add documentation for twister sysbuild flag
Add sysbuild flag to twister supported options, with documentation on
how Kconfig and devicetree will be parsed

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-10-04 14:06:58 -04:00
Stephanos Ioannidis
97efbec18b doc: test: Update link to Sparse documentation
Update the Sparse documentation to refer to the official Sparse
documentation instead of some random link, which no longeer works.

It also fixes an incorrect inline literal usage.

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
2022-09-29 12:20:14 +02:00