Commit graph

4744 commits

Author SHA1 Message Date
Jamie McCrae acd14f8af2 scripts: module: Fix sysbuild module listing
Fixes an issue with zephyr modules not being listed in sysbuild if
they did not have a Kconfig file set

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-04-29 14:57:22 +01:00
Arkadiusz Cholewinski a1cdf27610 CI: Fix coverage analysis
Add mps2/an385 and unit_testing to the simulator
criteria while parsing testsuites. Now the testsuit
will count as a simulator only where the platform
is quemu*, native*, unit_testing, mps2/an385.

Signed-off-by: Arkadiusz Cholewinski <arkadiuszx.cholewinski@intel.com>
2024-04-29 12:52:25 +02:00
Katarzyna Giądła fe5a5edfc8 twister: harness: pytest: Check exist of the runner_params
Pytest harness in Twister tries to get custom parameters to
the pytest harnesses. It is required although those do not exist
(e.g. Twister uses devices without hw map). This change checks
if the custom parameters to the pytest harnesses exists.

Fixes #71817

Signed-off-by: Katarzyna Giądła <katarzyna.giadla@nordicsemi.no>
2024-04-26 16:12:48 +02:00
Declan Snyder 5edc356d96 twister: Make --list-tests respect tag filter
Make the --list-tests and --tests-tree options outputs
respect the --tag and --exclude-tag options,
so that only the tests for the specified tags are listed.

Also update the TestPlan report testcases for this change.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-04-26 16:10:25 +02:00
Piotr Dymacz fc72f696fe west_commands: sign: imgtool: fix slot size readout
This fixes wrong slot selection when reading partition size. According
to the comment in code, 'slot1_partition' size should be preferred:

  [...] slot1_partition size is used, when available, because in
  swap-move mode it can be one sector smaller. When not available,
  fallback to slot0_partition (single slot dfu). [...]

This fixes a typo in the if statement which currently always results in
use of 'slot0_partition' size.

Fixes: 86c4b4caa9 ("west/sign: Move from using partition label property")
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2024-04-25 07:25:04 -04:00
Lukasz Mrugala ef792d1b9a scripts: twister: Fix duplicate scans
If the src_dir_path is a child of testsuite_path,
some c files might be scanned twice.

To prevent that, we check for parentage.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-04-24 09:34:32 -04:00
Dmitrii Golovanov 50db868b58 twister: footprint: Improve error handling at gather_metrics
Add error handling for 'gather_metrics' stage and separate
build issues from 'scripts/footprint/size_report' issues.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-04-24 09:52:57 +02:00
Lukasz Mrugala f99dc66d8e scripts: twister: Fix duplicate statusless testcases
In some cases, Twister would report twice the amount
of testcases run than expected, with half of them
lacking any status.

This change fixes erroneous ELF testcase name extraction,
which deleted every instance of 'test_' in the name,
rather than just the first.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-04-23 21:27:07 +00:00
Dmitrii Golovanov 978c0e4273 twister: testplan: Handle unknown test level
Fail a test run gracefully when an unknown test level
is requested to execute with the current test plan.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-04-23 15:31:50 +02:00
Nick Goote 0b8714bcde scripts: Improve gen_kobject_list.py variable address determination
The gen_kobject_list.py script looks at DWARF debug information in the
elf file to determine the address of variables. Make sure that when
looking at DW_FORM_exprloc, it looks at both DW_OP_addr and
DW_OP_plus_uconst.

Signed-off-by: Nick Goote <ngoote@gmail.com>
2024-04-22 15:21:47 -04:00
Christophe Dufaza 33bb3b60d9 edtlib: test filters set by including bindings
Make sure filters set by property-allowlist and property-blocklist
in an including binding are recursively applied to included bindings.

Signed-off-by: Christophe Dufaza <chris@openmarl.org>
2024-04-22 06:50:55 -07:00
Christophe Dufaza b3b5ad8156 edtlib: fix "last modified" semantic for included property specs
Although the PropertySpec.path attribute is documented as
"the file where the property was last modified",
all property specs in Binding.prop2specs will claim
they were last modified by the top-level binding itself.

Consider:
- I1 is a base binding that specifies properties x and y
- I2 is an "intermediate" binding that includes I1,
  modifying the specification for property x
- B is a top-level bindings that includes I2,
  and specifies an additional property p

When enumerating the properties of B,
we expect the values of PropertySpec.path to tell us:
- y was last modified by I1
- x was last modified by I2
- p was last modified by B

However, the Binding constructor:
- first merges all included bindings into the top-level one
- eventually initializes specifications for all the defined properties

As a consequence, all defined properties claim they were last modified
by the top-level binding file.

We should instead:
- first, take into account their own specifications for the
  included properties
- eventually update these specifications with the properties
  the top-level binding adds or modifies

Signed-off-by: Christophe Dufaza <chris@openmarl.org>
2024-04-22 06:50:55 -07:00
Christophe Dufaza 70eaa61cb0 edtlib: test "last modified" semantic for included property specs
Make sure the property specs answered by the Binding.prop2specs API
do not all claim (PropertySpec.path) they were last modified
by the top-level binding.

Signed-off-by: Christophe Dufaza <chris@openmarl.org>
2024-04-22 06:50:55 -07:00
Marcin Niestroj 8654daeebd twister: pytest: use runner_params from hardware map YAML file
Use 'runner_params' specified in hardware map YAML file. This allows to
configure custom params (like openocd's adapter configuration for
FT232-based probe) when used with pytest harness.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-04-20 13:45:44 -04:00
Bartlomiej Buczek 0b076a93ca twister: pytest: hardware_adapter: adapt to nrfutil.
add --dev-id to flashing command also when nrfutil runner is used.

Signed-off-by: Bartlomiej Buczek <bartlomiej.buczek@nordicsemi.no>
2024-04-20 13:44:24 -04:00
Martin Åberg c4766f9572 scripts/checkpatch: Improve blank line check after declarations
This adds volatile type qualifier to the struct declaration matching
when looking for blank line after declarations.

Before this commit, this structure was not accepted by chheckpatch:
  struct cfg {
         struct gpio_driver_config common;
         volatile struct grgpio_regs *regs;
         int interrupt;
  };

checkpatch.pl generated the following warning:
  -:158: WARNING:LINE_SPACING: Missing a blank line after declarations
  #158: FILE: drivers/gpio/gpio_grgpio2.c:27:
  +	struct gpio_driver_config common;
  +	volatile struct grgpio_regs *regs;

With this commit, the warning is no longer generated.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2024-04-19 17:03:49 +00:00
Benjamin Cabé 9ebf341977 west: spdx: introduce support for SPDX 2.3
Minor update to existing zspdx implementation to add support for
PrimaryPackagePurpose introduced in SPDX 2.3.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-04-16 10:07:49 -07:00
Lukasz Mrugala a0d1b778a4 scripts: twister: Fix overbroad Mock in environment unit tests
os.path.abspath was mocked too broadly, leading to errors for some users,
while being undetected in the CI.
This change narrows down the mock effect, fixing the problem.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-04-15 16:25:51 +02:00
Théo Battrel 4a30aab2ae ci: compliance: Update Kconfig check
Take into account the Kconfig symbols in tests and samples that are
defined using the logging template.

This avoid using the `UNDEF_KCONFIG_WHITELIST` for those symbols.

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

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-04-13 07:17:45 -04:00
Aleksandar Cecaric 0144ed6b63 arch: riscv: update coredump for 64BIT RISCV
Add RISCV 64bit registers and parse them in coredump script.

Signed-off-by: Aleksandar Cecaric <aleksandar.cecaric@nextsilicon.com>
2024-04-13 07:03:23 -04:00
Alberto Escolar Piedras 1fcc245eda native_simulator: Get latest from upstream
Align with native_simulator's upstream main
6f6b359c4fe26ddeed8a65ad55f5bc402d3b7f91

Which includes:
* 6f6b359 Avoid issue with llvm address sanitizer

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-04-12 15:03:35 +02:00
Michal Smola 7bf2d8ff46 twister: fix NXP hw detection in hardware map
Some NXP boards are not detected by twister when creating hardware map,
because manufacture name is NXP instead of NXP Semiconductors expected
by twister.
Fix it by adding NXP to manufacturers list.

Signed-off-by: Michal Smola <michal.smola@nxp.com>
2024-04-12 08:44:41 -04:00
Miika Karanki 67de8d58ec scripts: logging: support native_posix dictionary logging
- Do not look CONFIG_* symbols from dynamic symbols which might
  be there before the symbol table where CONFIG_* symbols are found.

- Define posix architecture in ARCHS list.

- Check if architecture is not found instead of letting the code
  run into trying to access dictionary with None key.

Signed-off-by: Miika Karanki <miika.karanki@vaisala.com>
2024-04-12 11:54:18 +02:00
Jonathan Rico 55533bc607 scripts: Add APP_LOG_LEVEL_DBG
Someone should really fix this properly..

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-10 07:43:41 -04:00
Anas Nashif 66af7a6881 gitlint: do not allow treewide as an area in commit messages
Treewide changes touching a single area or topic should have the
area/subsystem at the start of the commit message. Treewide is very
ambigous.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-04-10 09:22:24 +02:00
Peter van der Perk 46cb2ad7c0 west: add teensy loader test
Adds test import for teensy_loader runner

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2024-04-09 11:07:21 +02:00
Peter van der Perk 197a0f39fb teensy: add west flash teensy_loader_cli integration
Adds loader, and flash target for teensy boards

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2024-04-09 11:07:21 +02:00
Sylvio Alves e587249704 soc: espressif: esp32: update to hal_espressif v5.1
Modify and reorganize SoC to meet updated hal.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2024-04-05 13:39:53 +02:00
Dmitrii Golovanov 300507d43b twister: blackbox: pylint no-name-in-module warnings
Ignore no-name-in-module pylint warnings.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-04-04 17:01:55 +02:00
Dmitrii Golovanov a8eaa401a6 twister: blackbox: Fix test_output time-sensitive asserts
Exclude time-sensitive log entries at `test_output` to avoid
false negatives comparing build logs.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-04-04 17:01:55 +02:00
Dmitrii Golovanov 2ef6b98b98 twister: footprint: Improve command-line arguments
Improve Twister command line arguments for memory footprint:

 * group and order footprint arguments meaningfully,
 * clearer help descriptions,
 * resolve logical inconsistences for combinations of arguments,
   in particular:
   `--last-metrics` now forces `--enable-size-report`,
   `--show-footprint` now controls only detailed log output of
       footprint deltas in comparison modes.
 * align twister tests accordingly.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2024-04-04 17:01:55 +02:00
Fabio Baltieri fec3cee0bb scripts: set_maintainer: add log messages for skipped collabs
Refactor the skip collaborator logic to add log messages when a
collaborator is skipped because they self removed of not part of the
org.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-04-04 11:14:42 +01:00
Lukasz Mrugala 2c722f97b5 scripts: pylib: twister: Remove unused Twister flags
Deletes 4 Twister flags that were unusable:
* --enable-asserts
* --disable-asserts
* --no-skipped-report
* --error-on-deprecations

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-04-03 12:24:17 -05:00
Patryk Kuniecki d8b368a160 scripts: tests: twister_blackbox: Add test_ignore_platform_key
Add new tests to test_filter.py in blackbox twister testing

Signed-off-by: Patryk Kuniecki <patryk.kuniecki@intel.com>
2024-04-03 10:34:35 +02:00
Daniel DeGrasse 1254092831 scripts: west_commands: linkserver: fix probe serial number support
With commit f419ea7990 (runner: linkerserver : remove the probe ID
hardcode), support was added to use serial numbers with the linkserver
--probe argument. However, one invocation of the argument was missed,
and still used the "probe index" syntax. Resolve this issue.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-04-02 21:01:58 -04:00
Marcin Niestroj 8f9c28282b twister: pytest: escape expected command regex
When sending commands containing something like "AT+CFUN" the expected
regex was not escaped and as a result such regex never matched what has
been echoed over serial.

Escape all commands with re.escape() so that echoed shell commands are
always matched, even when they contain special characters (like '+' in the
example above).

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-04-02 13:28:05 -04:00
Lukasz Mrugala 2302e5f766 scripts: tests: Move bbox platform tests to a single file
Blackbox tests related to platform choice
now moved to test_platform.py:
* test_emulation_only
* test_exclude_platform

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-31 17:37:09 -04:00
Lukasz Mrugala 2f97795360 scripts: tests: Blackbox test expansion - platform
Adds tests related to the Twister's platform selection:
* -A, --board-root
* -K, --force-platform
* -p, --platform

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-31 17:37:09 -04:00
Kamil Paszkiet 717fccaa09 scripts: tests: Blackbox test expansion - device
Adds tests related to device flags:
--seed

Signed-off-by: Kamil Paszkiet <kamilx.paszkiet@intel.com>
2024-03-29 15:07:38 +00:00
Artur Wilczak 6d8132c445 scripts: tests: Blackbox test expension - disable
Add test related to disable-suite-name-check flag

This flag disabling extended test suite name verification at
the beginning of Ztest test. This option could be useful for tests
or platforms, which from some reasons cannot print early logs.

Add test related disable-warnings-as-errors

Do not treat warning conditions as errors.

Signed-off-by: Artur Wilczak <arturx.wilczak@intel.com>
2024-03-29 15:07:19 +00:00
Maciej Dubiel d076962f73 twister: ut for config_parser.py
initial commit

Signed-off-by: Maciej Dubiel <maciejx.dubiel@intel.com>
2024-03-29 15:06:44 +00:00
Javan lacerda dbfc1aaec6 scripts: dts: update pyyaml version
The currently used PyYaml version has some vulnerabilies as
described on the pull request description. It updates to
version 6.0, removing these supply chain vulnerabily.
The OSSF Scorecard was the tool used for discovering
 these vulnerabilties.

Signed-off-by: Javan lacerda <javanlacerda@google.com>
2024-03-29 09:03:34 -04:00
Tristan Honscheid 36ad49bd65 twister: Remove ANSI sequences before writing to handler.log
ANSI color is great for viewing output in a terminal, but currently it
also gets written out to the `handler.log` file. Text editors usually
don't render these, resulting in a hard-to-read file with a lot of
gibberish interspered. This commit strips ANSI sequences from lines
before writing them to the handler log file. This change does not
affect what is printed in Twister's console output, so one would still
see the colors there.

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2024-03-28 06:50:55 -04:00
Daniel Leung f05111dea0 kernel: rename Z_KERNEL_STACK_LEN to K_KERNEL_STACK_LEN
Since there is a K_THREAD_STACK_LEN, its kernel counterpart
should also be prefixed with K_ for consistency.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-03-27 19:27:10 -04:00
Hake Huang f419ea7990 runner: linkerserver : remove the probe ID hardcode
linkserver is hardcoded to probe ID, now with #70343 merged
the probe ID restriction can be removed.

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2024-03-27 15:19:15 +00:00
Jordan Yates 5c8f357f61 west_commands: sign: suppress imgtool prints
If `args.quiet` is set, suppress the useless `print` statements output
by `imgtool` (mcuboot script) by capturing `stdout`.

Old output:
```
[44/44] Linking C executable zephyr/zephyr.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:      415192 B       824 KB     49.21%
             RAM:      163124 B       256 KB     62.23%
        IDT_LIST:          0 GB         2 KB      0.00%
image.py: sign the payload
image.py: sign the payload
```
New output:
```
[44/44] Linking C executable zephyr/zephyr.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:      415192 B       824 KB     49.21%
             RAM:      163124 B       256 KB     62.23%
        IDT_LIST:          0 GB         2 KB      0.00%
```

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2024-03-27 15:18:23 +00:00
Arkadiusz Cholewinski 370dadbdab CI: Fix coverage analysis.
Fix for parsing testplan.

Signed-off-by: Arkadiusz Cholewinski <arkadiuszx.cholewinski@intel.com>
2024-03-27 14:32:53 +00:00
Kamil Paszkiet fff833eda4 scripts: tests: Blackbox test expansion - filter
Adds tests related to filter flags:
--arch
--vendor

Signed-off-by: Kamil Paszkiet <kamilx.paszkiet@intel.com>
2024-03-27 14:31:43 +00:00
Ederson de Souza 62b19ef65c syscalls: llext: Export z_impl symbols so they are available to kernel
commit 67bb6db3f8 ("syscall: Export all emitted syscalls, enabling
them for extensions") exports all emitted syscalls, however, it does
that only for the `z_mrsh` symbols, effectively only available for
userspace. If an extension running at kernel level tries to use a
syscall, it will fail to load.

This patch fixes that by exposing the `z_impl` symbols instead. However,
this is not as straightforward as the `z_mrsh` ones. As, in their
signatures, they can basically contain any type, it's not just a matter
of emitting `EXPORT_SYMBOL(z_impl_<syscall>)`, as the compiler will
complain about the undefined types. Here, there are a few approaches.

One of them is to have the `EXPORT_SYMBOL` being generated on the same
files where the syscall is implemented - injecting it there would allow
it to access all known symbols. But changing a lot of files is
undesirable, and it was one of the nice points of first patch.

Another one would be to reconstruct - or simply use the absolute path -
for the includes where the syscalls are defined. Reconstruct the paths
seems fragile and I'm not sure using absolute paths is portable.

Finally, the approach used in this patch is to declare, on a different
generated file, all `z_impl_` symbols as `void *` - after all, only the
address (and the name) to the function is relevant to EXPORT_SYMBOL. By
living in an compilation unit that doesn't include any header which
would expose any of the syscalls, there shouldn't be any conflicts. And
to account for the possibility that a syscall is not compiled - due
being configured out via Kconfig - all those symbols are also weak
aliases to a pointer to NULL. This file is then included in
`llext_export.c` (which should naturally not include any conflicting
header).

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-03-26 19:31:56 -04:00
Lukasz Mrugala 3fb11e260a scripts: tests: Blackbox test expansion - addon
Adds tests related to the addon flags:
*     --enable-ubsan
*     --enable-lsan
*     --enable-asan
*     --enable-valgrind
*     --allow-installed-plugin
*     --pytest-args
* -x, --extra-args
* extra test args for the binary

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-26 18:08:31 -05:00
Kamil Paszkiet ff5780fcc7 scripts: tests: Blackbox test expansion - coverage
Adds tests related to coverage flags:
--gcov-tool
--coverage-platform

Signed-off-by: Kamil Paszkiet <kamilx.paszkiet@intel.com>
2024-03-26 18:08:02 -05:00
Alberto Escolar Piedras f9e3084daf scripts/checkpatch: Limit which feature test macros we prevent
Unfortunately this check as it is today is causing trouble, while
not checking too well for what it intended. Let's reduce its scope
until a better solution has been found.

Background:
This check intends to ensure coding guidelines Rules A.4 and A.5
are followed, but how it is implemented it does not work well enough.
1. These rules only apply to the kernel and some other parts of the
embedded codebase respectively, but this check is performed on the
whole tree.
2. This check works under the assumption that any attempt to set
these macros in source files is a violation of these rules, while
this is not necessary the case, as there are legitimate uses for these.
(Specially for _POSIX_C_SOURCE and _XOPEN_SOURCE)

This check also fails to detect these macros being set in cmake files,
so if users are faced with this failure they can trivially bypass it.

Having a CI check which produces too many false positives, while
at the same time being very easy to bypass is not a desirable situation
as that can result in lack of trust for this type of checks,
and an overall tendency to override these CI faults,
and overlooking actual violations of these rules by reviewers.

This check was originally added in
b021dece98

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-26 16:21:02 -04:00
Grzegorz Swiderski 9dabce43d2 scripts: Ignore duplicate roots in list_boards/hardware
When iterating over `--arch-root`, `--board-root`, and `--soc-root`,
treat them as collections of absolute paths with no repeats, to ensure
that no input root has to be handled more than once.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2024-03-26 16:20:08 -04:00
Torsten Rasmussen 88d8b23836 scripts: remove board name from the qualifiers in list_boards.py
Fixes: #69329

The board name was printed as part of printing board qualifiers because
those was being concatenated in the `board_v2_qualifiers()` method.

Keep the qualifiers separated from the board name and let the caller
concatenate the strings when required.

Completion scripts are also updated to handle the corrected behaviour.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
(cherry picked from commit 66b475a3aa)
2024-03-26 16:20:08 -04:00
Lukasz Mrugala fd063d6ae5 scripts: tests: Move --ninja test to test_tooling
Brings the previously-created --ninja test to its test section file.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-26 11:15:41 -05:00
Lukasz Mrugala 8a54236d0b scripts: tests: Blackbox test expansion - tooling
Adds tests related to the Twister tooling:
* -j, --jobs
*     --force-toolchain

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-26 11:15:41 -05:00
Kamil Paszkiet 2a4332ba5f scripts: tests: Blackbox test expansion - error
Adds tests related to filter flags:
--overflow-as-errors

Signed-off-by: Kamil Paszkiet <kamilx.paszkiet@intel.com>
2024-03-26 11:10:02 -05:00
Hessel van der Molen 17d2906cca scripts/size_report: display object address in overview
Shows RAM/ROM address of object in RAM/ROM-report.

Signed-off-by: Hessel van der Molen <hvandermolen@dexels.com>
2024-03-26 10:49:04 -04:00
Kevin ORourke 98aa10d6ea scripts: coredump: coredump_gdbserver in pipeline
Add support to coredump_gdbserver.py for running in a pipeline,
communicating through stdin/stdout instead of a socket.

This allows starting it from inside gdb, with:

    target remote | coredump_gdbserver.py --pipe <elf_file>  <log_file>

Signed-off-by: Kevin ORourke <kevin.orourke@ferroamp.se>
2024-03-26 08:51:49 -04:00
Hake Huang 7058c2283f twister: unify test scenario path to backslash
Winodws user may use the `\` as path, but in twister we use the common `/`
as path separated, to avoid the mis-use, convert it to `/` in twister
first normpath, and then replace the os.sep

tested by:

For Linux Like:
west twister -p disco_l475_iot1 -s samples/hello_world/...

For Windows:
west twister -p disco_l475_iot1 -s samples\hello_world\...

fixing: #70310

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2024-03-26 08:48:13 -04:00
Lucas Tamborrino d65b6bc199 twister: add flash-before option
Add option to flash board before attach serial.

Current implementation performs the following sequence:

1. Open serial port to listen to board log output
2. Flash device

In case of ESP32 where it uses the same serial port
for both operations, flashing needs to come first.

This PR adds a twister option named --flash-before
which enables the process above, allowing tests to be
performed properly.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2024-03-25 18:37:49 -04:00
Luca Burelli 5800c53b3e twister: tests: add "no platform" test case for --device-testing
Add a test case for --device-testing without a platform specified.
Also adjust the error message to match current code.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-03-25 16:18:05 +01:00
Luca Burelli 568f754f59 twister: fix platform len check for device-testing
For using --device-testing with --device-serial or --device-serial-pty
it is necessary to provide the platform to be used for testing.
Not specifying a platform or specifying more than one is an error.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-03-25 16:18:05 +01:00
Lukasz Mrugala ccd3612575 scripts: tests: Remove test_harness straggling dirs
Current test_harness after its expansion leaves straggling
mock_platform directory. This fixes that error.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-25 16:17:32 +01:00
Michal Smola 0f5c08548a twister: qemu: fix mps2_an521 on Windows
tfm_integration samples fail on Windows on mps2_an521 platform,
because output from ninja process running QEMU freezes in re-build
phase.
Fix it by implementing named pipes to read output from QEMU process
directly using os.open and os.read methods.

Signed-off-by: Michal Smola <michal.smola@nxp.com>
2024-03-22 15:59:21 -04:00
Alberto Escolar Piedras 37a1d28a36 Revert "scripts: remove board name from the qualifiers in list_boards.py"
This reverts commit 66b475a3aa.

This commit has broken CI. Let's revert it.
See https://github.com/zephyrproject-rtos/zephyr/issues/70614

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-22 17:28:23 +01:00
Torsten Rasmussen 66b475a3aa scripts: remove board name from the qualifiers in list_boards.py
Fixes: #69329

The board name was printed as part of printing board qualifiers because
those was being concatenated in the `board_v2_qualifiers()` method.

Keep the qualifiers separated from the board name and let the caller
concatenate the strings when required.

Completion scripts are also updated to handle the corrected behaviour.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-03-22 12:42:49 +00:00
Torsten Rasmussen 1497104de4 unittest: update unittest to hwmv2
Follow-up: fe25709a9c twister: add unit_testing soc and board

Moving the soc.yml and board.yml to subsys/testsuite tree.
Introduce subsys/testsuite/arch/archs.yml with unit_testing arch.

Update the Zephyr CMake module unittest.cmake to include HWMv2 and
reorder includes to follow same order as zephyr_default.cmake.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-03-22 11:51:58 +01:00
Torsten Rasmussen fd772f8e77 scripts: remove boards_legacy sub-folder from list_boards.py
Fixes: #69785

The boards_legacy sub-folder was temporarily introduce in collab-hwm
branch during porting to HWMv2.

This should have been removed before merging collab-hwm to main as it
prevent looking up boards in oot roots.

Removing the temporary sub-folder for HWMv2.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-03-22 11:51:58 +01:00
Anas Nashif f73af06f2b twister: better help for --no-update option
Add some more details to the --no-update option.

Fixes #70173

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-03-22 10:24:22 +01:00
Alberto Escolar Piedras 11e9c71059 twister bsim harness: Fix for hwmv2 platfrom names
The new hwmv2 platform names have "/" and "@" in
their names, we need to replace those with "_".
Otherwise the harness will produce a FileNotFoundError
exception when trying to create the executable.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-22 10:23:52 +01:00
Jamie McCrae a43029418c scripts: kconfig: Add substring function
Adds a substring function

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-03-21 20:10:46 +01:00
Torsten Rasmussen 732c504e4c terminology: adopt CMake, python, and Kconfig code to use qualifiers
Followup: #69905

Adopting new board terminology for CMake, python, and Kconfig code to
use qualifiers instead of identifiers.

Also adjusted to board target where applicable.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-03-21 15:32:17 +01:00
Piotr Kosycarz c3b96ffbab scripts: twister: handlers: pass dev-id for nrfutil
Needed to distinguish boards.

Signed-off-by: Piotr Kosycarz <piotr.kosycarz@nordicsemi.no>
2024-03-20 16:52:39 +00:00
Ederson de Souza 67bb6db3f8 syscall: Export all emitted syscalls, enabling them for extensions
Linkable loadable extensions can only use syscalls if they are exported
via EXPORT_SYSCALL (or EXPORT_SYMBOL). Instead of enabling used syscalls
one by one, this patch exports all of them automatically via
`gen_syscalls.py`. If CONFIG_LLEXT=n, the section where the exported
symbols live is discarded, so it should be a non-op when llext is not
enabled.

This patch also removes the now redundant EXPORT_SYSCALL macro. Note
that EXPORT_SYMBOL is still useful on different situations (and is
indeed used by the code generated by `gen_syscalls.py`).

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-03-20 16:26:54 +00:00
Alberto Escolar Piedras f532937e92 tests|scripts/net: Change native_posix references to native_sim
* As we are replacing native_posix with native_sim, let's
  refer to native_sim instead of native_posix in the comments
  of why we have 1 extra interface.

* scripts/net/run-sample-tests.sh builds for native_sim now,
  not native_posix => let's fix it

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-20 15:43:05 +01:00
Gerard Marull-Paretas 78706dffdb scripts: west_commands: runners: nrf_common: update nRF54H support
nRF54H can only be flashed using nrfutil now, so some workaround present
in the nrf_common module are no longer needed, e.g. UICR erasing.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-03-20 11:35:47 +01:00
Gerard Marull-Paretas acc0a43fb9 scripts: west_commands: runners: nrfutil: provide live feedback
nrfutil runner uses the batch-mode, so no live feedback is provided to
the user. However, batch-mode reports batch progress containing
human-readable strings of the operation being done. This patch changes
the _exec() implementation to parse the subprocess output in real-time,
logging to info the 'batch_update' reports. Note that only the first
batch update of a sequence (percentage = 0) is logged because first,
percentage resolution seems to be pretty bad, and, because logging
messages cannot be easily _appended_.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-03-20 11:35:47 +01:00
Gerard Marull-Paretas 0387214bfc scripts: west_commands: runners: nrfutil: use x-execute-batch
execute-batch is now named x-execute-batch, as it is an experimental
option.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-03-20 11:35:47 +01:00
Gerard Marull-Paretas 7bea89ac44 scripts: west_commands: runners: nrfjprog: drop nRF54H support
nRF54Hx series is no longer supported in nrfjprog. nrfutil is now
required.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-03-20 11:35:47 +01:00
Torsten Rasmussen c531e4c2ac scripts: test for imported ELFFile instead of setting it to None
mypy fails with:
Incompatible types in assignment
        (expression has type "None", variable has type "Type[ELFFile]")

this happens because of the code:
    try:
        from elftools.elf.elffile import ELFFile
    except ImportError:
        ELFFile = None

ELFFile is set to None to allow later code to check if ELFFile was
imported by checking against None. Instead of setting ELFFile to None,
then update testing code to check if the class has been loaded, as:
    if globals().get('ELFFile') is None:

Update the try-catch to `pass`.

Removed ELFFile cargo cult from intel_cyclonev.py and fix pylint
warnings.

Disable duplicate code check. The intel_cyclonev.py is already based
upon openocd.py, so although the duplication detection is correct then
this should not prevent other code changes / fixes to those files from
being applied.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-03-20 09:59:27 +01:00
Hake Huang decf714f7a twister: add linkserver support with hardwaremap
in hardwaremap the dev-id is used to select debug probe
and linkserver accept the --probe. so and this support

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2024-03-19 21:13:08 -05:00
Anas Nashif 313d135cb2 twister: do not use non-existing architectures
Do not use non-existing architectures, we now have an enum in the
schema.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-03-19 18:28:06 -04:00
Alberto Escolar Piedras a4b0e8a706 twister tests: Let's use native_sim instead of native_posix
native_posix is being replaced with native_sim, let's
use native_sim instead in twister tests.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-19 13:15:48 -05:00
Filip Kokosinski 053e5f93ac twister: use enum for the arch field in Twister platform schema
This commit adds an enum to the `arch` field of the Twister platform
schema. This helps better filter boards for testcases which use
architecture-based filters, and helps maintain uniformity in naming
convetion.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2024-03-19 07:55:58 -04:00
Maciej Perkowski 5af2140927 twister: Use proper warnings-to-errors command for sysbuild
If sysbuild is used a flag SB_CONFIG_COMPILER_WARNINGS_AS_ERRORS
has to be used in order to turn warings to errors on all images.
Align pytest tests with the change.

Fixes: #67360

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2024-03-18 15:41:53 +01:00
Glenn Andrews bc55924004 twister: qemu: Fix device tests skipped when QEMU not installed
https://github.com/zephyrproject-rtos/zephyr/pull/67595
introduces a bug where if QEMU_BIN_PATH is not set on a Windows
PC, on-device tests are skipped. This fixes that issue.

Signed-off-by: Glenn Andrews <glenn.andrews.42@gmail.com>
2024-03-15 06:29:05 -04:00
Marc Herbert 251f52cbce list_hardware.py: sort rglob(SOC_YML) HWMv2 results
This makes .config, autoconf.h, and configs.c deterministic again.

Directory listing is not deterministic, it must always be sorted.
https://reproducible-builds.org/docs/stable-inputs/

Fixes commit 61bbfb5ba25f ("scripts: introduce list_hardware.py for
listing of architectures and SoCs") in collab-hwm branch which was
squashed in mega HWMv2 commit 8dc3f85622 ("hwmv2: Introduce Hardware
model version 2 and convert devices")

SOF CI builds with both Windows and Linux and compares the outputs. This
catches practically 100% of build reproducibility issues and caught this
one too:

 https://github.com/thesofproject/sof/actions/runs/8241692987/job/22539664560

HWMv2 was a "big bang" integration on both the Zephyr and SOF sides. So
this `rglob()` was a needle in a haystack but with hindsight, this issue
is really trivial to reproduce and verify:

```
apt-get install disorderfs
mkdir disorderedWorkspace/
disorderfs --shuffle-dirents=yes  workspace/ disorderedWorkspace/
```

... then just build `samples/hello_world/` twice in disorderedWorkspace/
with any --board and compare the build directories.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-03-13 11:16:21 +00:00
Kamil Paszkiet c63ad6c915 scripts: tests: Blackbox test expansion - coverage
Adds tests related to coverage flags:
--coverage-tool
--coverage-basedir
--coverage-formats

Move to coverage.py:
--coverage
--enable-coverage

Signed-off-by: Kamil Paszkiet <kamilx.paszkiet@intel.com>
2024-03-13 11:09:59 +00:00
Anas Nashif 35176b993d twister: fix exception message
'Handling of handler...' is a bit weird to read.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-03-13 08:39:37 +01:00
Anas Nashif dbc3246723 tests: twister: use assert_called_with for multiple calls
Do not use assert_called_once_with, we can some functions more than once
and test should not prevent that.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-03-13 08:39:37 +01:00
Anas Nashif 6eb3c2e4c1 twister: harness: match exact charachters when we detect tests
Avoid detecting garbage.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-03-13 08:39:37 +01:00
Anas Nashif 233b2e1100 twister: handler: update missing status of failed tests
Some tests report no status even without timeout, so address this case
as well.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-03-13 08:39:37 +01:00
Anas Nashif be60134421 west: add native_sim flash, debugserver command
Add 'west flash' support which in the case of native_sim just start the
built application.
Reuse existing runner and rename it to be more generic as it does more
than just debugging now.

Also add debugserver command.

Fixes #36706

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-03-12 12:57:18 -04:00
Patryk Kuniecki a10b842991 scripts: tests: twister_blackbox: Add test test_verbose.py
Add new test to twister blackbox tests

Signed-off-by: Patryk Kuniecki <patryk.kuniecki@intel.com>
2024-03-11 21:11:17 -05:00
Lukasz Mrugala 36c12482c6 scripts: tests: --package-artifacts fix, blackbox tests
Requirements added for bz2.
Blackbox test for --package-artifacts added.
package.py no longer includes twister-out no matter the outdir.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-11 16:12:55 -04:00
Jamie McCrae b680a6ec72 scripts: snippets: Fix path output on windows
Fixes an issue with paths being output in windows-style with back
slashes, this causes issues for certain escape sequences when
cmake interprets them. Replace these paths with posix paths so
that they are not treated as possible escape sequences.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-03-11 07:57:14 -04:00
Benjamin Cabé cb26820c51 hwmv2: scripts: handle Kconfig sources in a Windows compatible way
Move away from os.join.path and only rely on pathlib magic, and serialize
all paths using POSIX path separators.
This fixes documentation build and compliance check script on Windows.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-03-08 15:19:04 +00:00
Lyle Zhu 40cf23daff Bluetooth: Rename BT_BREDR to BT_CLASSIC
Rename BT_BREDR to BT_CLASSIC
Rename CONFIG_BT_BREDR to CONFIG_BT_CLASSIC

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-03-07 11:26:45 +02:00
Anas Nashif e10665531f spelling: add enabeld typo
add typo of enabeld.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-03-06 19:27:28 -05:00