Commit graph

4571 commits

Author SHA1 Message Date
Marc Herbert a65b8d40fb west: sign.py: always log the rimage command
rimage is very verbose by default and has no -q(uiet) option, so saving
one line out of more than 100 lines is pointless.

RimageSigner.sign() was already very complex and suffering from
combinatorial explosion of parameters. With .toml
pre-processing (#65411) it's getting worse, so we really need all build
logs to show the complete rimage command.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-12-15 14:41:36 +01:00
Marc Herbert c13cf99f2a west: sign.py: recommend separator -- tool_args always
In the following command, the first argument `for_rimage` is passed to
`rimage` whereas `--for west` goes to west.

```
west sign  for_rimage --for west
```

This is somehow valid but we really don't want anyone to do that.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-12-15 14:41:36 +01:00
Marc Herbert dbc4b2ed4e west: sign.py: extract new method RimageSigner.rimage_config_dir()
Zero functional change, preparation for the .toml modularization.

RimageSigner.sign() is also way too long and too complex and this helps.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-12-15 14:41:36 +01:00
Marc Herbert 039e5ef1b8 intel_adsp: remove rimage sign() from west flash
`west sign` has been invoked by `west build` (through CMake) since
commit fad2da39aa, almost one year ago. During that time, this new
workflow has been refined and successfully used by at least two vendors,
multiple CIs across both SOF and Zephyr and many developers.

At the time, the ability to sign from `west flash` was preserved for
backwards compatibility. This means rimage parameters can come from many
different places at once and that rimage can be invoked twice during a
single `west flash` invocation!

Now that Zephyr 3.5 has been released, we need to reduce the number of
rimage use cases and the corresponding validation complexity and
maintenance workload to simplify and accelerate new features like
splitting rimage configuration files (#65411)

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-12-15 14:41:36 +01:00
Jordan Yates ac78b97820 scripts: ci: guideline_check: support other repos
Support running this check against other repositories.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-12-15 14:38:02 +01:00
Fang Huang 15640611cf scripts: logging/dictionary/sys-t: remove escape between CDATA
This removes escape from generate XML_CATALOG_EACH string, because
the string between CDATA tag need to be treated as normal text.

Signed-off-by: Fang Huang <fang.huang@intel.com>
2023-12-15 14:34:15 +01:00
Lukasz Mrugala f473bd9be1 twister: testplan: Platform key checking rationalisation in apply_filters
Fixes #65477
Platform key checking seemed to be erroneous;
now the variable names, comments and code seem in line with each other.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-12-15 11:32:15 +00:00
Anas Nashif 7d2b3302eb twister: support lcov > 2.0
Support lcov > 2.0 tool which has strict error checking and some new
configuration options deprecating syntax used in 1.4 versions.

Fixes #62202

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-15 04:27:28 -05:00
Piotr Golyzniak 5a3b9799aa doc: test: improve pytest documentation
Improve documentation about pytest integration with Twister. Add
examples of usage, improve description of available options and
introduce automatic doc generation of two plugin classes (DeviceAdapter
and Shell) basing on their docstrings from source code.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2023-12-14 10:12:21 +01:00
Daniel Leung a819bfb2d5 xtensa: rename z_xtensa to simply xtensa
Rename the remaining z_xtensa stuff as these are (mostly)
under arch/xtensa.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-12-13 09:41:24 +01:00
Maciej Perkowski 2f7364fa0a twister: Refactor "skip to error" method
Use filter statuses instead of string matching in case of quarantine.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-12-12 19:09:01 +01:00
Maciej Perkowski 61dc683b71 twister: fix typo in filters.QUARANTINE
Fix typo filters.QUARENTINE to filters.QUARANTINE

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-12-12 19:09:01 +01:00
Joakim Andersson 25787e2df6 tfm: Harded build against TF-M built with unsecure keys
Introduce Kconfig option in zephyr build system that reflects the TF-M
cmake config variable with the same default value for dummy provisioning
and have it satisfy the IAK present requirement.
This configuration is not suitable for production, and by having this
in zephyr configuration we can have this as part of the hardened
configuration check.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2023-12-12 19:08:46 +01:00
Hake Huang 1dc43605df tests: testinstance: enforce utf-8 write
as in windows platfrom the format by default is not utf-8,
and we will see below error

Traceback (most recent call last):
  File "...zephyr\scripts\twister", line 211, in <module>
    ret = main(options)
          ^^^^^^^^^^^^^
  File "...scripts/pylib/twister\twisterlib\twister_main.py",
    tplan.load()
  File "...scripts/pylib/twister\twisterlib\testplan.py",
    self.load_from_file(last_run, filter_platform=connected_list)
  File "...scripts/pylib/twister\twisterlib\testplan.py",
    instance.create_overlay(platform, self.options.enable_asan,
        self.options.enable_ubsan, self.options.enable_coverage,
        self.options.coverage_platform)
  File "...scripts/pylib/twister\twisterlib\testinstance.py"
    f.write(content)
 UnicodeEncodeError: 'gbk' codec can't encode character '\xf8'
 in position 64: illegal multibyte sequence

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2023-12-12 15:03:11 +01:00
Anas Nashif bd227e19cf twister: ignore testplan filters for integration mode
Testplan filters should be ignored when evaluating correctness of
integration configuration.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-11 22:10:56 -05:00
Marc Herbert 352980be98 scripts/build: make struct_tags.json deterministic
It's not good to see struct_tags.json change from one build to the next
when nothing changes.

Python's sets are not deterministic, see long story for older commit
f896fc2306 ("scripts: gen_handles: Sort the device handles")

Simply convert multiple_directories to a sorted list before using it.

Fixes commit 80e78208e6 ("kernel: syscalls: no need to include all
syscalls in binary")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-12-11 09:51:22 +01:00
Piotr Kosycarz a3d0c63797 scripts: twister: testinstance: store run id between builds
Cache value of run id between builds.
Save it in file and later load during next build.

Signed-off-by: Piotr Kosycarz <piotr.kosycarz@nordicsemi.no>
2023-12-06 10:27:08 -05:00
Dmitrii Golovanov 47da4e2e76 twister: Improve recording at Harness
The Console Harness is able to parse its log with patterns to compose
extracted fields into records in 'recording.csv' file in the test's build
directory. This feature allows to extract custom test results like
performance counters.
With this change the extracted records are also written into 'twister.json'
as a part of each test suite object. This makes easier to store
all the data collected by the test for its further processing.

Other improvements:
 - compile parsing pattern only once instead of at each input line;
 - quote fields in '.csv' to avoid unexpected field separators;
 - make 'regex' a required schema field of 'harness_config';
 - Twister documentation update.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-12-06 10:26:35 -05:00
Daniel Leung f779385b59 scripts: get_maintainer: __init__ to use filename if passed
This changes the logic in __init__() so that if a path to
MAINTAINERS.yml is passed in, it uses the passed-in value
instead of blindly running git to find the top level of
Zephyr tree.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-12-06 12:11:57 +00:00
Fabio Baltieri ac5366c27d ci: compliance: keep-sorted: handle indented blocks
Change the keep-sorted check to handle blocks of code uniformly
indented.

Suggested-by: Benjamin Cabé <benjamin@zephyrproject.org>
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-12-06 09:30:55 +00:00
Dmitrii Golovanov 4318140ff5 twister: qemu: Fix race condition at QEMUHandler
A race condition was possible at QEMUHandler which didn't wait for
its harness to complete causing false negatives and test suite
retries, for example when the console harness has got rather
long output from a test application to check for patterns.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-12-05 10:20:30 +00:00
Zhang Peng a47aa23129 west: sign: add support for NXP i.MX8ULP board
Add support for signing i.MX8ULP SOF with Zephyr images with rimage.

Signed-off-by: Zhang Peng <peng.zhang_8@nxp.com>
2023-12-04 16:41:00 +00:00
Marc Herbert fb8d41b123 scripts/build/elf_parser.py: make dependency graph output deterministic
Python's sets are not deterministic.

`devices` were already sorted but `dev_supports` is still a
non-deterministic set. Sort dev_supports to make the graph output
deterministic.

Fixes commit 29942475c5 ("scripts: gen_handles: output dependency graph")

It is quite ironic that this initial and non-deterministic graph commit
was concurrent with and slightly delayed other commit
f896fc2306 ("scripts: gen_handles: Sort the device handles") which
fixed another, similar non-determinism issue in the same area. A true
"whack-a-mole"!

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-12-04 14:24:32 +01:00
Marc Herbert eea56d2080 scripts/build/elf_parser.py: add __lt__() method to base class
This allows sorting objects consistently without having to specific a
key.

No functional change yet.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-12-04 14:24:32 +01:00
Maciej Perkowski 690011498c twister: Add target reports in json format
Using --platform-reports will also generate json reports
with results from a single platform. Needed for on-target
results publishing process.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-12-02 07:50:50 -05:00
Alberto Escolar Piedras 188cdd95c5 twister tests: Replace native_posix with native_sim
As native_sim is replacing native_posix overall and
becoming the default test platform.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-30 09:42:25 -05:00
Ederson de Souza 10ec2b129c scripts/pylib/twister/twisterlib: Support multiple --pytest-args
One can not even replace sucessfully pytest basic sample `pytest-args`
with command line "--pytest-args", as all it does is to append a single
string to current list of commands, making it impossible to send several
arguments.

This patch fixes that by allowing several instances of `--pytest-args`
to compose the whole list of arguments to be passed to pytest.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2023-11-30 10:03:01 +01:00
Anas Nashif ffcf9c5987 twister: do not add a platform to keyed tests if previously filtered
If a platform is fitlered, do not add it to keyed test map, otherwise we
will end up skipping all platforms from the same class without any
coverage.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-30 10:02:52 +01:00
Jeppe Odgaard f74f309ec7 valgrind: Update POSIX soc no cpu cleanup suppression
Add `possible` to match-leak-kinds to prevent false positives caused by
POSIX soc no cpu cleanup.

The leak can be reproduced by adding CONFIG_NETWORKING=y to
tests/lib/cpp/libcxx/prj.conf and run twister:
twister -p native_sim -s tests/lib/cpp/libcxx/cpp.libcxx.host
--enable-valgrind

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2023-11-29 15:33:49 +01:00
Paszkiet Kamil 4c035af05c scripts: tests: twister_blackbox: Add test test_report.py
add test to test_report.py:
  -platform_reports
  -report_suffix
  -report_name
  -report_dir
  -outdir

Signed-off-by: Paszkiet Kamil <kamilx.paszkiet@intel.com>
2023-11-29 09:52:44 +00:00
Anas Nashif 0d535010cd twister: tests: adapt test for new option
mock build_dir of instance.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-28 14:48:03 +01:00
Anas Nashif d3af185acd twister: add --aggressive-no-clean option
Useful option during development and when applying smaller change to the
code and verifying changes using tests. This works fine as long as no
dependencies or major changes are done, i.e. when editing few files and
in a subsystem. Use with caution and use on your own risk :-)

When building multiple tests, this provide significant boost, up to 300%
faster than when rebuilding everything from scratch or when re-running
cmake every single time.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-28 14:48:03 +01:00
Seppo Takalo a8d56c4f1f net: scripts: Use native_sim instead of native_posix
Sample tests should also be using native_sim board.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-11-27 19:55:30 +01:00
Alberto Escolar Piedras 3d406a7a56 native_simulator: Get latest from upstream
Align with native_simulator's upstream main
ae241af736d06874ec02deb9aacb79918d745aba

Which includes:
* ae241af native timer_model: Allow calling into get_host_us_time

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-27 16:06:42 +00:00
Anas Nashif c696344f0d twister: tests: adapt tests for new behaviour in runner class
We have removed some return data and added build time to instance class.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-25 08:49:27 -05:00
Anas Nashif 2ba6bcf906 twister: measure build time and report it in json output
Measure both cmake and make/ninja build times and log them in debug mode
and additionally put the result in the json report for tracking build
times.

Cleanup what build/cmake function return and remove unused keys in the
result map.

Remove some excessive logging of launched jobs or default platforms that
gets in the way when in debug mode.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-25 08:49:27 -05:00
Yong Cong Sin ecb2df0444 scripts/checkpatch: add __unused to the $Attribute list
Add `__unused` to the `$Attribute` family along with its
`__maybe_unused`, `__always_unused` & `__used` brothers, so
that:

```c
__unused int ret;
```

is recognized as variable declaration, and doesn't raise
`LINE_SPACING` warning in CI.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-11-24 09:27:39 +00:00
Grzegorz Chwierut a1698b691d twister: pytest: Add --pytest-args to Twister command line
Extend Twister command line with --pytest-args. This parameter
is passed to pytest subprocess. It allows to select a specific
testcase from a test suite.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-11-23 10:03:11 +01:00
Alberto Escolar Piedras 71db6550cd native simulator: Get latest from upstream
Align with native_simulator's upstream main
7d652dbfb313260cf07d595ccf26638f2b3c2959

Which includes:
* 7d652db Provide macros for noreturn and unreachable & annotate

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-22 09:52:52 +01:00
Alberto Escolar Piedras 0ce4de8eec pytest sample & docs: Replace native_posix with native_sim
In the docs replace references to native_posix with native_sim
Switch the default test platform to native_sim from native_posix

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-20 12:02:48 +01:00
Benjamin Cabé 05e6e1ce15 scripts: sync spelling.txt with version from Linux kernel v6.7-rc1
Sync the spelling.txt file with a recent version of the one found in
Linux kernel.
List sorting was preserved (however inconsistent it might be) to
simplify future syncs.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-11-15 17:33:17 -05:00
Benjamin Cabé 78afda36f1 scripts: Add "the the" as a common typo in spellchecker
Somehow this is seems to be a very common typo. Adding it to spelling.txt
 to catch it as part of compliance check.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-11-15 17:33:17 -05:00
Paszkiet Kamil 7029c79ef2 scripts: tests: twister_blackbox: Add test test_hardwaremap.py
add tests to hardwaremap tests:
  - generate_hardware_map (different ways)

Signed-off-by: Paszkiet Kamil <kamilx.paszkiet@intel.com>
2023-11-15 10:01:33 +01:00
Wilfried Chauveau 2deea4eeee twister: Fix failure on MacOS
On MacOS, ps utils raises a `NoSuchProcess` error rather than a
`ProcessLookupError` when a pid no longer exists.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2023-11-15 10:00:08 +01:00
Anas Nashif 56f73bde0f ci: testplan: fix mcumgr path
fix path for mcumgr in tags.yaml, we were skipping tests due to wrong
path.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-14 17:49:40 -05:00
Fabio Baltieri 2171f8b7a1 ci: compliance: only run sorted check on text files
The sorted check code crashes on binary files. Add a check on file type
and only process text ones.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-14 15:05:56 +00:00
Dmitrii Golovanov 7d0d3f83cb twister: harness: Fix TestCase id at Console for Ztest
Implement a workaround for Console harness to compose TestCase
identifier correctly when a Ztest suite with a single testcase
uses this harness type. Normally, a Ztest suite should use the
Ztest Twister harness.
Without this workaround each Ztest TestCase result on Console is
duplicated (and written into twister.json) with its 'identifier'
attribute set to TestSuite id only, no TestCase suffix added;
the resulting entry with the full TestCase id is also stored,
but its values are empty with defaults.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-11-14 08:47:12 -05:00
Dmitrii Golovanov 00d260af96 twister: harness: Check Console harness configuration
If Console Harness 'harness_config' properties have no 'regex'
patterns or no correct 'type' set, then ConfigurationError exception
is raised, handled, and the test instance error is accounted
in the summary results.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-11-14 08:47:12 -05:00
Dmitrii Golovanov 8b6f447ef8 twister: harness: Fix Console unordered pattern matching for ztest
Fix the Twister Console harness unordered pattern matching
to treat the ztest as failed when not all of the
expected patterns were found in the console output, but the ztest
application itself reports 'PROJECT EXECUTION SUCCESSFUL'.

Unify debug logging on pattern match for ordered and unordered patterns.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-11-14 08:47:12 -05:00
Alberto Escolar Piedras d1e91686f3 twister: Replace native_posix with native_sim
* Replace native_posix references with native_sim
  in arguments help messages
* For the seed parameter, correct platform check to accept
  native_sim
* Use native_sim in twister tests

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-14 06:51:38 -05:00
Fabio Baltieri aa25fe06a5 ci: compliance: undef list few configs used in optional modules
The Kconfig check fails when running the script locally for undefined
symbols if the checkout does not include optional modules (the default
behavior). Add these symbol to the Kconfig undef list.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-14 09:24:03 +01:00
Jordan Yates 31200fb33d scripts: twister: config_parser: copy common values
Create copys of the common configuration values when constructing test
scenarios, to avoid mutating the common value with test specific
appends.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-11-13 09:53:16 +01:00
Yves Vandervennet 28c5b1d76d west: linkserver: update to reflect logging changes in 1.3.15
NXP released the linkserver update 1.3.15, which corrects an issue
with logging that by default went out to stderr when flashing.

Signed-off-by: Yves Vandervennet <yves.vandervennet@nxp.com>
2023-11-13 09:47:27 +01:00
Hake Huang dbed251249 test: twister: testplan.py use normpath
when load test plan it is possible the plan is built in another os
so the case key would be
'samples/hello_world/samples.baseic.hello_world'
but the testsuite is scaned in current os may in window
and the key is like
'samples\\hello_world\\samples.baseic.hello_world'

so update the uniq path with only backslash in path

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2023-11-13 09:42:50 +01:00
Fabio Baltieri 98d9a7f86f scripts: compliance: add a compliance check to keep blocks of code sorted
This allows defining a list within two marker (zephyr-keep-sorted-start
and zephyr-keep-sorted-stop), and have the CI validate that the block is
kept sorted every time stuff gets added to it.

This is mainly for Kconfig and CMake include lists so that there's no
ambiguity on where to add new stuff.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-13 09:41:05 +01:00
Yuval Peress 6bd0b54526 twister: Fix gtest harness
Some platforms prefix extra logging information before the standard
[] blocks so I've added `.\*` to the regex. Also, removed the static
values so they're only referenced using 'self.' and stopped parsing
lines after the FINISHED_PATTERN is matched since some versions of
gTest also print out a test summary after and it's not useful for
the processing.

Signed-off-by: Yuval Peress <peress@google.com>
2023-11-10 16:23:07 -05:00
Hake Huang cf053d07e3 test: twister: test_runner remove line number check in log
1. remove the line number check in test vector
2. log_info is not a static method anymore, change test

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2023-11-08 07:49:49 -05:00
Anas Nashif debe7fefe6 ci: assignees: do not set trivial on manifest changes
manifest changes are often a oneliner change, but they are not
necessarily trivial.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-06 12:11:58 -05:00
Lukasz Mrugala 670b917b4b scripts: tests: twister: Hardware map unit testing
This change creates unit tests for the hardwaremap.py module.
It achieves 98% coverage.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-11-06 10:08:44 +01:00
Grzegorz Chwierut e466b7ac26 twister: pytest: Improve reporting failed pytest scenarios
When pytest scenario fails, then 'handler.log' is printed.
Changed to print 'twister_harness.log' that is a log from
pytest execution. That file tells much more when test fails.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-11-04 07:39:31 -04:00
Dmitrii Golovanov 97fab83716 scripts: coverage: gcovr to ignore negative counters
Apply a workaround for an issue introduced with bc8b7dd
for code coverage collection at qemu_x86 when gcov data
was broken because of optimized out memcpy() in write_u64()
static inline function, so gcovr parser fails with
"gcovr.gcov_parser.NegativeHits: Got negative hit value
in gcov line 'branch  1 taken -1'".

Add gcovr command line option to ignore such errors (since v.6.0):
"--gcov-ignore-parse-errors=negative_hits.warn_once_per_file"

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-11-03 07:57:10 -04:00
Anas Nashif a08bfeb49c syscall: rename Z_OOPS -> K_OOPS
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif 1a9de05767 syscall: rename Z_SYSCALL_DRIVER_ -> K_SYSCALL_DRIVER_
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif 9c4d881183 syscall: rename Z_SYSCALL_ to K_SYSCALL_
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif c25d0804f0 syscall: rename z_object_find -> k_object_find
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif 27d74e95c9 syscall: rename z_object_wordlist_foreach -> k_object_wordlist_foreach
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif 4e396174ce kernel: move syscall_handler.h to internal include directory
Move the syscall_handler.h header, used internally only to a dedicated
internal folder that should not be used outside of Zephyr.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif a6b490073e kernel: object: rename z_object -> k_object
Do not use z_ for internal structures and rename to k_object instead.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Fabio Baltieri dd178ce311 scripts: check_init_priorities: rework the error messages
The current error messages are a bit cryptic, rework them to make them
more meaningful:

- add an extra message on the first error to explain what the errors
  refer to.
- rework the error message to be more explicit.
- rework the priority string print to use a LEVEL+offset format to
  somehow highlight that the number is the offset from the level, not
  the actual priority.
- print the init function name in addition to the devicetree path.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-03 11:45:23 +01:00
Fabio Baltieri 2a70c31945 scripts: check_init_priorities: drop the same priority check
Since bb590b5b6e introduced ordinals in the priority sequence, the "same
priority" case cannot happen anymore, furthermore the priority value in
the script is now the position of the function in the init sequence, so
if two devices have the same priority there's something real bad going
on.

Drop all the "same priority" handling code and tests, convert the case
into ane exception instead. Drop the init stubs as well from the test,
they are not required anymore.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-03 11:45:23 +01:00
Anas Nashif 85dd423468 twister: report: remove defunct and old option
--report-excluded has not been working for years, nobody has noticed.

Fixes #64644

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 09:59:49 +01:00
Anas Nashif 32f7570bb4 twister: report: remove dead code
Remove dead code for listing tests. This is covered already for the case
of --list-tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 09:59:49 +01:00
Anas Nashif 9571f1c502 twister: use correct variable for testcases
We use testcases now, not cases.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 09:59:49 +01:00
Mateusz Junkier 8bccb645aa boards: intel_adsp: fix board flashing
add missing declarations to work with ace15 board

Signed-off-by: Mateusz Junkier <mateusz.junkier@intel.com>
2023-11-03 09:56:08 +01:00
Carles Cufi 9cf07bbdb5 bluetooth: Rename rpmsg HCI driver and sample to ipc
The existing driver and sample:

- drivers/bluetooth/hci/rpmsg
- samples/bluetooth/hci_rpmsg

are no longer correctly named, since they now use the IPC subsystem to
send and receive data. The IPC subsystem can use RPMsg as a transport,
but that is one of several selectable backends.

I initially wanted to deprecated both the BT_RPMSG Kconfig option as
well as the zephyr,bt-hci-rpmsg-ipc chosen node in Devicetree. However,
this proved to be undoable in the case of the Kconfig option. This is
because it's a choice option, and those have special behavior. In
particular, the only practical way to deprecate would've been to keep
the old Kconfig option outside the choice (much like it's done in this
commit) but then also add a 'depends on !BT_RPMSG' on each of the
remaining choice symbols *except* on the new BT_HCI_IPC one. This, however,
only works correctly for .conf files. If a board instead sets the
default BT_HCI_BUS_TYPE in the Kconfig.defconfig file then the Kconfig
tree parsing would fail, because it'd try to set it to a value
(BT_RPMSG) that is no longer part of the choice.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-11-02 08:32:20 +02:00
Grzegorz Chwierut 0958abd2ef twister: unittests: Fix unittest test_projectbuilder_gather_metrics
Fix #64606 by initializing mock object.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-10-31 09:53:33 -04:00
Maciej Perkowski aa3e79a88a scripts: Add test_plan.py to twister_ignore.txt
There is no point in running full twister scope when
test_plan.py script is modified.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-10-31 09:02:16 +01:00
Simon Hein 169de2c0ee scripts: utils: add guidelines converter script
Add a guidelines rst converter script
to convert the rst document written coding guidelines
into another format.
First supported format is the format for cppcheck

Signed-off-by: Simon Hein <Shein@baumer.com>
2023-10-30 13:46:23 -04:00
Grzegorz Chwierut bbab631021 twister: unittests: Use mock for os.name in unittests
Use mock.patch instead of monkeypatch for os.name in unittests
to fix error when executing tests under VSCode

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-10-30 11:50:48 -04:00
Yong Cong Sin df2c0681d3 devicetree: encode multi-level interrupt number in C devicetree magic
The multi-level encoding of the interrupt number currently
happens in the `gen_defines.py`, which is called in the
`dts.cmake` module after `kconfig.cmake`. However, the number
of bits used by each level is defined in Kconfig and this means
that `gen_defines.py` will not be able to get that information
during build.

To fix this, do the multi-level encoding in C devicetree macro
magic instead of the python script. This ticks one of a
long-standing TODO item from the `gen_defines.py`.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-10-30 11:43:39 -04:00
Maciej Perkowski 3314b8e0c3 twister: bugfix: Fix infinite loop in test_plan.py script
Commit 72f416f382 added a horizontal
scan for .yaml files when a modification was made in "common" folder.
If yamls were found in such way, the loop ended. However, the
implementation didn't address what happens if such yamls are not found.
This made the script going into an infinite loop. If yamls are not
found next to "common", the script should proceed as before, i.e. go
to the directory above an start looking there.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-10-30 10:54:57 -04:00
Lukasz Mrugala 471cff50e8 scripts: tests: twister: Jobserver tests
Jobserver module was not covered by unit tests.
This change brings its coverage to 100%.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-10-30 08:28:02 -04:00
Lukasz Mrugala 3c7968172e scripts: tests: twister: Add error testing
Errors did not have their dedicated test file.
This change adds it to the repo and
checks the only non-def statement there.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-10-30 08:27:43 -04:00
Lukasz Mrugala 2235a8253b scripts: tests: twister: runner test expansion
Creates a few dozen new tests that cover every runner.py method.
99% coverage (All statements save for one) is achieved.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-10-27 13:36:17 -05:00
Grzegorz Chwierut fffe0b9fad twister: pytest: Parametrize scope of the dut fixture
Added pytest_dut_scope keyword under harness_config section.
New keyword is used to determine the scope of dut and shell
fixtures in pytest-twister-harness plugin.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-10-27 13:35:14 -05:00
Maciej Perkowski 72f416f382 scripts: Add workflow for "common" directories in find_tests()
Some tests use a "common" directory to store pieces of code which
are reused by different scenarios. In those cases, no test yaml is
found within such director nor within its parents.
If no test yaml is found in a directory, and the directory is called
common, also look in collocated directories if they have test yamls.
If so, add all those locations to the scope.
E.g. tests/bluetooth/controller/common

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-10-27 09:13:16 -04:00
Maciej Perkowski 9f85001061 scripts: Make workflow of test_plan.py script more robust
The script was not resolving all detected changes uniformly:
find_excludes() could skip or not certain patterns based on
required testing scope. The idea was to not include files
that were already handled by find_test() and find_boards() workflows.
However, only boards and tests folders could be removed but
not samples. This also led to blind spots: changes in some files
were not triggering any tests. E.g. change in a test/common, where
no corresponding yaml can be found by find_tests() which is also
ignored by find_excludes(). In the new workflow a list of resolved
files (for which find_arch(), find_tests() or find_boards()
found scope) is created. Instead of using skip in find_excludes,
files are excluded only if they were resolved.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-10-27 09:13:16 -04:00
Krzysztof Chruściński f172a1a5ee scripts: logging: dictionary: Handle string stripping
Add support for getting strings from section which is not part
of the binary.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2023-10-27 11:42:21 +02:00
Krishna T 85e3a4ca6a scripts: ci: Fix for compliance with multi-user machine
If in a server multiple users are running compliance then it throws
errors as the filename "Kconfig.modules" and "Kconfig.dts" is owned by
someone else.

Fix this by creating a randomized Kconfig file and delete after use.

Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
2023-10-26 16:47:30 +02:00
Jordan Yates 79e467c92a scripts: kconfig: kconfiglib: introduce configdefault
Introduce the `configdefault` keyword as a Kconfig extension. This new
keyword allows `default` values to be applied to externally defined
symbols without needing to respecify dependencies, or weakening the
existing dependencies.

This is primarily useful in downstream repositories that wish to define
default configurations such as:
```
config MY_COMPANY_APPS
    bool "Apply defaults for internal applications"

configdefault BT
    default y if MY_COMPANY_APPS
configdefault MCUMGR
    default y if MY_COMPANY_APPS && BT
```

Obtaining the same functionality with `config` (without weakening the
symbol dependencies) requires finding the original definition and
duplicating any `depends on` and surrounding `if` statements. This is a
non-trivial exercise that needs to be manually rechecked on each Zephyr
update.

`configdefault` simplifies this process by acting as if the `default`
statement was present at any one of the original definitions of the
symbol.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-10-26 09:47:06 +02:00
Jordan Yates c8df08d681 scripts: kconfig: kconfiglib: cleanup pylint errors
Cleanup pylint errors that otherwise cause future commits to fail.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-10-26 09:47:06 +02:00
Henrik Brix Andersen bf598848b1 scripts: west: commands: tests: dfu_util: fix test under Python 3.12
Use "call_args_list" from unittest.mock instead of "called_with" for
verifying the arguments supplied to the dfu-util west runner.

This aligns the assert with the rest of the test case and fixes the
dfu-util west runner test when running under Python 3.12.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-26 07:17:10 +02:00
Daniel Leung 4201978f34 manifest: sof: update to commit e7cb489d4
This updates SOF modules to commit
e7cb489d430dc2181e4a5f7f953ed1eaeec6668d. This includes
a change where rimage is pulled into the tree and is no
longer a submodule. So update the rimage config path so
signing still works.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-10-25 21:44:14 -04:00
Daniel Leung 3be5732a68 west: sign/rimage: skip extended manifest when !SOF
Non-SOF build does not have extended manifest data for
rimage to process, which might result in rimage error.
So do not do extended manifest during signing when not
doing SOF builds.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-10-25 21:44:14 -04:00
Fabio Baltieri 73d5ecc0c5 scripts: check_init_priorities: drop recursive child parsing
Now that child nodes are handled by edtlib there's no need to parse
child nodes in check_init_priorities anymore.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-10-25 18:39:31 -07:00
Fabio Baltieri 403640b75e edtlib: link child nodes to parent for nodes with child-bindings
The current EDT graph logic only use properties directly under a
specific node to add dependencies. For nodes properties in
child-bindings, this means that the child phandles are only linked by
the child node itself, which does have an ordinal but no corresponding
"sturct device" in the code, causing those dependencies to be silently
ignored by gen_handles.py.

Fix that by adding the recursive logic to visit child bindings when
present, which causes all child node property handles to be linked to
the parent node.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-10-25 18:39:31 -07:00
Manuel Argüelles 52e9671fa8 west: add tests for NXP S32 Debug Probe
Add minimal set of tests to verify behavior of supported commands.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-10-25 18:14:51 -07:00
Manuel Argüelles e938a5a31a west: add NXP S32 Debug Probe runner
The NXP S32 Debug Probe is a JTAG-based probe that enables debugging on
NXP S32 devices. This probe is designed to work in conjunction with NXP
S32 Design Studio and this runner offers a wrapper to launch a debug
session from cli.

`flash` command is not implemented at the moment because presently there
are no zephyr boards that can make use of it and test it.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-10-25 18:14:51 -07:00
Manuel Argüelles 1bc53ff84d west: core: allow to pass keywords args to server and client
Allow the runners to pass extra keywords arguments to both the server
and client subprocesses calls, as can be useful for instance to set
a specific execution environment.
ZephyrBinaryRunner.check_call() already supports passing kwargs to
the inner subprocess call but this is currently not possible when
starting server/client processes. So pass through the kwargs to each of
the client/server subprocess calls.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-10-25 18:14:51 -07:00
Manuel Argüelles c35d024b8d west: core: add search path argument to require()
Allow the runners to override the default search path, e.g. when
provided through command line. The default is to search for the program
binary on the system PATH.

This is useful when the runner allows to optionally override the search
path of the tool, in the case there are multiple versions or
installations, and not necessarily the tools path are present in the
system PATH environment variable. For example:
`tool = self.require(tool_name, path=args.tool_path_override)`

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-10-25 18:14:51 -07:00
Piotr Kosycarz 8c5a15aac4 scripts: twister: get status of coverage data processing
Do not break processing when incorrect coverage data are received.
Instead, report failures but still process valid data.

Include coverage processing status within twister retrun code.

Signed-off-by: Piotr Kosycarz <piotr.kosycarz@nordicsemi.no>
2023-10-25 09:57:15 +02:00
Piotr Kosycarz 861cab4a2a scripts: twister: extend test timeout to get gcov data
When coverage is enabled, gather console logs longer
to receive gcov data which are send after test output.

Signed-off-by: Piotr Kosycarz <piotr.kosycarz@nordicsemi.no>
2023-10-25 09:57:15 +02:00
Flavio Ceolin 2e5c37142c scripts: kconfig: Always generate ZEPHYR_*_MODULE
Define the ZEPHYR_{MODULE_NAM}_MODULE option for all available modules.
Right now only modules defined as 'kconfig-ext' has this symbol defined
which may cause problem if the build wants to check if a module not
using this options is available.

This allow us to do something like:

comment "mbedTLS module not available."
	depends on !ZEPHYR_MBEDTLS_MODULE

or make a feature depends on the module be present.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-24 10:53:24 +02:00
Maciej Perkowski 0752d60443 scripts: Add arg to test_plan.py for alternative test locations
The arg --testsuite-root was copied from twister. When it is used
for test_plan.py it will be propagated to twister calls. This allows
to make alternative test locations (e.g. from another repo) to work
with test_plan.py

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-10-24 09:04:09 +02:00
Maciej Perkowski 7692610004 scripts: Add arg to set_plan.py for alternative tag relation list
Add --alt-tag arg for test_plan.py script. User can use it and point
to an alternative file with tag-directories relations. If so, such
file will be used instead of the default one.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-10-24 09:04:09 +02:00
Maciej Perkowski 47405a114a scripts: Allow using alternative ignore-patters in test_plan.py
Expand test_plan.py args with --ignore-path. This allows to provide an
alternative lists of patterns for the script.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-10-24 09:04:09 +02:00
Maciej Perkowski f7c4d5f9d4 scripts: Allow test_plan.py to work with other than zephyr repos
The test_plan.py script has a path to repository to be scanned for
changes hard coded to zephyr. This patch separates zephyr path from
such repository's path and adds an arg to pass repo to scan

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-10-24 09:04:09 +02:00
Maciej Perkowski f9178926a9 scripts: Add --no-detailed-test-id arg to test_plan.py script
An option --no-detailed-test-id was added to twister to help align
names for test outside of zephyr tree. This commit add this arg
to test_plan.py script which is then propagated to twister.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-10-24 09:04:09 +02:00
Anas Nashif b643692fa5 ci: test_plan: use integration mode for architectures
Reduce the scope to integration only.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-23 11:20:57 -04:00
Anas Nashif 99bb4b9581 ci: testplan: fix include path
Add zephyr to the include path detection.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-23 11:20:57 -04:00
Alberto Escolar Piedras bc5da1a158 native simulator: Get latest from upstream
Align with native_simulator's upstream main
d32b2504ad2b6d6d541bc71a0f9b16ab7b6a3831

Which includes:
* d32b250 Minor format fix
* 7b4f35b native HW counter: Provide new API to reset and control
* 4f815cb INT CNTLR: Bugfix for more than 32 interrupts
* 1d36254 Provide new 64 version of nsi_find_lsb_set

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-20 15:20:43 +02:00
Anas Nashif 2ab8c1b779 ci: do not run twister on set_assignees.py changes
No need to run twister when changing this script.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-20 15:10:11 +02:00
Anas Nashif d9a300e4ae ci: various set_assignee fixes
Cleanup of script and change how we assign PR in general:

Make sure that when multiple areas are changed, including platform or
driver changes, we set assignee of the general areas and not the
platform maintainers. For example, if I change 100 SoC files and touch
the kernel file, the assignee is set to the kernel maintainer.

First, we should as much possible try and split such changes and not
have common area changes with platform changes at the same time. Second,
it is important that such changes which affect everyone are reviewed and
approved by the maintainer of the general areas rather than leave them
to the platform maintainer.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-20 15:10:11 +02:00
Anas Nashif 719fee2bbc doc: ztest: adapt ztest docs
Remove remaining usage and documenation of dropped kconfig that is now
the default.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-20 15:04:29 +02:00
Anas Nashif 996c8457d7 ztest: remove old ztest api
Remove old Ztest API entirely. New API is the now the default.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-20 15:04:29 +02:00
Radoslaw Koppel 48b93ee0aa scripts: build: gen_isr_tables: Cleanup access to ".intList"
This commit removes the needs or generating isrList.bin temporary file.
Now gen_isr_tables.py script access the required section directly in
elf file, that was accessed by the script anyway.
It simplifies the building removing one step.

Signed-off-by: Radosław Koppel <radoslaw.koppel@nordicsemi.no>
2023-10-20 14:58:55 +02:00
Øyvind Rønningstad bb1cfbad19 twister: Add option for generating rom.json and ram.json
Generate the files via the 'footprint' target for each project.

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2023-10-20 14:54:54 +02:00
Alberto Escolar Piedras ec273d1357 twister: Fix description of relationship between filter and allow/exclude
The current description of the relationship between the tests filter
and the arch/platform allow/exclude was actually incorrect.

Let's fix it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-17 18:55:35 +03:00
Anas Nashif 38e86c8e86 twister: runner: change log message from info to debug
Very verbose log message without too much context that should be a debug
message rather than a info().

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-12 20:40:56 +03:00
Maciej Perkowski 4cd7df2eec twister: Fix error for --device-testing with not runnable integration
An urforseen error was introduce with #62713. When "--device-testing"
or "--filter runnable" is used in CLI, twister will skip tests which
cannot be executed (not just built) on a given platform. If a given
platform is among integration platforms it will cause an error.
However, it shouldn't be the case. Such skip is intentional and
shouldn't be an error. Fixed by assigning an existing Filter.CMD_LINE,
which is exempted from being turned to error.

fixes: #63844

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-10-12 18:22:23 +03:00
Dmitrii Golovanov 496509cd65 twister: Reset TestInstance status before run
Reset TestInstance status when ProjectBuilder.run() is called
to run the test after its successful build, so the build status
will not propagate as the run status if the run fails.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-10-12 14:43:38 +03:00
Dmitrii Golovanov 9cdb0aaa14 twister: harness: Fix Console pattern matching for ztest
Fix the Twister Console harness ordered 'multi_line' and 'one_line'
pattern matching to treat the ztest as failed when not all of the
expected patterns were found in the console output, but the ztest
application itself reports 'PROJECT EXECUTION SUCCESSFUL'.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-10-12 14:43:38 +03:00
Gerard Marull-Paretas 7772cec6bd edtlib: always insert root node to the graph
When we have an empty Devicetree, ie,

```
/dts-v1/;

/ {

};
```

The node's dep_ordinal is never initialized because the node graph is
empty. This ends up with invalid ordinal tokens (-1) in
devicetree_generated.h which in turn produce some cryptic compiler
errors, see e.g.

```
error: pasting "dts_ord_" and "-" does not give a valid preprocessing
token
   95 | #define Z_DEVICE_DT_DEV_ID(node_id) _CONCAT(dts_ord_,
      DT_DEP_ORD(node_id))

...

include/zephyr/devicetree.h:2498:41:
note: in expansion of macro 'DT_FOREACH_OKAY_HELPER'
 2498 | #define DT_FOREACH_STATUS_OKAY_NODE(fn)
      DT_FOREACH_OKAY_HELPER(fn)
            |
	    ^~~~~~~~~~~~~~~~~~~~~~
include/zephyr/device.h:1022:1:
note: in expansion of macro 'DT_FOREACH_STATUS_OKAY_NODE'
     1022 |
	  DT_FOREACH_STATUS_OKAY_NODE(Z_MAYBE_DEVICE_DECLARE_INTERNAL)

```

(devicetree_generated.h)

```
...
 #define DT_N_ORD -1
 #define DT_N_ORD_STR_SORTABLE 000-1
...
```

This patch makes sure root node is always inserted (without any target)
so that it gets initialized later.

Discovered as part of
https://github.com/zephyrproject-rtos/zephyr/pull/63696

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-10-11 18:28:01 +03:00
Grzegorz Swiderski ce1b8d6d16 scripts: kconfig: Make DEPRECATED/EXPERIMENTAL symbols optional
Make `kconfig.py` not crash when any one of these settings is undefined:

  * DEPRECATED
  * EXPERIMENTAL
  * WARN_DEPRECATED
  * WARN_EXPERIMENTAL

While these will continue to exist in Zephyr, they shouldn't be strictly
required for the script to work. One situation in which they could go
missing is when a user creates an application-specific Kconfig root, but
forgets to source "Kconfig.zephyr" inside it - not that this is expected
to work anyway, but it could at least raise a more intelligible error.

Note that when WARN_DEPRECATED is undefined, selecting DEPRECATED will
always produce warnings. Same with WARN_EXPERIMENTAL and EXPERIMENTAL.
This matches the fact that the WARN_* symbols normally have `default y`.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2023-10-11 18:25:57 +03:00
Benjamin Cabé 4773f42c27 west: bossac: handle stty from coreutils on macOS
There might be situations where people are running the coreutils version
of stty on macOS, hence the need for being smarter at detecting when
that might be the case

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-10-11 11:05:48 +01:00
Alberto Escolar Piedras 07e88a9fba west native_gdb runner: Fix to use exe instead of elf
The runnable output from the build system is the
exe file. In native_posix the elf happend to also be
runnable, but this is not the case in general,
and not for native_sim or the nrf5*bsim boards.

So lets use the exe instead.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-10 15:26:09 +02:00
Alberto Escolar Piedras f8455b410e west runner: Add exe file to configuration
Add the exe fle to the runnerconfiguration class,
so we can use it from runners which will need it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-10 15:26:09 +02:00
Anas Nashif 22042e7b4e ci: tags: include wifi/net drivers in the net group
Changes to networking and wifi drivers should trigger networking tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-10 16:22:54 +03:00
Lukasz Mrugala eeb142d409 .github: workflows: Workflow for build_helpers
PR #63195 has managed to change code under test without
triggering those tests.

This change should remedy that by creating a new workflow,
based on twister_tests.yaml, that runs tests in
scripts/tests/build_helpers if build_helpers are modified.

Such a workflow should be easily extendable if we ever have more
non-Twister things to test in scripts/pylib.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-10-10 15:55:58 +03:00
Lukasz Mrugala 76f9a024c3 scripts: tests: twister: Domains tests fix
PR #63195 has changed how Domains work without
triggering necessary tests, thus breaking them.
This commit fixes the domains tests.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-10-10 15:55:58 +03:00
Lukasz Mrugala 2fcf4e3499 scripts: pylib: build_helpers: flash_order fix
If flash_order were to be missing from the YAML, the Domains init
would crash instead of substituting an empty list.
This commit fixes that.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-10-10 15:55:58 +03:00
Seppo Takalo 1ecd4fda1a net: script: Fix the net-tools path
Fix the correct path to net-tools directory.
Also default to Bash instead of /bin/sh as we use
Bash syntax.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-10-06 16:14:39 +03:00
Yong Cong Sin 0722c621c8 util: increase several macros limit from 255 to 4095
Currently, the following macros will only work for 0 - 255:
- `IS_EQ`
- `UTIL_X2`
- `UTIL_INC`
- `UTIL_DEC`
- `LISTIFY`

This patch increases their limit to 4095.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-10-05 06:10:06 -04:00
Grzegorz Swiderski 9bbf7e5a48 scripts: domains: Convert Domain to a dataclass
For conciseness.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2023-10-04 18:04:18 +02:00
Grzegorz Swiderski 652b0a8a98 scripts: domains: Support initialization only from YAML
By requiring a full-on YAML fragment, the Domains class can rely on
pykwalify to do the heavy lifting with validating types and structure.
Remove support for loading domains from a dictionary, so that we don't
ever have to replicate the same checks on the input, and we can instead
have a single entry point.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2023-10-04 18:04:18 +02:00
Grzegorz Swiderski f82e2ef043 scripts: domains: Tighten up initialization
Do extra checks to reject inconsistent `domains.yaml` contents early:

   default: app
   build_dir: /path/to/build
   domains:
     - name: image_1
       build_dir: /path/to/build/image_1
     - name: image_2
       build_dir: /path/to/build/image_2
   flash_order:
     - image_1
     - image_2
     - unknown

This example lists "image_1" and "image_2" as known domains, but an
entry for the default "app" is missing, which should never be allowed.
A valid `domains.yaml` file shall also not contain extra domains under
`flash_order`, such as "unknown", which doesn't appear under `domains`.
Either of these cases can now be caught while initializing an instance
of the Domains class.

It follows that a valid `domains.yaml` file must always contain a list
of domains with at least one entry - the default image. Since `default`
is a required key in the YAML schema, `domains` should be required too.
Thus, empty lists will be rejected by pykwalify, so the questionable
warning for "no domains defined; this probably won't work" can be axed.

Fixes #63166

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2023-10-04 18:04:18 +02:00
Grzegorz Chwierut fd6f3c5a2a twister: Fix quarantine performance issue
When using a quarantine file with more than 512 unique
entries, than time of matching quarantine increases
significantly. This is because regexp cache size is
512. Add precompiled regexp entries to the quarantine
as a fix.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-10-04 14:49:38 +01:00
Øyvind Rønningstad fea8caccea twister: Make string stripping consistent across handlers
All handlers except QEMU were right-stripping console lines before
checking them. In certain cases where the regex is expecting the
whitespace, this could make the test fail on qemu when it is passing
on something else. Change QEMUHandler to us .rstrip instead of .strip()

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2023-10-03 16:38:02 +01:00
Lukasz Mrugala b892a4bc49 scripts: tests: twister: Add log_helper tests
Log helper is a small module that this commit
covers with an explicit test.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-10-03 15:22:08 +01:00
Carles Cufi 2332a1db39 west: runners: nrf: Document why the network core is recovered first
The network core needs to be recovered first due to the fact that
recovering it erases both the network and application cores' flash
memory. This means that the little flash image that is programmed during
the recover operation would be lost for the app core if we inverted the
order.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-10-03 15:11:55 +01:00
Grzegorz Chwierut 0badef8091 twister: Fix missing timeout in handler class
In PR #62947 a timeout variable was replaced with a method,
but this timeout was used in another place to start
pytest subprogram. This commit provides a fix.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-10-02 16:40:11 +01:00
Anas Nashif 9d9f3b5c67 twister: do not error on module filters
If a module is not available, then it is optional, so do not error in
--integration mode.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-01 09:21:50 +03:00
Martí Bolívar 23ed21c0a0 scripts: runners: rework RunnerCaps implementation
This provides miscellaneous quality of life improvements:

- We couldn't use dataclasses when this class was originally written.
  We can now, so move to dataclass to avoid having to write
  __repr__().

- Add missing validation for the advertised commands

- Add missing documentation for the 'file' capability

Signed-off-by: Martí Bolívar <mbolivar@amperecomputing.com>
2023-09-29 16:30:07 +02:00
Maciej Perkowski 066cc2c9d2 twister: Add options deciding if paths be included in tests' names
Test suites names are not being handled uniformly for tests not
in zephyr tree. Their names depend on -T arg used in twister's CLI.
The newly added options allow to select if twister should add paths
to suite names. This is needed if test plans are to be used for tests
outside of zephyr tree.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-09-29 16:29:16 +02:00
Maciej Perkowski 4e4b743fe1 twister: Add "path" entry to json test report
"Path" is a path (relative to zephyr) to a directory with test suite's
definition. Such entry helps to locate a given test.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-09-29 16:29:16 +02:00
Lukasz Mrugala 66730c961e scripts: tests: twister: Domain module testing
Domain module was not yet covered by explicit unit tests.
This commit adds a new test file to cover that gap.
It achieves 100% coverage at the time of creation.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-09-29 16:26:35 +02:00
Manoel Brunnen ae924b2afc twister: Fix test-only tests with hardware map fixtures
In test-only mode with a hardware map, all tests with fixtures were
skipped, even when the hardware map has appropriate fixtures defined.

TestPlan.load_from_file had the check for fixtures missing, but actually
best is that the TestInstance checks the fixtures in the hardware map.

Signed-off-by: Manoel Brunnen <manoel.brunnen@ithinx.io>
2023-09-29 16:25:47 +02:00
Evgeniy Paltsev 80d2872a41 twister: introduce twister-level timeout multiplier
Twister allows us to control maximum execution time for each test
with timeout value in test's .yaml configuration and
platform level timeout multiplier which allows us to tweak
timeout value for specific platform.

However, sometimes we want to additionally adjust tests timeouts
when running twister. This is especially useful in case of
simulation platform as simulation time may depend on the host
speed & load, we may select different (i.e. cycle accurate but
slower one) simulation method, etc...

Let's introduce global (twister-level) timeout multiplier option.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-09-29 12:59:31 +02:00
Evgeniy Paltsev c2de739f1f twister: tests: handler: fix incorrect timeout mock
There is clearly an issue with current timeout value
timeout into mocked_instance as this value is used only
once before this mock happen, so this mock is actually useless
and we always use default value. Fix that.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-09-29 12:59:31 +02:00
Jukka Rissanen 6661f05daf net: ppp: Mark the PPP L2 as non-experimental
The experimental status of the PPP L2 is long overdue so
it can be removed as the component is working fine.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-09-29 10:33:50 +02:00