Commit graph

4261 commits

Author SHA1 Message Date
Gerard Marull-Paretas d3b8b8d9db twister: improve diagnostics for 'any' set/list types
Since pykwalify does not support multi-type fields, we are forced to use
the 'any' type. This is used for fields that allow sets/lists written as
either YAML lists or space-separated strings. This patch checks for
str/list Python type, and raises a configuration error if not true so
that user obtains better error messages in case the configuration file
contains invalid format.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-10 09:52:37 +02:00
Gerard Marull-Paretas 560a72171e twister: allow list input for set config fields
Twister configuration files have a few fields defined with the "set"
type. The set needs to be specified as a space-separated list of
entries, for example:

```yaml
plaform_allow: boardx boardy
```

This patch allows users to write these fields as YAML lists, for
example:

```yaml
platform_allow:
  - boardx
  - boardy
```

The list gets converted to a Python set, therfore the same exact
behavior is kept in Twister.

In some cases like in the example above, using lists allows to have more
readable configuration files, specially if the list is long. It also
helps on diffs, provided we have one item per line.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-10 09:52:37 +02:00
Maciej Perkowski 3bf7f83f21 twister: Bring back scope selection rule using platform_allow
A change to the scope selection rules was introduced by #52715
but it doesn't comply with the description in the code. What's more,
the change introduces major issues i.e. non deterministic scope
selection, especially in a CI environment. More context at #57595

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-05-08 11:18:44 +02:00
Kumar Gala bae0a5b8b6 logging: Use TYPE_SECTION macros for log const
Clean up log_const to utilize macros for handling sections.

Update database_gen.py to match naming convention change.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-05-03 10:43:31 +02:00
Gerard Marull-Paretas baeee77ba6 twister: automatically add module board roots
Twister does not handle out-of-tree boards automatically. Modules like
e.g. example-application that define their own board root folder, are
required to inform twister via `--board-root`. In contrast, west is able
to to this automatically. This patch makes twister a bit smarter by
automatically filling the board root list with module paths as well.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-02 13:25:12 -04:00
Piotr Kosycarz 7892f40a52 twister: add options to shuffle tests across subsets
Add option to shuffle tests (randomly) before they are split into subsets.
This allow to fairly distribute tests across subsets,
so that long tests are not crowded in a single group.

This also allows to detect unwanted dependencies in test execution order.

Also, added option to provide custom seed to random generator
used to shuffle tests.
This will allow to reproduce certain test order if needed.
Used seed is printed at console.

Signed-off-by: Piotr Kosycarz <piotr.kosycarz@nordicsemi.no>
2023-05-01 06:12:59 -04:00
Rihards Skuja 9a6f7efd00 scripts: fix 'compatible' property of generated thermistor tables
The generated 'compatible' property doesn't match the associated devicetree
binding.

Signed-off-by: Rihards Skuja <rihards.s@origin-robotics.com>
2023-04-27 17:38:31 +09:00
Carles Cufi 0ebc37a972 scripts: runners: nrf: Fix the formatting of the old --nrf-family
The now legacy --nrf-family parameter takes the "raw" family name as
nrfjprog accepts it. But now we use an intermediate representation with
{FAMILY}_FAMILY as the format, so covert to it as required.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-04-27 09:50:48 +02:00
Aurelien Jarno bdb3fd0ae9 scripts: gen_isr_tables: fix pylint issues
pylint reports the following issues on the
scripts/build/gen_isr_tables.py:

 C0325:Unnecessary parens after '=' keyword (superfluous-parens)
File:scripts/build/gen_isr_tables.py
Line:16
Column:0
 C0325:Unnecessary parens after '=' keyword (superfluous-parens)
File:scripts/build/gen_isr_tables.py
Line:316
Column:0

Fix that so that unrelated PR touching the same file have a chance to
pass the compliance checks.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2023-04-26 12:58:13 +02:00
Gerard Marull-Paretas a01d40f604 scripts: utils: migrate_sys_init: handle empty line after ARG_UNUSED
The script left empty lines below ARG_UNUSED. After this patch,

```c
static int f(const struct device *dev)
{
	ARG_UNUSED(dev);

	/* code */
	...
}
```

will become:

```c
static int f(void)
{
	/* code */
	...
}
```

instead of:

```c
static int f(void)
{

	/* code */
	...
}
```

Fixes #56954

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-25 19:57:00 +02:00
Gerard Marull-Paretas 2dbbfaec6b scripts: utils: migrate_sys_init: remove dead ZEPHYR_BASE
ZEPHYR_BASE is not used, so delete it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-25 19:57:00 +02:00
Roman Dobrodii 2e0820f08c scripts: west: add silabs_commander runner
- Runs Silabs Commanders which is useful for SiLabs boards that
can not use J-Link for various reasons.
- Flash support only, no debug.

Signed-off-by: Roman Dobrodii <rdobrodii@antmicro.com>
2023-04-25 10:34:16 -07:00
Stephanos Ioannidis 428f4a6466 scripts: get_maintainer: Fix glob pattern directory match error logic
The `get_maintainer` script currently generates an error when a non-
slash-suffixed glob pattern matches any directories -- this is
incorrect because the glob pattern may be used to match files.

This commit updates the script to only generate an error when a
non-slash suffixed _only_ matches directories.

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
2023-04-26 00:29:25 +09:00
Marc Herbert 16880cc381 scripts: gen_handles: silence "should it be static?" warnings
Some compilers and static analyzers warn when non-static (globals) are
not declared in some .h file. Tweak the generated code and add an
`extern` declaration before each device handle definition to make it
look it was declared in a (non-existent) .h file.

This makes the code a bit longer but it is already generated and very
repetitive anyway.

In the typical SOF configuration this silences about 150 sparse
warnings; as many as device handles.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-04-25 12:19:33 +02:00
Georgij Cernysiov d641be7fc8 runners: stm32cubeprogrammer: fix program files path for win x64
The '%ProgramFiles%' is not guaranteed to be 'C:\Program Files' on
Windows x64.

The value will be 'C:\Program Files (x86)' if the west is executed by
32-bit Python.

To correct the issue '%ProgramW6432%' must be used.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2023-04-24 13:35:26 +02:00
Jamie McCrae 96a9b7e1ff scripts: ci: check_compliance: Ignore mcuboot Kconfigs
Adds mcuboot Kconfig options to the ignore list as these are
defined in mcuboot but used in documentation and samples which
utilise sysbuild to build mcuboot.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-04-24 13:27:53 +02:00
Jamie McCrae 71dfaff583 scripts: utils: migrate_mcumgr_kconfigs: Remove IMG dummy header
Removes converting the dummpy IMG MGMT group Kconfig as this has
been removed from the tree and users would not have used it
anyway.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-04-21 16:33:30 +02:00
Carlo Caione de90dfccbc syscall: Introduce __syscall_always_inline
Sometimes we want to force the inlining of a __syscall. Introduce a new
__syscall_always_inline symbol to do that.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-04-20 14:56:09 -04:00
Kumar Gala 47cf00058e fb: cfb: Use TYPE_SECTION macros for cfb_fonts
Clean up cfb_fonts to utilize TYPE_SECTION macros for handling sections.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-19 17:14:54 +02:00
Kumar Gala 5b5fbc4c11 shell: remove dead linker section for shell
The initshell sections in the linker scripts where associated with theo
old shell code.  The old shell code has been removed for some time so
remove references to initshell in the linker scripts and size_calc.py

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-19 17:14:37 +02:00
Andrei Emeltchenko 29dc4b68ec twister: Cleanup redundant if / else
Convert following construction:

elif self.options.device_serial or self.options.device_serial_pty:
 if self.options.device_serial:
   ...
 else
   ...

to the construction:

elif self.options.device_serial:
  ...
else self.options.device_serial_pty:
  ...

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-04-19 03:27:08 -04:00
Andrei Emeltchenko 186d706c73 twister: Use flash options also for device_serial_pty
Use flash_timeout and flash_with_test options not only for
serial console but also for device_serial_pty.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-04-19 03:27:08 -04:00
Kumar Gala 63ed1d977a twister: size_calc: Fix compliance warning in script
compliance script runs pylink on size_calc.py and reports:

C0325:Unnecessary parens after '=' keyword (superfluous-parens)

Fix warning by remove unnecessary parens.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-19 02:38:46 -04:00
Carles Cufi a7a9cb018a scripts: runners: tests: nrf: Refactor and add nrfutil runner tests
Refactor the existing nrfjprog tests to make them compatible with the
new nrfutil runner implementation, and extend them so that they are
exectued for both tools.

There is missing verification of the JSON generated by the nrfutil
runner, whcih will be added in a follow-up commit.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-04-17 09:29:04 -07:00
Carles Cufi a5e0cbc4fb scripts: runners: tests: nrf: Minor tweaks
- Rename the test file to test_nrf.py in preparation for future tests
  covering nrfutil as well
- Rename the test folder from nrfjprog/ to nrf/
- Change the id_fn returned string formatting so that it's compatible
  with executing a single test case via -k as a parameter (no spaces or
  commas)

You can now execute:
python -m pytest tests/test_nrf.py -k \
'test_nrfjprog_init[NRF51-pin_reset-override_snr-sector[anduicr]\
_erase-no_recover-no_tool_opt]'

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-04-17 09:29:04 -07:00
Carles Cufi b022835146 scripts: runners: nrf: Add support for the new nRF Util tool
Add support for Nordic's new nRF Util tool, aka nrfutil. Via its
"device" command, nrfutil now supports most of the functionality offered
by nrfjprog.

The tool itself can be found here:

https://www.nordicsemi.com/Products/Development-tools/nrf-util

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-04-17 09:29:04 -07:00
Carles Cufi 480b6fb7c0 scripts: runners: nrf: Do not force-flush until the end
In order to better support the ability of the upcoming nrfutil runner to
defer all operations and execute them all at once, defer flushing right
until the end, when everything has been queued up (recover, program and
reset) instead of forcing execution at the program stage.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-04-17 09:29:04 -07:00
Carles Cufi ff9c38316e scripts: runners: nrf: Use nrfutil error codes
Standardize to nrfutil error codes instead of nrfjprog ones. This is
because nrfutil has a wider range of functionality and will eventually
be the default runner for all nRF devices. It is also consistent with
the internal operation representation, which is now using the nrfutil
format already.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-04-17 09:29:04 -07:00
Martí Bolívar 5847890a18 edtlib: finish adding type annotations
This concludes the type annotations for the public API for the module,
along with the relevant internal state. It's not worth type annotating
the internal backwards compatibility shim for !include.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-17 08:58:14 -07:00
Martí Bolívar 3318380eaf edtlib: type annotate EDT
Incremental progress towards type annotating the entire module.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-17 08:58:14 -07:00
Martí Bolívar d89f974760 edtlib: type annotate Node
This requires adding a private constructor so that mypy
can tell what all the final instance state is going to be.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-17 08:58:14 -07:00
Martí Bolívar cae8b6567d edtlib: make PinCtrl a type-annotated dataclass
Converting this to a dataclass will make it easier to type annotate.
Adding type annotations is incremental progress towards type checking
the entire module.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-17 08:58:14 -07:00
Martí Bolívar 83b6db2ec1 edtlib: make ControllerAndData a type-annotated dataclass
Converting this to a dataclass will make it easier to type annotate.
Adding type annotations is incremental progress towards type checking
the entire module.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-17 08:58:14 -07:00
Martí Bolívar 3a43e1b643 edtlib: make Range a type-annotated dataclass
Converting this to a dataclass will make it easier to type annotate.
Adding type annotations is incremental progress towards type checking
the entire module.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-17 08:58:14 -07:00
Martí Bolívar b07f3ddd9f edtlib: clean up Range docstring
Fix grammar issues and typos.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-17 08:58:14 -07:00
Martí Bolívar 49c0d72234 edtlib: make Register a type-annotated dataclass
Converting this to a dataclass will make it easier to type annotate.
Adding type annotations is incremental progress towards type checking
the entire module.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-17 08:58:14 -07:00
Martí Bolívar 4415a29af2 edtlib: make Property a type-annotated dataclass
Converting this to a dataclass will make it easier to type annotate.
Adding type annotations is incremental progress towards type checking
the entire module.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-17 08:58:14 -07:00
Martí Bolívar 835a57ccfa edtlib: type annotate PropertySpec
Incremental progress towards type annotating the module.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-17 08:58:14 -07:00
Martí Bolívar 1b6921965a edtlib: type annotate Binding
Incremental progress towards type annotating the whole module.
Annotate helper procedures used by the class as well.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-17 08:58:14 -07:00
Martí Bolívar 3d75f17d5e edtlib: improve error handling paths
Miscellaneous fixes discovered by inspection while type annotating the
module.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-17 08:58:14 -07:00
Martí Bolívar 51d79808e4 edtlib: move Node
This is just moving the class definition higher in the file. I am
reordering the classes to make it possible to type annotate the module
in a more readable way.

Git might make the diff look bigger than it really is.
To verify this is just moving code, use 'git diff --minimal'.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-17 08:58:14 -07:00
Martí Bolívar ba4b8a406e edtlib: move PinCtrl
This is just moving the class definition higher in the file
to make it easier to type annotate the module.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-17 08:58:14 -07:00
Martí Bolívar a5d82337b7 edtlib: move ControllerAndData
This is just moving the class definition higher in the file
to make it easier to type annotate the module.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-17 08:58:14 -07:00
Martí Bolívar ea4db57d90 edtlib: move Range
This is just moving the class definition higher in the file
to make it easier to type annotate the module.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-17 08:58:14 -07:00
Martí Bolívar da31368eed edtlib: move Register
This is just moving the class definition higher in the file
to make it easier to type annotate the module.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-17 08:58:14 -07:00
Martí Bolívar 20731a3cab edtlib: move Property
This is just moving the class definition higher in the file
to make it easier to type annotate the module.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-17 08:58:14 -07:00
Martí Bolívar ff8c63c03b edtlib: move PropertySpec
This is just moving the class definition higher in the file
to make it easier to type annotate the module.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-17 08:58:14 -07:00
Martí Bolívar bef3970573 edtlib: move Binding
This is just moving the class definition higher in the file. I am
reordering the classes to make it possible to type annotate the module
in a more readable way.

Git might make the diff look bigger than it really is.
To verify this is just moving code, use 'git diff --minimal'.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-17 08:58:14 -07:00
Martí Bolívar cf9cfc31bd edtlib: implement copy.deepcopy() for EDT
Just like we did for dtlib in 15e3e317f7
("dtlib: implement copy.deepcopy() for DT"), except this time it's for
EDT. This also can do no harm and will be useful for implementing
system devicetree support.

No functional changes expected under the assumption that no users are
relying on us having stashed the exact bindings_dirs list passed to
the constructor. This patch switches to making a defensive copy, which
is safer and makes implementing this a little cleaner.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-17 08:58:14 -07:00
Martí Bolívar f4b487aea2 edtlib: refactor some internals
Move all the initial settings of instance attributes to the
constructor, so we can keep track of them all more easily.

No functional changes expected.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-17 08:58:14 -07:00
Martí Bolívar 867dd1c84c devicetree: use c89 comments in test file
This is still the preferred style in a zephyr DTS.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-17 08:58:14 -07:00
Martí Bolívar dcf1fc0592 dtlib: fix docstring
The reference is to an incorrect method.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-17 08:58:14 -07:00
Piotr Golyzniak fec7881117 scripts: tests: tests for choosing binaries
Tests dedicated for choosing binaries basing on platform.binaries and
runners.yaml file. Additional tests for paths sanitizing.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2023-04-14 08:01:31 -04:00
Tristan Honscheid bfd6177631 twister: Include unit test testbinary in ELF search space
`TestInstance.get_elf_file()` does not include the binary name used for
unit testing (`testbinary`) in its search, causing unit tests to not
complete successfully. This does not cause tests to fail and thus goes
unnoticed.

Update the glob expressions used in `get_elf_file()` to also look for
files called `testbinary`

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2023-04-13 19:56:26 -04:00
Andrei Emeltchenko b9f880a141 twister: trivial: Correct license year
Use correct year in license.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-04-13 11:05:47 -04:00
Gerard Marull-Paretas 4355b7f179 scripts: utils: add sys_init migration script
Utility script to migrate SYS_INIT() calls from the old signature:

```c
int (*init_fn)(const struct device *dev)
```
to

```c
int (*init_fn)(void)
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-12 14:28:07 +00:00
Magdalena Kasenberg 661f07ba0f bluetooth: tester: Add CONFIG_BTTESTER_LOG_LEVEL
to set a different log level than the default.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-04-12 13:05:32 +02:00
Kumar Gala ae23da81f2 twister: make get_elf_file sysbuild aware
If we are doing a sysbuild get_elf_file needs to return the default
domain's build_dir.  The standard build_dir will not any ELF builds
in it so will error out.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-11 20:33:29 -04:00
Anas Nashif d8126be557 twister: ignore remapped ELF file when getting ELF name
This is usually used only when doing size calculation, but now it is
being used for extracting symbols from the ELF for testing purposes and
some issues arise with multiple ELF files found.

Simplify the code a bit to make it easy to maintain a lists of things to
exclude.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-11 14:01:39 +02:00
Dmitrii Golovanov 7efec71a85 twister: Alleviate DeviceHandler serial port TOCTOU
The DeviceHandler class method monitor_serial() has time-of-check
to time-of-use (TOCTOU) race condition possible on its serial port
which might be closed and its file descriptor cleared in between
of isOpen() and is_waiting status checks.
The issue is alleviated with controlled exception handling.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-04-11 09:34:57 +02:00
Dmitrii Golovanov 0d2ba9c793 twister: Fix DeviceHandler hangs without suitable DUT
Fixes an issue when DeviceHandler awaited for a suitable DUT infinitely.
It was possible if the device map has no devices with required platform,
or no devices with fixture needed for the test case, or devices without
serial connection. A trivial case is a typo in platform name.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-04-11 09:34:41 +02:00
Marc Herbert fad2da39aa intel_adsp: move west sign from west flash to earlier west build
Invoking `west sign` in `west build` accelerates twister because `west
build` is run in parallel, see rationale in superseded and very
different (CMake-based) PR #52942.

To maximize backwards compatibility:
- `west sign` is optional in `west build`
- `west flash` will sign (again) if any rimage --option is passed

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-04-10 22:04:47 -04:00
Marc Herbert 2c80c4daa4 west: sign: add new rimage option --if-tool-available
Moving `west sign` from `west flash` to `west build` for rimage has
multiple advantages (including a bit more consistency with
imgtool). However it makes `west build` fail when rimage is missing.

To avoid forcing every CI and developer who never used it before to
install rimage, make signing optional when passing new `west sign`
option --if-tool-available. A clear warning is printed.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-04-10 22:04:47 -04:00
Marc Herbert 5c4319d54f west: sign: clean any stale rimage output
We never want to leave stale outputs behind after failing.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-04-10 22:04:47 -04:00
Marc Herbert 5bdb1467cf west: sign: define filename constants earlier in rimage signer
Zero functional change, pure preparation for the next commit.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-04-10 22:04:47 -04:00
Marc Herbert 2fbcdb5ff2 west: sign: add new west config [rimage].extra-args and a default key
Make RIMAGE_SIGN_KEY a CMake CACHE variable so `west sign` can find it
and use it as a default value.

Fixes https://github.com/thesofproject/sof/issues/6917

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-04-10 22:04:47 -04:00
Marc Herbert 66ac6252ed west: sign: add west config [rimage].path = /path/to/rimage
Add a 3rd option besides --tool-path and $PATH

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-04-10 22:04:47 -04:00
Marc Herbert dedb002214 west: sign: rimage: simplify rimage --tool-data code
Reduce duplication, no functional change except for a shorter log
statement with slightly less information.

This is required by the next commits.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-04-10 22:04:47 -04:00
Marc Herbert 5831164e7a west: sign: add west config [sign].tool = rimage/imgtool
The --tool parameter is not required anymore thanks a [sign] entry in
west config like this one:

```
[sign]
tool = imgtool
```

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-04-10 22:04:47 -04:00
Marc Herbert 030b740bd1 west: sign: add ability to read parameters from west config
No functional change yet, will be used in the next commits.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-04-10 22:04:47 -04:00
Marc Herbert efb855134e west: sign: rimage: add default value '-c sof/rimage/config'
Don't force 99% of the users to pass the same value.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-04-10 22:04:47 -04:00
Kumar Gala c09e8fae23 twister: Use pyelf to extract symbol information
For ztest twister would parse the symbol information that was
generated as part of the build (zephyr.symbols).  However the format
of the zephyr.symbols files is highly dependant on the toolchain.

Move to using pyelf to parse the symbol information directly from
zephyr.elf instead so that this works regardless of toolchain.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-08 18:37:52 +02:00
Kumar Gala 53bae96793 twister: allow get_elf_file() to be called on native platforms
On native platforms we typically have CONFIG_BUILD_OUTPUT_EXE set so
we end up with both zephyr.elf and zephyr.exe.  This would cause a
call to get_elf_file() to fail.  There isn't any reason to error out
since zephyr.elf and zephyr.exe should be identical.  So allow it
if the platform type is native.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-08 18:37:52 +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
Al Semjonovs fb8d8c5773 scripts: Create a script to generate an NTC thermistor R/T table
Script to generate an R/T table in device tree format given
R25 and Beta values.

Signed-off-by: Al Semjonovs <asemjonovs@google.com>
2023-04-07 16:23:17 -05:00
Keith Short 3406d40ee0 scripts: runners: bossac: cleanup edt load
An explicit import of edtlib is not required when using
pickle.load() and creates a duplicate module object.

Local testing shows that pickle.load() throws the ModuleNotFoundError if
the sys.path cannot find the edtlib or associated modules.

Signed-off-by: Keith Short <keithshort@google.com>
2023-04-07 13:37:51 +02:00
Keith Short df0942f343 scripts: kconfigfunctions: cleanup edt loading
An explicit import of edtlib is not required when using
pickle.load() and creates a duplicate module object.

Retrieve the correct module object directly from the pickle file
using inspect.getmodule().

Signed-off-by: Keith Short <keithshort@google.com>
2023-04-07 13:37:51 +02:00
Keith Short 52e6b4e1fe scripts: generate_vif: cleanup edt loading
An explicit import of edtlib is not required when using
pickle.load() and creates a duplicate module object.

Also eliminate the check for the EDTError, as this exception cannot be
raised by pickle.load().

Signed-off-by: Keith Short <keithshort@google.com>
2023-04-07 13:37:51 +02:00
Keith Short 23433d89e5 scripts: gen_handles: cleanup edt loading
An explicit import of edtlib is not required when using
pickle.load() and creates a duplicate module object.

Signed-off-by: Keith Short <keithshort@google.com>
2023-04-07 13:37:51 +02:00
Peter Marheine 5773862844 gen_relocate_app: avoid hard-coding section name fragments
This refactors the script to introduce a SectionKind enum that
represents each of the kinds of sections handled by this system (text,
data, rodata or bss), using that to improve the code structure by
reducing the use of strings in favor of indicating the use of values by
their types.

Signed-off-by: Peter Marheine <pmarheine@chromium.org>
2023-04-07 13:12:13 +02:00
Peter Marheine 12c6dda9e2 gen_relocate_app: restrict relocations to listed files
When using code_data_relocation the script identifies sections that
should be relocated, but cannot guarantee that section names are unique
across all linked files. If a section name is not unique then matching
all sections with that name across all input files will relocate more
data than intended.

As a simple example, if both file1 and file2 contain .rodata.strings
sections, then if gen_relocate_app inspects only file1 it will generate
a linker script fragment `*(.rodata.strings)` that matches both object
files.

This commit changes gen_relocate_app to make the linker match on object
files as well (`*file1.o(.rodata.strings)`) to ensure unwanted sections
don't get relocated.

Signed-off-by: Peter Marheine <pmarheine@chromium.org>
2023-04-07 13:12:13 +02:00
Kumar Gala 17f0a64bd4 twister: Enable armclang on all arm targets
Rather than having to add 'armclang' to every <BOARD>.yaml, just list
it as a generally supported toolchain if the architecture is 'arm'.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-07 11:29:43 +02:00
Grzegorz Chwierut 482c94819f tests: boot: test_mcuboot: Add mcuboot log level
Added logging of MCUboot messages to fix twister test scenario.
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-04-06 18:51:23 +02:00
Martí Bolívar 5422a317ad runners: bossac: add --delay option
Add an escape hatch so users can insert a customizable delay
between asking the board to reboot into bootloader mode and
trying to program the new image. This lets people account for
OS-specific enumeration time done after the board resets.

Fixes: #56540
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-04-05 19:42:49 +02:00
Anas Nashif dbb1b87dbc twister: instance: fix pylint warning
C0325:Unnecessary parens after '=' keyword (superfluous-parens)
File:scripts/pylib/twister/twisterlib/testinstance.py
Line:134
Column:0

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-05 10:27:28 +02:00
Anas Nashif 81a1e9d686 twister: marked tests causing timeout as fail
When a test start, mark it as such, if we do not get any results due to
a timeout, it will be finally marked as failed. Previously such tests
causing a freeze were marked as blocked (or not run), which is not
exactly right.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-05 10:27:28 +02:00
Anas Nashif 65b483bd7b twister: harness: rename match variable
Avoid confusion with python match builtin.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-05 10:27:28 +02:00
Maciej Perkowski 9f207ef650 twister: Treat overflows as errors when integration mode is on
Skips due to overflows on integration_platforms during integretion
mode should be treated as errors.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-04-05 08:30:35 +02:00
Maciej Perkowski b934142177 twister: Refactor "skips to errors if integration"
Export the logic to a separate method for reusability

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-04-05 08:30:35 +02:00
Maciej Perkowski 3b5758c4f3 twister: Remove redundant line.
`self.instances[filtered_instance.name]` and `filtered_instance`
are already referancing the same object.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-04-05 08:30:35 +02:00
Piotr Golyzniak 2fcfd48db2 scripts: twister: fix zephyr base sanitizing
If canonical zephyr base is already ended by trailing slash, then it
should not be added redundantly.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2023-04-04 08:43:15 +02:00
Piotr Golyzniak d98afb1cf1 scripts: twister: fix files sanitizing
In some cases built binary files have different names than "zephyr.hex"
files, and for those cases, information about names of file to keep
should be taken from runners.yaml file.

Moreover if in runners.yaml file exist absolute files paths to binary
files, then they should be changed to relative ones.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2023-03-30 13:48:13 +02:00
Daniel Leung 4d914f4f89 toolchain: move CONFIG_LLVM_USE_LD into cmake/toolchain/llvm
This moves CONFIG_LLVM_USE_LD into cmake/toolchain/llvm as this
is a toolchain kconfig. Also make it a choice to allow the use
of LLVM's lld as linker.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-03-29 19:48:47 -04:00
Jamie McCrae ef146c3dbd scripts: compliance: Add MCUboot Kconfig to allow list
Adds a Kconfig for MCUboot which is used in the documentation to
the CI Kconfig check allow list.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-29 11:30:36 +02:00
Jamie McCrae c5fbcc468e snippets: Fix cmake path output on Windows
Uses linux style path output instead of windows style to prevent
issues with cmake assuming the slashes are for escape code
sequences.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-27 14:44:39 +00:00
Carles Cufi e0c90b9393 scripts: requirements: Move requests and pyserial to base
Both the requests and pyserial Python packages are used by west commands
(west fetch and west build -b esp* respectively) so move them to the
requirements-base.txt file.

Fixes #56215.
Fixes #56224.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-03-27 07:12:27 -07:00
Martí Bolívar 1f9ab85354 west: build: appease the linter
The linter is complaining about unnecessary parens.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-03-26 16:12:41 +02:00
Marti Bolivar 5880feee33 west: build: add -S <snippet> argument
Writing '-S foo' is a convenience shorthand for adding snippets at
CMake time without having to add '-- -DSNIPPET=foo' to the west build
command line. It is worth adding a new one-letter command line option
because snippets are anticipated to be a very commonly used feature.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2023-03-26 16:12:41 +02:00
Marti Bolivar 3f282da0e8 zephyr modules: add 'snippet_root' support to module.yml
This key may appear in a module.yml's 'settings' map, and works
analogously to the already existing 'board_root', 'dts_root', etc.
keys: if set, its value is interpreted as a directory that will be
added to SNIPPET ROOT.

For example, if a module.yml contains:

  settings:
    snippet_root: foo

Then 'foo', relative to the module's base directory, will be added to
SNIPPET_ROOT. This then means that any snippets in foo/snippets will
be discovered by the build system.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2023-03-26 16:12:41 +02:00
Marti Bolivar 06c9bf47b3 snippets: initial snippet.yml support
Add a new script, snippets.py, which is responsible for searching
SNIPPET_ROOT for snippet definitions, validating them, and informing
the build system about what needs doing as a result.

Use this script in snippets.cmake to:

- validate any discovered snippet.yml files
- error out on undefined snippets
- add a 'snippets' build system target that prints all snippet
  names (analogous to 'boards' and 'shields' targets)
- handle any specific build system settings properly,
  by include()-ing a file it generates

With this patch, you can define or extend a snippet in a snippet.yml
file anywhere underneath a directory in SNIPPET_ROOT. The snippet.yml
file format has a schema whose initial definition is in a new file,
snippet-schema.yml.

This initial snippet.yml file format supports adding .overlay and
.conf files, like this:

  name: foo
  append:
    DTC_OVERLAY_FILE: foo.overlay
    OVERLAY_CONFIG: foo.conf
  boards:
    myboard:
      append:
        DTC_OVERLAY_FILE: myboard.overlay
        OVERLAY_CONFIG: myboard.conf
    /my-regular-expression-over-board-names/:
      append:
        DTC_OVERLAY_FILE: myregexp.overlay
        OVERLAY_CONFIG: myregexp.conf

(Note that since the snippet feature is intended to be extensible, the
same snippet name may appear in multiple files throughout any
directory in SNIPPET_ROOT, with each addition augmenting prior ones.)

This initial syntax aligns with the following snippet design goals:

- extensible: you can add board-specific support for an existing
  snippet in another module

- able to combine multiple types of configuration: we can now apply a
  .overlay and .conf at the same time

- specializable: this allows you to define settings that only apply
  to a selectable set of boards (including with regular expression
  support for matching against multiple similar boards that follow
  a naming convention)

- DRY: you can use regular expressions to apply the same snippet
  settings to multiple boards like this: /(board1|board2|...)/

This patch is not trying to design and implement everything up front.
Additional features can and will be added to the snippet.yml format
over time; using YAML as a format allows us to make
backwards-compatible extensions as needed.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2023-03-26 16:12:41 +02:00
Martí Bolívar bcc0a3b9aa scripts: add list_devicetree_bindings_changes.py
This automates much of the drudgery of enumerating changes to
devicetree bindings at release time. Some customizations and
release-specific tweaks to the script will probably always be needed,
but it's a good starting point.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-03-25 11:12:38 +01:00
Evgeniy Paltsev f2d04ab189 twister: fix timeout status for the device handler
Currently in binary handler and qemu handler we have status `failed`
in case of test timeout, but in device handler we have status `error`

This not only adds inconsistency between handlers, but also prevents
us from usage test retry functionality for the runs on HW.

Fix timeout status by changing it to `failed` instead of `error`.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-03-22 09:34:33 +01:00
Jason Kridner f36be35600 scripts: compliance: allow webp image files
WebP images are smaller for similar resolutions and quality while being
compatible with web browsers and other image processing tools.

For higher resolution images, be sure to limit the display size to make
the rendered pages look reasonable.

This was approved by Benjamin Cabé (@kartben) in this discussion thread:
https://github.com/zephyrproject-rtos/zephyr/pull/55488#issuecomment-1461792751

Signed-off-by: Jason Kridner <jkridner@beagleboard.org>
2023-03-21 16:03:43 -04:00
Nicolas VINCENT fa7170b846 west: runner: Use --verify and --verify-only with openocd and hex files
the options --verify and --verify-only where only used when flashing elf
files and were ignored for flashing hex files for example when using
openocd runner.
The command to verify the image is now dependant on the presence of
--verify or --verify-only, and the load command is not executed if
--verify-only is provided.

Signed-off-by: Nicolas VINCENT <nicolas.vincent@vossloh.com>
2023-03-21 09:36:29 +01:00
Evgeniy Paltsev 6599c3796d west: runners: mdb-hw: add hostlink-awareness
Add hostlink-awareness to mdb-hw runner. The mdb-nsim and arc-nsim
runners (as well as cmake scripting for nSIM boards) doesn't require
any changes.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-03-17 11:49:02 +01:00
Yuval Peress 36c8b433c8 scripts: Print file causing error for syscalls
I was using a source file provided by TDK for a sensor driver
and the file was (originally) not encoded as UTF-8. When the read()
function was called, the build would fail but I had no idea why.

This change wrapps the 'read()' call and prints the error with
the file name as context.

Signed-off-by: Yuval Peress <peress@google.com>
2023-03-17 11:48:36 +01:00
Carles Cufi 341c01fcd0 scripts: runners: nrf_common: Fix QSPI erase switch
The QSPI erase switch is not part of the "firmware" dict, but rather
placed in the overall operation dict.

Fixes #55625.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-03-15 12:36:33 +00:00
Grzegorz Chwierut 33220ef086 twister: extend --force-platform to skip platform_allow options
In many of test specifications yaml files (testcase.yaml, sample.yaml)
section `platform_allow` is added. This change allows to test some
scenarios on platforms, that are not added yet to platform allow
list (or are not going to be added for some reasons).

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-03-14 10:13:01 -04:00
Dmitrii Golovanov 77b02252c0 twister: Fix DeviceHandler serial leftover cleanup
Fix how DeviceHandler class does 'serial leftover' cleanup
with loss of test output observed on fast console connections,
e.g. over telnet: either 1 sec. of output might be missed,
or up to 1000 bytes/chars, whatever happens first.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-03-13 09:15:22 +01:00
Daniel Leung 751de22ca4 syscalls: skip generating mrsh.c if not userspace
There is no need to generate all the *_mrsh.c files for
marshalling syscall arguments when userspace is not enabled.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-03-11 19:45:23 +01:00
Anas Nashif 8f45c0db79 twister: fix wrong reason when timeout occurs
We are wrongly claiming no console output, yet console output is there
and the failure is just a regular timeout, i.e. the test did not
complete within allocated time.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-03-10 11:38:29 +01:00
Jamie McCrae df9027a64a sysbuild: support Zephyr modules
This commit extends the Zephyr module yaml scheme with additional
entries for sysbuild in the build section.

This allows for Zephyr modules to extend the sysbuild infrastructure
by providing additional CMake and Kconfig files to be included in
sysbuild.

The new settings are:
build:
  sysbuild-cmake: <path>
  sysbuild-kconfig: <path>/<file>
  sysbuild-ext: <true>|<false>
  sysbuild-kconfig-ext:  <true>|<false>

those settings follow the same pattern as the equivalent Zephyr build
settings but are processed by sysbuild.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2023-03-09 09:25:00 +01:00
Anas Nashif 14d88f8425 twister: add support for levels and test configuration
Add support test levels and the ability to assign a specific test to one
or more levels. Using command line options of twister it is then possible
to select a level and just execute the tests included in this level.

Additionally, a test configuration allows definiing level
dependencies and additional inclusion of tests into a specific level if
the test itself does not have this information already.

In the configuration file you can include complete components using
regular expressions and you can specify which test level to import from
the same file, making management of levels easier.

To help with testing outside of upstream CI infrastructure, additional
options are available in the configuration file, which can be hosted
locally. As of now, those options are available:

- Ability to ignore default platforms as defined in board definitions
  (Those are mostly emulation platforms used to run tests in upstream
  CI)
- Option to specify your own list of default platforms overriding what
  upstream defines.
- Ability to override build_onl_all options used in some testscases.
  This will treat tests or sample as any other just build for default
  platforms you specify in the configuation file or on the command line.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-03-07 15:49:16 +01:00
João Dullius 79d9f45296 scripts: runners: bossac: Enable BOSSAC to run on Windows (native)
Fixes #37538 by correctly detecting WSL and blocking bossac from running
on that platform, but allowing it to run on Windows native.

Signed-off-by: João Dullius <joaodullius@bpmrep.com.br>
2023-03-06 13:17:09 -08:00
Carles Cufi e073210ec2 scripts: runners: nrfjprog: Use --tool-opt in all operations
Pass on the tool-specific options to nrfjprog during all operations, and
not only when programming. This is useful when combined with options
like --ip, that allows west flash to be used over the network.

Fixes #55340.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-03-06 11:40:49 -08:00
Carles Cufi ba86759a79 scripts: runners: tests: nrfjprog: Test --tool-opt
Add tests for the --tool-opt command-line switch, to ensure that if the
user includes additional tool options those get passed on to nrfjprog at
the end of the command-line to override any preceding ones.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-03-06 11:40:49 -08:00
Carles Cufi 8fc87c87b8 scripts: runners: nrf: Add support for multiple nRF backends
Generalize the logic that was previously in nrfjprog.py into a new
nrf_common.py, which can then use specific tool subclasses, one of which
is nrfjprog.py, to implement the actual tool invocation.

This commit lays down the groundwork for the addition of a new backend
for nRF boards, the new nrfutil tool from Nordic. Both nrfjprog and
nrfutil will coexist in the immediate future, but nrfutil is expected to
be the sole tool for everything nRF in due time.  This is why the internal
representation of the operations is based in JSON and is using the exact
format that nrfutil expects when using the 'execute-batch' option, that
takes a JSON file with an array of operations to be executed.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-03-06 11:40:49 -08:00
Carles Cufi c34da24596 scripts: west: runners: Support class hierarchies in the runners
Allow for multiple levels of inheritance in the runners in order to make
it possible to share common infrastructure in similar runners.
Also check if the class can be instantiated (i.e. it is not abstract) to
avoid returning abstract base classes.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-03-06 11:40:49 -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
Benjamin Cabé b00c63e764 footprint: ci: Remove audio SOF samples
Removes audio SOF samples from footprint test plan as they no longer
live in-tree

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-03-02 11:46:54 -05:00
Marc Herbert 7249594cd1 west: sign: rimage: log("Prefixing with xman...") only when doing it
Fixes commit 2fdc551acc ("sign.py: stop ignoring the -- -c foo.toml
option passed to rimage")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-03-02 10:54:13 +01:00
Tristan Honscheid 1eb0452fcb twister: Fields for Kconfig and DT overlay files in testcase.yaml
This is an implementation of issue #48334 and adds support for
specifying additional config and device tree overlays through fields in
the testcase.yaml file, which is more readable than having to cram these
in to `extra_args`.

Consider this example which shows the original and new ways to add
config and DT overlays:

```
common:
  extra_args: "CONF_FILE=a.conf;b.conf
DTC_OVERLAY_FILE=w.overlay;x.overlay OVERLAY_CONFIG=e.conf
UNRELATED=abc"
tests:
  utilities.base64:
    extra_conf_files:
      - "c.conf"
      - "d.conf"
    extra_overlay_confs:
      - "extra_overlay.conf"
    extra_dtc_overlay_files:
      - "y.overlay"
      - "z.overlay"
    extra_configs:
      - CONFIG_SAMPLE=y
    tags: base64
    type: unit
```

The new fields are `extra_conf_files`, `extra_overlay_confs,
`extra_dtc_overlay_files`. Files specified in these sections are appended
to any `CONF_FILE`, `OVERLAY_CONFIG`, or `DTC_OVERLAY_FILE` fields in
`extra_args`, causing the following args being passed in to
`self.run_cmake` at `runner.py:850`:

```
['-DUNRELATED=abc',
 '-DCONF_FILE=a.conf;b.conf;c.conf;d.conf',
 '-DDTC_OVERLAY_FILE=w.overlay;x.overlay;y.overlay;z.overlay',
 '-DOVERLAY_CONFIG=e.conf extra_overlay.conf '
 '<build_dir>/twister/testsuite_extra.conf']
```

These fields can be used in the common or scenario-specific YAML
sections and will be merged in order of least to most specific:

 1. config files extracted from common's extra_args
 2. files listed in common's {extra_conf_files or extra_overlay_confs
    or extra_dtc_overlay_files}
 3. config files extracted from test scenario's extra_args
 4. files listed in test scenario's {extra_conf_files or
    extra_overlay_confs or extra_dtc_overlay_files}

Specifying these files in extra_args now triggers a deprecation warning,
as the direct YAML fields are preferred for readability. They will still
function for now but support will be dropped in the future.  One
testcase.yaml
(`zephyr/tests/cmake/overlays/var_expansions/testcase.yaml`) is
converted to use the new fields. A follow-up PR will convert the
remaining files to the new format.

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2023-03-01 16:52:01 -05:00
Martí Bolívar 513e03ad68 edtlib: extract _slice() code to new helper module
This will make it more convenient to use it from multiple different
places, which we will have a need for in the future.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-02-27 17:44:45 +01:00
Martí Bolívar c0a024253f edtlib: fix typo
Trivial fix.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-02-27 17:44:45 +01:00
Martí Bolívar 3bb1aaebd5 dtlib: fix pretty-printing in pdb
We need to have an _include_path attribute to pretty-print
this object from within pdb, for some reason. Add it.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-02-27 17:44:45 +01:00
Martí Bolívar 2d86e1b05d dtlib: add missing type annotations
This allows mypy to check the internal variable type annotations
within the function.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-02-27 17:44:45 +01:00
Martí Bolívar 78fca3c19c dtlib: fix comment header
The following section of code has nothing public inside.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-02-27 17:44:45 +01:00
Martí Bolívar 6ac19439b2 dtlib: remove dead code
There's no need for _parse_node() to return the Node instance that is
its sole argument. The only user of the return value is a dead store.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-02-27 17:44:45 +01:00
Martí Bolívar 5272e7f681 dtlib: add DT.move_node()
This helper lets you place a node (really the entire subtree rooted at
that node) elsewhere in the devicetree. This will be useful when
adding system devicetree support, when we'll want to be able to, for
example, move the CPU cluster node selected by the current execution
domain to /cpus.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-02-27 17:44:45 +01:00
Martí Bolívar e479d3f7c6 dtlib: use new helper in test cases
Using dtlib_raises() throughout the test cases saves some typing.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-02-27 17:44:45 +01:00
Martí Bolívar 2063ddbc93 dtlib: add new test case helper
Introduce a context manager that will save some typing
when dealing with expected exceptions.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-02-27 17:44:45 +01:00
Martí Bolívar faa7e530c2 dtlib: clean up a documentation string
The standard way we write this in the library is 'documentation
string', not 'docstring'.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-02-27 17:44:45 +01:00
Anas Nashif 4a572ac86f twister: fixed non-verbose output and line breaks on errors
Percentage calculation was off due to a recent fix in counting and lines
were not breaking correctly on errors.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-02-27 07:47:12 -05:00
Grant Ramsay 090b13cf1e scripts: ci: check_compliance: Ignore undefined CONFIG_CMD_CACHE
CONFIG_CMD_CACHE is a U-Boot config, mentioned in docs.

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-02-24 18:11:56 +01:00
Dominik Ermel 86c4b4caa9 west/sign: Move from using partition label property
MCUmgr no longer uses DTS node property label to identify
slots for image upload and running application. It now uses DTS node
labels for that purpose.
This commit moves `west sign` from using label properties
to DTS node labels, same way the MCUmgr does.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-02-22 09:32:51 -08:00
Anas Nashif cd26df75b5 twister: cleanup: fixed typo preventing runtime cleanup
Fixed runtime cleanup option. A typo in a conditional prevented the
cleanup from happened when a test has passed.

Fixes #54240

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-02-22 06:07:29 -05:00
Anas Nashif cdffe5080e twister: define variable earlier to use it in exception
Define suite_path earlier, so that in case of an exception it can be
used.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-02-22 05:31:07 -05:00
Anas Nashif 78a741f1b4 twister: schema: make tests a required key
Catch any test definitions not defining any tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-02-22 05:31:07 -05:00
Anas Nashif 59b3e5ba11 ci: elasticsearch: do not set id for documentats.
Do not set id for docuemnts, lets elasticsearch do that on its own.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-02-21 13:06:29 -05:00
Anas Nashif 39324048eb ci: elasticsearch: set run date when uploading data
To get consistent and 1 single rundate per CI run, set run_date when
we upload the data. This is optional mostly for CI and to avoid
duplication when we re-run jobs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-02-21 13:06:29 -05:00
Fabio Baltieri 9b30667c77 build: drop LEGACY_INCLUDE_PATH support
LEGACY_INCLUDE_PATH has been defaulting to "n" and marked as deprecated
in both v3.2 and v3.3. Drop the option entirely for v3.4.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-02-21 15:06:48 +01:00
Marcin Niestroj faee6c90b8 twister: coverage: initialize 'use_system_gcov'
Initialize 'use_system_gcov', so it is always set before being referenced
in "elif" statement.

Fixes: 1440b19bde ("twister: restore logic to determine which gcov we
  should use")
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-02-20 09:29:35 -05:00
Peter Johanson 26a04adb8b west: runners: uf2: Add new UF2 runner.
Add a new UF2 runner, supporting only the flash capability.

Searches for FAT partitions containing `INFO_UF2.TXT` files,
and can optionally filter on a matching `Board-ID` value in
that file.

Signed-off-by: Peter Johanson <peter@peterjohanson.com>
2023-02-20 12:50:38 +01:00
Anas Nashif 5770bdeb1a twister: better handling of error reporting
Stop counting errors as failures and report them as is. This fixes
issues with counting when retrying failures and errors.
We have been adding errors to failures and then double count them when
displaying information on the screen instead of keep an accurate count
in the counter class.

This is now fixed and we do report errors seperately, ie. build errors.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-02-20 10:20:14 +01:00
Radosław Koppel 14a1b2ffec dts: Add _STRING_UNQUOTED string and string-array
This commit adds access to the string values without a quotes.

Signed-off-by: Radosław Koppel <r.koppel@k-el.com>
Co-authored-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2023-02-20 09:49:00 +01:00
Anas Nashif 1440b19bde twister: restore logic to determine which gcov we should use
We do not want to use gcov from the SDK for native posix and unit tests,
instead we want the system gcov. Restore logic that determines that.

Fixes #54226

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-02-19 20:59:56 -05:00
Allan Norgaard 23cacb3766 scripts: dts: gen_driver_kconfig_dts: Skip empty yaml files
The YAML parsing will currently return a None-type if no input data
is empty, and the subsequent check for a substring will cause an
exception.

Signed-off-by: Allan Norgaard <allannk@gmail.com>
2023-02-19 20:46:44 -05:00
David Reiss 2d8271dca1 pytest: Log pytest command
This makes it easy to run the command manually, possibly with edits to
change the test behavior.

Signed-off-by: David Reiss <dreiss@meta.com>
2023-02-19 20:41:34 -05:00
Nikolay Agishev 0dec4cf927 toolchain: Move extra warning options to toolchain abstraction
Move extra warning option from generic twister script into
compiler-dependent config files.
ARCMWDT compiler doesn't support extra warning options ex.
"-Wl,--fatal-warnings". To avoid build fails flag
"disable_warnings_as_errors" should be passed to twister.
This allows all warning messages and make atomatic test useles.

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
2023-02-19 20:34:13 -05:00
Marti Bolivar 2149d2127a scripts: zephyr_commit_rules: improve commit error messages
Make the error messages which appear in CI for invalid commit messages
match the text in the documentation which describes the rules for
commit messages exactly. This hopefully makes it easier for people to
read failing CI results and map them to documentation links describing
what to do instead.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2023-02-08 15:03:56 -08:00
Carlo Caione 16248180c5 code_relocation: Fix Warning
The script is generatinga void instead of return. Fix it.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-02-08 12:11:14 +01:00
Andrey Borisovich 802600da7b scripts: twister: west twister error codes match twister direct call
This commit fixes #54492 where return code 1 is returned
when twister tests fail when twister is called directly and
return code 0 in similar scenario but twister is invoked using
west.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2023-02-07 09:22:34 -08:00
Gustavo Romero 7ab955ec1f tracing: scripts: Fix spelling
Fix the spelling of Babeltrace library in the warning message displayed
when such a library can not be imported.

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
2023-02-08 01:09:31 +09:00
Maciej Perkowski 40a21f61c2 bugfix: twister: Fix interaction between quarantine integration mode
Tests under quarantine are not treated as errors in the integration
mode. However --quarantine-verify argument allowing to execute just
test under quarantine and skipping others was not considered in
relation to integration mode. Those skips are wrongly threated as
errors. This commit fix this relation and makes thoses skips not
turned to errors.

fixes: #54516

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-02-08 01:06:30 +09:00
Anas Nashif 1bed8accd1 twister: fix some pylint warnings
Unnecessary parens after '=' keyword (superfluous-parens)

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-02-06 10:03:52 +01:00
Anas Nashif 5ab9bcfdf3 twister: fix reporting and example in synopsis
Take an instance that has failed and not whatever was last processed in
the for loop.

Also, change instructions to use `west twister` rather than
`./scripts/twister` to be consistent.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-02-06 10:03:52 +01:00
Anas Nashif 66fa169623 ci: do not hardcode es server in script
Use environment variable instead of hardcoding server in script. This
will allow reuse.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-02-03 20:53:20 +09:00
Anas Nashif fcd60cf789 ci: make any arch/ changes trigger kernel testing as well
This should fix issue like #54337 where architecture code changes were
filtering out kernel tests, where those changes are being tested. Kernel
and arch code is tightly coupled and we need to run kernel tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-02-03 10:09:26 +09:00
Marti Bolivar a2f203dd1a runners: restore obsolete synonyms for -i/--dev-id
This is a partial revert of commit
2cee5ff519
("scripts: west_commands: runners: remove deprecated options").

I remarked at the time that the removal of the older way of writing
things from the runners themselves seemed gratuitous since they are
easy to continue to support indefinitely and people may have been used
to the old way of doing things. It didn't seem worth the fight to push
for a revert at the time, though.

Since then I've run into real problems that their removal has caused
in the wild and I am convinced that this part of that patch was wrong.

Restore the original, undeprecated forms of these options, but make it
clear in the command line help that they're just obsolete alternative
spellings at this point.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2023-02-02 09:47:17 -08:00
Evgeniy Paltsev c85e5438b9 ARC: west runner: mdb-hw: fix incorrect argument handling for jtag
Currently we just pass in case of the unsupported jtag adapter
is selected. Fix that by rising ValueError as we do in case of
other incorrect arguments.

While I'm at it add few missing test-cases for mdb west runners.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-02-02 09:05:18 -08:00
Evgeniy Paltsev 963c7a2d40 ARC: west runner: mdb: fix unexpected empty argument pass to MDB
Currently, in case of multi-core target or in case jtag adapter
auto-selectio, we pass unexpected empty argument (empty quotes `''`)
to MDB binary due to argument generation error.

Fix that.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-02-02 09:05:18 -08:00
Evgeniy Paltsev d2d5177e58 ARC: west runner: mdb: remove dead code
Remove code which looking for `cld` process pid - this functionality
isn't use anymore by twister. And as manual MDB termination is also
fixed now this functionality isn't required for anything now.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-02-01 10:06:26 -08:00
Evgeniy Paltsev 0206effb46 ARC: west runner: mdb: fix unusable console after flash / debug
Currently we try to start MDB (MetaWare Debugger) in background
with ignored sigint no matter if we are planing to do debug
session (via `west debug`) or just run something on HW or on
nSIM (via `west flash`)

That cause really bad user experience as after we do
`west debug` or `west flash` we can't terminate the debugger
from the console. Moreover even if we terminate the debugger
process from separate terminal the console stil would be
broken so we need to do `stty sane` in it to make it usable
again.

Fix all that by proper starting the debugger process.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-02-01 10:06:26 -08:00
Fabio Baltieri 317b3c6897 scripts: compliance: pass argv explicitly to parse_args
Change the check_compliance main invocation to pass an explicit argv
list from main to parse_args(). This does not change anything for direct
invocation, but allows wrapping the compliance script and using it as a
library while controlling its behavior by passing the intended flags to
main().

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-02-01 17:17:34 +09:00
Anas Nashif ef9d5bbddf twister: print synopsis at the end and instruction for reproducing
If errors are found and tests are failing, print a brief summary showing
the top 10 items failing with instructions on how to reproduce either
with twister or west.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-01-28 17:05:19 -05:00
Anas Nashif 79b955c80a west: build: allow --test-item to accept twister style instance names
This will allow something like this:

west build -b qemu_x86  -T samples/hello_world/sample.basic.helloworld

instead of:

cd samples/hello_world
west build -b qemu_x86  -T sample.basic.helloworld

Using this option will allow to take twister output and just pass it to
west to reproduce failures.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-01-28 17:05:19 -05:00
Anas Nashif 1008124358 west: build: handler errors in west build with --test-item
Handle errors and wrong test meta-data when using --test-item.

Fixes #52614

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-01-28 17:05:19 -05:00
Henrik Brix Andersen fba6c7f210 scripts: kconfig: add function to determine if GPIO hogs are enabled
Existence of enabled GPIO hog nodes cannot be determined using any of the
existing kconfig functions. Add custom kconfig helper function to determine
whether any GPIO hogs nodes are enabled.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-27 14:38:52 -08:00
Henrik Brix Andersen 28819152cb scripts: dts: add special tooling for handling GPIO hog nodes
GPIO hog nodes contain a "gpios" property, but unlike other "*-gpios"
properties, these are not phandle-arrays as they only carry the data part
(e.g. pin, flags) but lack the phandles to the (parent) GPIO controller.

Add special devicetree tooling to handle the "gpios" property of GPIO hog
nodes and generate special devicetree helper macros as if they were phandle
arrays.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-27 14:38:52 -08:00
Anas Nashif 712d682cf7 twister: fix initialization of job server option
Do not set default for jobserver variable.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-01-28 02:24:09 +09:00
Anas Nashif e4d48545a3 twister: make job server default only on Linux
Job server only works on Linux, revert to original behaviour when
running on Windows or MacOS.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-01-27 11:53:13 -05:00
Anas Nashif fd702ebb34 ci: push test results to elasticsearch instance
Move away from opensearch and switch to elasticsearch for reporting.
The results will be available at https://kibana.zephyrproject.io/

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-01-27 22:57:26 +09:00
Torsten Rasmussen cb690ec56e cmake: implement build infrastructure for supporting SCA tools.
Static code analyser (SCA) tools are important in software development.

CMake offers built-in support for some tools, such as cppcheck and
clang-tidy.

Other tools, such as sparse, are not directly supported.

This commit provides a uniform way for users to specify a supported
SCA using `ZEPHYR_SCA_VARIANT=<tool>` which is consistent with how
toolchains are specified.
ZEPHYR_SCA_VARIANT can be set using `-D` or in environment.

Support for an SCA tool is done in `cmake/sca/<tool>/sca.cmake`.
SCA_ROOT can be used to specify additional search paths when looking up
implementation for a tool. SCA_ROOT can also be specified in
`zephyr/module.yml` as setting. This makes it possible to provide SCA
tool implementation as part of a Zephyr module.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2023-01-27 20:28:58 +09:00
Fabio Baltieri 16d723ee1b scripts: set_assignee: don't skip assignment on too many labels
The set assignee script currently exits if there's too many labels
associated with a PR. Change that to just skip the label assignment, but
continue on to assign a maintainer based on the most relevant area.

Tested with:

  ./scripts/set_assignees.py -v --dry-run -P 52716

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-26 14:57:29 -05:00
Jamie McCrae d72e135b2b scripts: ci: Enable pylint check for argument parser abbreviations
Enables running CI checks which will now search for initialisation
of argument parser where abbreviations are not disabled.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-01-26 20:12:36 +09:00
Jamie McCrae 101ba4ae09 scripts: pylint: Add argument parser abbreviation checker
Adds a pylint checker for ensuring that the argument parser
library is setup with abbreviations disabled.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-01-26 20:12:36 +09:00
Jamie McCrae ec7044437e treewide: Disable automatic argparse argument shortening
Disables allowing the python argparse library from automatically
shortening command line arguments, this prevents issues whereby
a new command is added and code that wrongly uses the shortened
command of an existing argument which is the same as the new
command being added will silently change script behaviour.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-01-26 20:12:36 +09:00
Fabio Baltieri d428c8c836 scripts: compliance: support not writing output to files
Support running the compliance check script without writing the output
to any file.

This adds a check for the --output flag to not write to the output file
if the value is empty, and add a second flag for inhibiting the
individual case files.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-26 10:10:58 +00:00
Jeremy Bettis fae717305b twister: Implement GNU make jobserver support
When twister is started from make, use the information in MAKEFLAGS to
participate in the job server started by make.

When twister is running standalone, start a jobserver to share with
child processes. If using the kitware version of ninja, then this will
prevent ninja+twister from starting more processes than XX when twister
is run with -jXX.

There is no implementation for windows yet.

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2023-01-25 20:06:13 -05:00
Anas Nashif c2b2486072 twister: adapt tests after revert of namespacing
Remove prefix with path from tests, we do not have  namespacing anymore.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-01-24 20:21:57 -05:00
Anas Nashif eb56ea4d42 Revert "twister: tests: Add unit tests for names of external and module tests"
This reverts commit 45e1ff94cd.

This is not needed after removal of namespacing.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-01-24 20:21:57 -05:00
Anas Nashif a4b2d58d3f Revert "twister: Update path structure for tests"
This reverts commit 21eb27c5c0.

This change has been a source of much trouble and ends up preventing us
from tracking test results across tree. It uses the repo name as the
namespace, and that is not always the same and does not have to be
called 'zephyr', depending on where you are running and in which
environment.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-01-24 20:21:57 -05:00
Tom Burdick 23d8d0d0ae twister: Better messages for keyed test exclusions
Improves the message for tests being excluded using the platform key,
describes the key already found and the platform being used to run the test
in its place.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-01-20 12:17:29 +01:00
Dominik Ermel 807ad96e21 scripts/utils/migrate_mcumgr_kconfigs.py: Fix missing Kconfigs
Add missing Kconfig translations.

Fixes #53306

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-01-20 11:58:47 +01: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
Grzegorz Chwierut 6809c05d09 twister: quarantine: Added pytests
Implemented scenarios to test the quarantine in twister
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-01-19 06:51:00 -05:00
Grzegorz Chwierut bac1a955d0 twister: quarantine: Added simulations field and regex to filter fields
Regex are allowed on every field, not only scenarios.
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-01-19 06:51:00 -05:00
Grzegorz Chwierut d95eab1ce6 twister: Refactor and extend quarantine implementation in twister
Implementation ported from TwisterV2.
- quarantine handled by separate module
- multiple yaml allowed from args: --quarantine-list
- scenarios, platforms, architectures keywords in
quarantine yaml are optional, if not given - means take it all

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-01-19 06:51:00 -05:00
Fabio Baltieri 79856e7637 west: runners: blackmagicprobe: guess the gdb port based on the OS
Add some logic in blackmagicprobe.py to guess the GDB serial port based
on the OS instead of just trying the flag or /dev/ttyACM0.

The new logic explicitly looks for the well known path for BMP on Linux
(/dev/ttyBmpGdb), so that we can remove it from the board files that
have it set explicitly right now. At the same time it still allows
setting the port from the flag and also checks an environment variable,
so that it can be used for systems with multiple probes.

As a fallback, it looks for a valid serial port, picking the first one
(the probe creates two, the GDB one is the first one), and raise an
exception if nothing is found.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2023-01-19 10:16:00 +01:00
Fabio Baltieri dabfffaf26 west: runners: blackmagicprobe: update reset on connect command
Recently the blackmagicprobe command for "connect under reset" has been
updated from "connect_srst" to "connect_rst". Update the flag name in
the west blackmagicprobe binding, keep the old one as well for
compatibility with out of tree boards, and send both the old and new
commands to GDB so that it works with both the old and new firmware. GDB
is going to get a "command not supported by this target" for one of the
two and proceed with the other one.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2023-01-19 10:16:00 +01:00
Anas Nashif fef2bb0866 twister: run as device, even if simulation is supported
Some hardware boards are supported in qemu as simulation platforms. If
we are testing with the real hardware, make sure we treat this as a
device and not as a simulator. First priority when initializing a
handler is to check if device testing is requested, then we can handle
the rest without --device-testing.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-01-17 16:10:17 -05:00
Daniel DeGrasse ca14626120 scripts: build: update gen_relocate_app.py to use new argument separators
Update gen_relocate_app.py to use "|" to separate code relocation
directives, and ";" to separate multiple files in a relocation directive.
This will enable multiple files to be passed to zephyr_code_relocate,
as well as multiple files to be passed from a CMake generator expression.
The script will then seperate these files and relocate each according to
the arguments given to zephyr_code_relocate.

Note! This commit will break support for zephyr_code_relocate until
the CMake function is updated

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-01-17 18:08:37 +01:00
Chris Duf 92897ef011 python-devicetree: bump version to 0.0.2
Inconsistency between python-devicetree version numbers
may be confusing:
- the last version at PyPI is 0.0.2
- zephyr-rtos/python-devicetree/setup.py sets the version
  to 0.0.2 (this is probably the setup file used when uploading
  to PyPI)
- zephyr-rtos/zephyr/scripts/dts/python-devicetree/setup.py sets
  the version to 0.0.1

This may suggest that the mirror repository, and PyPI, are more
up-to-date than zephyr-rtos/zephyr/scripts/dts/python-devicetree.

Repositories being otherwise mostly identical (1), also bumping
the python-devicetree's version here seems a sane option.

(1) Ignoring the doc directory (only at zephyr-rtos/python-devicetree).

Signed-off-by: Chris Duf <chris@openmarl.org>
2023-01-16 11:19:54 +00:00
Chris Duf 436616c66b python-devicetree: unpin types-PyYAML version
This is essentially a revert of PR #46311 "python-devicetree: CI hotfix",
assuming the original issue has been resolved, either upstream in
types-PyYAML or in Zephyr itself.

Tested with types-PyYAML 6.0.12.2 (current version at PyPI):

  $ python -m mypy --config-file=tox.ini --package=devicetree
  dtlib.py:962: note: By default the bodies of untyped functions [...]
  dtlib.py:964: note: By default the bodies of untyped functions [...]
  dtlib.py:965: note: By default the bodies of untyped functions [...]
  dtlib.py:967: note: By default the bodies of untyped functions [...]
  Success: no issues found in 4 source files

The "notes" above are harmless (use of type hinting to define local
variables while mypy won't "check the bodies of untyped functions").

References:
- python-devicetree tox run fails (issue #46286)
- python-devicetree: CI hotfix (PR #46311)
- python-devicetree: CI hotfix (commit f6a6843)

Signed-off-by: Chris Duf <chris@openmarl.org>
2023-01-16 11:19:54 +00:00
Al Semjonovs a7d6ca2bd9 west: west twister integration
Add twister command to west.

Signed-off-by: Al Semjonovs <asemjonovs@google.com>
2023-01-13 15:39:04 -08:00
Al Semjonovs d09fd2259f twister: move main to twisterlib/twister_main.py
This allows for ability to import main to be used
within west

Signed-off-by: Al Semjonovs <asemjonovs@google.com>
2023-01-13 15:39:04 -08:00
Al Semjonovs 067ba65e10 twister: Split up argument parsing into smaller functions
Split argument parsing into smaller functions to be leveraged
by west twister extension.

Signed-off-by: Al Semjonovs <asemjonovs@google.com>
2023-01-13 15:39:04 -08: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
Anas Nashif 5fd629b48b twister: package artifacts for testing
Package artifact for later use with --test-only.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-01-11 10:35:08 -05:00
Anas Nashif 3ae7b250c7 twister: do not log on waiting for devices
Do not log anything about waiting for devices, this is very noisy in
some environments.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-01-11 10:35:08 -05:00
Anas Nashif 1ffeaac92a twister: improve handling of artifacts with --prep-artifacts-for-testing
Previous commit dealing with cleanup (c304db56f1) was not taking
--prep-artifacts-for-testing into consideration. Fix this and make sure
we do cleanup when this option is enabled.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-01-11 10:35:08 -05:00
Anas Nashif 21077b7cf2 twister: support custom test binaries
Have boards define what binaries should be kept for device testing. The
purpose of this is to reduce the amount of artifacts and just keep the
binaries needed for flashing a device, reducing the size of the final
payload.

A board can have twister keep multiple binaries needed for testing when
--prep-artifacts-for-testing option is used.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-01-11 10:35:08 -05:00
Henrik Brix Andersen d151424a6d scripts: west: runners: canopen: add SDO block transfer support
Add SDO block transfer support for the CANopen program download west
runner. SDO block transfers are experimental in the underlying CANopen for
Python.

Reduce the program download chunk size to half the program download buffer
size to avoid blocking IO.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-11 09:39:57 +01:00
Grzegorz Chwierut f016761859 twister: fix hardware map updates
When re-generating hardware map for DKs with more than 1 serial port (more
enries in the hardware map), then we keep enfo only about the last entry.
For boards like nrf5340 it works, because the last serial port is used,
but for nrf52840 with two ports, the first one is important, so after
re-generating the hardware map it does not work.
The solution is to keep all entries after re-generating the hardware map.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-01-11 09:39:03 +01:00
Stephen Stauts d4b8db792d scripts: kconfig: Add functions for array/chosen props
Expands kconfigfunctions to include checks for value existence in
an array property by nodelabel, or a chosen's boolean prop value.

Signed-off-by: Stephen Stauts <stephen.stauts@nordicsemi.no>
2023-01-10 07:10:07 -08:00
Fabio Baltieri 9d3681c10c scripts: compliance: add support for YAMLLint
Add a YAMLLint compliance check that uses the yamllint package to report
linting error on YAML files.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-04 17:29:23 +01:00
Moritz Fischer 7dd05967f7 scripts: dts: gen_driver_kconfig_dts: Use SafeLoader
Using SafeLoader is preferrable where possible.

Signed-off-by: Moritz Fischer <moritzf@google.com>
2023-01-04 07:38:56 -08:00
Maciej Perkowski 474a8cf25f twister: bugfix: Make elf scan more precise.
When scanning for available elfs, twister discards ones with `_pre`
in their name, to not include prebuilds like 'zephyr_pre0.elf`.
However, the scan looks at the whole test name. If _pre is in the name
(e.g. _precision) it would be wrongly discarded ending with twister
reporting error that no elfs were found. This commit makes the discard
to look only at the last part of the name (i.e. not including test name
but only a lowest level, where zephyr.elf etc are located.)

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-01-04 08:48:16 -05:00
Fabio Baltieri 0daa3a78a9 yamllint: indentation: fix files in scripts/
Fix the YAML files indentation for files in scripts/.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-04 14:23:53 +01:00
Fabio Baltieri 7dd902d035 yamllint: fix all yamllint comments-indentation errors
Fix all comments-indentation errors detected by yamllint:

yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
  grep '(comments-indentation)'

This checks that the comment is aligned with the content.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-04 01:16:45 +09:00
Fabio Baltieri 5c32300861 yamllint: fix all yamllint truthy errors
Fix all thruthy errors detected by yamllint:

yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
  grep '(truthy)'

This only accepts true/false for boolean properties. Seems like python
takes all sort of formats:

https://github.com/yaml/pyyaml/blob/master/lib/yaml/constructor.py#L224-L235

But the current specs only mention "true" or "false"

https://yaml.org/spec/1.2.2/#10212-boolean

Which is the standard yamllint config.

Excluding codeconv and workflow files, as some are using yes/no instead
in the respective documentation.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-04 01:16:45 +09: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
Fabio Baltieri f33d43795d scripts: compliance: add a check for MAINTAINERS.yml format
Add a compliance check that tries to load MAINTAINERS.yml with
get_maintainer.Maintainers() if it's been modified by the CL, and fail
compliance if it fails to be parsed.

Example output:

```
ERROR   : Test MaintainersFormat failed:
Error parsing MAINTAINERS.yml: MAINTAINERS.yml: YAML error: while
scanning a simple key
  in "MAINTAINERS.yml", line 976, column 1
could not find expected ':'
  in "MAINTAINERS.yml", line 977, column 3
```

```
ERROR   : Test MaintainersFormat failed:
Error parsing MAINTAINERS.yml: MAINTAINERS.yml: glob pattern
'drivers/regulator' in 'files' in area 'Drivers: Regulators' matches a
directory, but has no trailing '/'
```

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-12-29 14:42:02 +01:00
Martí Bolívar 374411dfaf west: runners: improve pyocd runner test coverage
Make sure that this runner can handle multiple --tool-opt arguments,
and that the options specified for pyocd are passed to that tool in
order.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2022-12-29 10:36:02 +01:00
Fabio Baltieri e7a4aec3c9 scripts: compliance: check for bindings in subdirectories
Change the bindings file filter to check for "dts/bindings/" as a
substring rather than prefix. This makes the check catch files in
subdirectories as well (for sample tests and samples), and makes the
check usable on external projects where the bindings may not live in the
project root.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-12-28 19:01:57 +01:00
Fabio Baltieri 5bf79ed9cd scripts: compliance: use get_files filter for dts checks
Drop the custom logic to skip deleted files, use get_files filter
instead.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-12-28 19:01:57 +01:00
Fabio Baltieri afc2ad34bd scripts: compliance: move binding file cycle in run()
Move the file iteration loops of the bindings compliance check in the
callers, so that if we add more checks we don't have iterate on each one
of them and a check works on a single file.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-12-28 19:01:57 +01:00
Fabio Baltieri ab4d87dd41 scripts: compliance: add an ImageSize check
Add a check to validate and limit the size of images in the repository,
setting stricter limit for files in boards/.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-12-22 17:01:54 +01:00
Fabio Baltieri 30fd28d9f0 scripts: compliance: move isfile() check in get_files()
Git normally only works on files, but can include directories if there's
any submodule in the repository. This is currently checked in
filter_py(), move the check into get_files() so it does not have to be
copied around.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-12-22 17:01:54 +01:00
Fabio Baltieri 5d23505336 scripts: compliance: fix DevicetreeBindingsCheck
DevicetreeBindingsCheck is missing the splitlines() call to process the
get_files() output, hence cycling through each character of the output
rather than each file, which causes the check to never run on anything.

Fix it by moving the splitline call into get_files() itself, since every
caller is going to use it anyway.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-12-22 17:01:54 +01:00
Dominik Ermel d492c0d79a scripts/utils/migrate_mcumgr_kconfigs.py: Script for migrating MCUmgr
Script that provides aid with converting project files to
new Kconfig option names.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-12-22 12:36:34 +01:00
Tristan Honscheid ea33f2fce4 twister: Allow passing additional args to native_posix test binary
This commit expands Twister's CLI so that arguments passed after
a double dash (`--`) get forwarded to the ztest test executable when
run. When built for native_posix, ztest provides a useful CLI that
allows filtering individual suites and tests, adjusting timing settings,
and controlling the shuffling seed. Currently there is no easy way to
use these (with the exception of `--seed`) without needing to dig out
the resulting `zephyr.exe` binary from the build dir and invoke it
manually.

 ### Examples

Run a specific ztest suite only (useful when writing tests and you don't
want to run a long testcase in its entirety)

```
$ scripts/twister \
    -p native_posix \
    -s
zephyr/tests/lib/cmsis_dsp/complexmath/libraries.cmsis_dsp.complexmath \
    -- -test=complexmath_q31::*
```

Unrecognized arguments that precede the double dash will result in an
error message:

```
$ scripts/twister \
  -p native_posix \
  --foobar 123 \
  -- -test=basic_math_q7::*

...
Unrecognized arguments found: '--foobar 123'. Use -- to delineate extra
arguments for test binary or pass -h for help.
```

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2022-12-20 23:35:36 -05:00
Keith Short 42f746c8d0 clang-format: Enable InsertBraces option
Zephyr's coding guidelines require braces on every code block body.
Enable InsertBraces option so clang-format automatically adds these
braces.

Signed-off-by: Keith Short <keithshort@google.com>
2022-12-20 22:51:57 +01:00
Carles Cufi c0455b836f scripts: ci: compliance: Remove Codeowners check
This check is no longer used and will be replaced by the maintainers
file, remove it.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-12-20 17:34:35 +01:00
Stephanos Ioannidis 6bf275a8ca hardening: Require CONFIG_TIMER_RANDOM_GENERATOR=n
This commit adds the requirement for the `TIMER_RANDOM_GENERATOR`
Kconfig to be set to `n` because it enables timer-based pseudo-random
number generator, which is only intended to be used for testing
purposes.

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
2022-12-15 22:35:31 +01:00
Anders Bjørn Nedergaard 53227f1f13 scripts: migrate_includes: add .hpp to extension list
The script will now also migrate includes in files with the suffix `hpp`.

Signed-off-by: Anders Bjørn Nedergaard <ape.anp@gmail.com>
2022-12-15 10:29:46 +01:00
Stephanos Ioannidis 0e5762e56e scripts: compliance: Fix misdetection of Kconfig choices as undefined
This commit updates the KconfigCheck to add the Kconfig symbols from
both "config" and "choice" symbol lists to the defined symbol list, as
opposed to the "config" list only, in order to prevent any references
to the choice symbols outside the Kconfig files (e.g. in documentation)
from being reported as undefined.

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
2022-12-13 17:20:10 +09:00
Tristan Honscheid ae97971a61 gitlint: Add "commit" to violation messages
This PR clarifies the violation messages emitted by gitlint when
checking the commit message. For example:

 * Before: `43: UC4 Line exceeds max length (N>75): "..."`
 * After: `43: UC4 Commit line exceeds max length (N>75): "..."`

This makes it easier to identify the source of the error since there is
currently no additional context besides the error code UC*. I recently
pushed a commit that had some sample code as part of the commit body
that exceeded the lenght limit, and thought the error was referring to
one of my source files based on the line it showed. (feel free to laugh
at me, but let's make it better for the next person)

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2022-12-07 07:58:05 -05:00
Madhurima Paruchuri fa738b0f74 usb-c: Generate USB-C connector VIF policies XML file
Generates XML file containing VIF policies by reading the device tree
using EDT.pickle generated during build
This script writes a subset of general and sink-pdo VIF policies in
output file
This script gets invoked during build if enabled through kconfig
The generated XML containing USB-C VIF policies could be used by
USB PD/Type-C analysers/testers to understand USB-C properties and
perform tests accordingly

Signed-off-by: Madhurima Paruchuri <mparuchuri@google.com>
2022-12-02 08:46:04 -06:00
Anas Nashif bbf03fd991 ci: twister: fixed path for tag based filtering
path for posix was not being matched correctly due to a missing /. So
some posix tests were excluded and not excercised.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-12-02 07:31:37 -05:00
Gerhard Jörges 87a751c266 west: runners: add file argument
adds --file argument to west flash/debug as described in #52262.

Signed-off-by: Gerhard Jörges <joerges@metratec.com>
2022-12-01 06:53:58 -08:00
Håkon Øye Amundsen 325e35036b checkpatch: update --exclude docs
The current docs are incorrect as comma separated paths
are not working. Providing a separate --exclude argement
per path does however work.

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2022-12-01 15:48:30 +01:00
Anas Nashif 1217d850f5 twister: instance: fix layout
Fix indentation of return.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-12-01 06:07:30 -05:00
Anas Nashif 3677a10834 twister: ignore unit tests/EFI images with --show-footprint
Ignore unit tests and EFI binaries when calculating footprints with
--show-footprint, or we will get a build error.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-12-01 06:07:30 -05:00
Gerard Marull-Paretas 2cee5ff519 scripts: west_commands: runners: remove deprecated options
The --snr (nrfjprog) --id (jlink) and --board-id (pyocd) options were
deprecated a long time ago in favor of --dev-id. It is time to remove
them.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-30 14:15:30 +01:00
Katarzyna Giądła 14358aee1c twister: get information about memory footprint from build.log
This commit calculate memory footprint from build.log and
proposes an alternative approach to #2465.

Signed-off-by: Katarzyna Giądła <katarzyna.giadla@nordicsemi.no>
2022-11-29 16:17:32 -05:00
Evgeniy Paltsev ae79de1930 ARC: MWDT add TLS support
Add thread local storage support for ARC MWDT toolchain.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2022-11-29 09:48:23 +01:00
Anas Nashif ef7d0d6c01 twister: fix simulation conditional
non-simulation platforms set key to 'na', we need to check for that
instead of just checking for existance of key.

Fixes #52595

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-11-28 10:47:32 -08:00
Carles Cufi 76499a6127 scripts: compliance: Move Kconfig-related items to the class
Both get_defined_syms and UNDEF_KCONFIG_WHITELIST are used exclusively
by the Kconfig check, so move them to the class.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-11-29 01:40:33 +09:00
Carles Cufi b8a6a510aa scripts: compliance: Resolve ZEPHYR_BASE in _main()
Instead of globally resolving ZEPHYR_BASE, move it to _main() so we can
catch potential exceptions when doing so and for consistency with the
rest of globals, like GIT_TOP. This also includes documenting a new
"<zephyr-base>" path hint for classes.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-11-29 01:40:33 +09:00
Carles Cufi e60c1e024b scripts: compliance: Clean up ZEPHYR_BASE usage
The global variable ZEPHYR_BASE is always set in the script, so no need
to check for its existence.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-11-29 01:40:33 +09:00
Carles Cufi 5f094fbbf5 scripts: compliance: Make line optional in fmtd_failure()
Some errors are attributable to a specific file, but not a specific line
within that file. Allow for formatted errors that refer to a file but
not a line.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-11-29 01:40:33 +09:00
Carles Cufi 28c2932a1d scripts: compliance: Consolidate 'git diff' calls in get_files()
Many tests invoke `git diff` independently with very similar parameters
to obtain a filtered list of files.
Consolidate those into a new `get_files()` function.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-11-29 01:40:33 +09:00
Carles Cufi 5fbfd72f9d scripts: compliance: Remove old TODO
This TODO doesn't seem to apply anymore based on its description, so
remove it altogether.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-11-29 01:40:33 +09:00
Carles Cufi bafec6bbde scripts: compliance: Remove unneeded workaround
The workaround for old pytest bug
https://github.com/PyCQA/pylint/issues/2906
is not required anymore after more than 3 years, so remove it.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-11-29 01:40:33 +09:00
Anas Nashif 808266a493 tests: use ignore_fault field instead of tags
Use dedicated field in the yaml file instead of mixing this testing
feature with tags.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-11-25 06:38:05 -05:00
Anas Nashif a90d711c7d twister: add simulation handler
Simplify the code a bit by introducing a simulator handler class.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-11-25 06:09:02 -05:00
Anas Nashif dae4720703 boards: native: mark as simulator
Mark native_posix platform as a simulator.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-11-25 06:09:02 -05:00
Anas Nashif 3bd819c09d twister: treat default platforms without a mean to run as any other
If a default platform is not able to run for whatever reason, treat it
as any other platform. Default platforms shall ALWAYS be runnable in CI,
or else we are just re-building for no good reason.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-11-25 06:09:02 -05:00