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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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)
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>
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>
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>
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>
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>
Current test_harness after its expansion leaves straggling
mock_platform directory. This fixes that error.
Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
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>
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>
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>
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>
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>
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>
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>
* 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>
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>
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>
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>
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>
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>
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>
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>