Commit graph

4437 commits

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