Commit graph

4650 commits

Author SHA1 Message Date
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