Commit Graph

7325 Commits

Author SHA1 Message Date
Maureen Helm f60f034c07 Revert "logging: Prevent multiple arguments evaluation"
This reverts commit 3f56567b08 which
caused build failures with the XCC toolchain on all samples and tests,
as well as a runtime failure with the nrf52_bsim board on
tests/bluetooth/bsim_bt/bsim_test_mesh.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-02-08 17:02:48 -05:00
Krzysztof Chruscinski 21867fd4d0 tests: logging: Update test after adding rodata detection on sparc
Updated tests to tread sparc as any other platforms that are
capable of detection if string is read only.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-08 09:41:37 -05:00
Daniel Leung 771c177909 tests: k_heap_api: make alloc pending tests a bit more robust
Both alloc_pending tests requires the main thread to utilize
the heap so that child threads must pend on memory allocations.
However, the previous implementation was not SMP friendly where
the child threads could run and succeeded in memory allocation
on other CPUs while the main thread continued to allocate
memory. The main thread would fail to allocate memory if
the child thread (on other CPU) has not freed the memory yet.
Not to mention that, in this scenario, the child thread was not
pending on memory allocation which defeated the purpose of
the test. So to fix this, make sure the main thread allocates
enough memory so future allocations must go into pending.
Also, check that the child thread cannot allocation memory
when first entered so it is actually going into pending.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-02-08 07:34:48 -05:00
Krzysztof Chruscinski f647201bbd tests: logging: log_api: Add test for argument evaluation
Added test which checks that log argument is evaluated only
once when log message is created.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-08 07:32:43 -05:00
Krzysztof Chruscinski 3f56567b08 logging: Prevent multiple arguments evaluation
Logging v2 is utilizing complex preprocessing operations to
prepare message at compile time. Multiple operations are peformed
on log message arguments. However, it is expected that argument
will be evaluated only once (e.g. it can be a call to a function
with side effects). Adding additional layer which creates copies
of user arguments on stack and passes them to further processing.

Updated test for log_msg2 which is using internal macro which
got renamed.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-08 07:32:43 -05:00
Maureen Helm 124747d146 tests: build_all: Add net tag to the modem driver test
The modem driver test enables the networking stack, and some boards like
intel_adsp.* use this tag exclude networking tests.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-02-08 07:26:45 -05:00
Francois Ramu 2b8df6b160 tests: drivers: flash running on disco stm32 board with qspi
Restore the testcase to run on the qspi nor-flash controller
of the disco_l475_iot1 board
of the disco stm32f746 board

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-02-08 07:03:12 -05:00
Anas Nashif ca565118ea tests: settings: provide correct test prototypes
More issues with missing prototypes.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-02-07 12:39:42 -05:00
Anas Nashif 6b3cde2289 tests: settings: provide correct test prototypes
Add prototypes for renamed test functions. Issue was introduced in
677ffc883a.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-02-07 10:48:18 -05:00
Piotr Golyzniak 677ffc883a tests: settings: fix wrong test case names
Change test case names to proper one, which start from "test_"
characters.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2022-02-07 09:29:09 -05:00
Erwan Gouriou 2f7b5ad8ea tests/lib: devicetree: Remove references to deprecated macros
These deprecated macros are now removed.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-02-05 06:26:25 -05:00
Andrzej Głąbek 18fc88da50 tests: uart_async_api: Add multiple_rx_enable test case
Add a test case that ensures that uart_rx_enable() can be successfully
called after RX is disabled with uart_rx_disable() and also when it is
disabled automatically after the provided RX buffer is filled up.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-02-05 06:25:46 -05:00
Andries Kruithof 43ed49c1e6 Bluetooth: tests: edtt: fix buffer overflow error
HCI/GEV/BV-01-C tries to send 255 bytes over HCI, as part of sending
an unknown/unsupported command, but the default buffer size
is 65, which results in a buffer overflow and undefined behaviour.
Instead of crashing hard we now check the buffer length.
In order for EDTT tests to pass we set the buffer size to 255

Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
2022-02-05 06:19:00 -05:00
Carles Cufi 7f6524949a lib: os: crc: Rework the crc16() implementation
As described in #42403, there was an issue with the existing crc16_ansi()
implementation, since it was not calculating the CRC-16-ANSI (aka
CRC-16-MODBUS). This is because the  existing crc16() function only
supported non-reflected input and output (and the CRC-16-ANSI requires
reflection on both) and also it did not seem to support correctly inial
seeds different from 0x0000 (and, again, the CRC-16-ANSI requires 0xffff
as an initial seed).

This commit replaces the existing crc16() with a functional pair,
crc16() and crc16_reflect(), that also work with any poly, any initial seed
and allow to select whether reflection is performed.
It also adapts crc16_ansi() so that it actually returns the correct CRC.

Fixes #42403.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-02-04 12:33:22 -05:00
Carles Cufi e2e3366357 tests: unit: crc: Add tests for common checksums
Since the crc16_ccitt and crc16_itu_t functions can compute several
flavors of checksum depending on the initial seed and XOR out value, add
tests for some common variants that are documented as supported.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-02-04 12:33:22 -05:00
Asbjørn Sæbø 73f5ffcf4e Bluetooth: Audio: Fix timeout message in BabbleSim tests
Update the WAIT_TIME definition and timeout-message so that the time
out message actually prints the elapsed time instead of "0".

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2022-02-04 11:17:08 +01:00
Asbjørn Sæbø f7cd6afb79 Bluetooth: Audio: Align time-outs in babblesim tests
Increase the simulation lengths in the test scripts (where needed) to
be longer than the WAIT_TIME defined in common.h, so that simulations
will not end before the test has a chance to do proper time out.

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2022-02-04 11:17:08 +01:00
Guillaume Lager 5387c25e81 shell: Add test for dictionary command
The test also check that dictionary set with matching
items can be declared

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2022-02-04 11:14:21 +01:00
Yong Cong Sin 731241f8d0 kernel: workq: Fix type errors in delayable work handlers
A common pattern here was to take the work item as the subfield of a
containing object. But the contained field is not a k_work, it's a
k_work_delayable.

Things were working only because the work field was first, so the
pointers had the same value. Do things right and fix things to
produce correct code if/when that field ever moves within delayable.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-02 18:43:12 -05:00
Flavio Ceolin 0c1950f7b0 tests: Fix drivers tests tag
By convention most tests are using "drivers" and not "driver".

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-02-02 09:21:07 -05:00
Flavio Ceolin 5d96fcf68e tests: sensor: generic: Make test name consistent
By convention tests are using the name "drivers" and not "driver".

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-02-02 09:21:07 -05:00
Flavio Ceolin 64d00865b2 tests: accel: Make test name consistent
By convention tests are using the name "drivers" and not "driver".

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-02-02 09:21:07 -05:00
Flavio Ceolin 6b56fcd07e tests: spi_loopback: Make test name consistent
By convention tests are using the name "drivers" and not "driver".

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-02-02 09:21:07 -05:00
Flavio Ceolin fad97b7fff tests: pinctrl: Fix typo on test name
s/derivers/drivers/g

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-02-02 09:21:07 -05:00
Krzysztof Chruscinski 875ec0a0cb tests: drivers: uart: mix_poll: Test const buffers
Modifications to use RO buffer in the test. Added configuration
which is using RO buffer for uart_tx.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-02 12:47:46 +01:00
Krzysztof Chruscinski bdabf1eee9 tests: drivers: uart: async_api: Test const buffers
Small modifications to use RO buffer in the test.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-02 12:47:46 +01:00
Krzysztof Chruscinski 9b22393b7e tests: drivers: uart: Add test for Nordic UARTE version of the driver
Add configuration of the uart_async_api test to use uarte peripheral.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-02 12:47:46 +01:00
Robert Lubos 21e5cc7a31 tests: net: lwm2m: Add link-format content writer tests
Add unit tests for LwM2M link-format content encoder/decoder.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-02-02 11:12:56 +01:00
Robert Lubos 960512fa13 tests: net: lwm2m: Add JSON content writer tests
Add unit tests for LwM2M JSON conent encoder/decoder.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-02-02 11:12:56 +01:00
Robert Lubos 735fd86c0e tests: net: lwm2m: Add OMA TLV content writer tests
Add unit tests for LwM2M OMA TLV conent encoder/decoder.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-02-02 11:12:56 +01:00
Robert Lubos 48fd29a081 tests: net: lwm2m: Add plain text content writer tests
Add unit tests for LwM2M plain text conent encoder/decoder.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-02-02 11:12:56 +01:00
Efrain Calderon 99e3e67661 test: net: coap: update tests
Update test to ensure that any file can be tranfered,
not only files that are aligned with the packet size.

Signed-off-by: Efrain Calderon <efrain.calderon@aquarobur.com>
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-02-02 11:10:57 +01:00
Piotr Pryga e87172f483 Bluetooth: Controller: llcp: Fix failing UT for version exchange
Test that verifies correct handling of Version exchanged procedure
called twice on the same connection failed. The reason was wrong
number of expected free procedure context objects. It was expected
that there will be one context not released.
That was wrong because the context is released just after the procedure
completes in idle state. The second and following calls to the procedure
do not start any PDU exchange, so the procedure ends immediately.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-02-02 10:53:51 +01:00
Piotr Pryga ee4d3acf79 tests: Bluetooth: df: Add CTE REQ expected positive behavior tests
Add expected positive behavior tests for direction fingin in connected
mode.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-02-02 10:53:51 +01:00
Piotr Pryga 405ee0d04c tests: Bluetooth: df: Fix not building connection CTE req tests
The tests for direction finding connected mode were not building
correclty. There were missing Kconfig options that enable missing
functionality to be tested.
Tests were not failing because there were no expected positive
behavior tests added.
Added changes allow to validate all implemented test cases.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-02-02 10:53:51 +01:00
Piotr Pryga c86ca9a3d6 tests: Bluetooth: llcp: Add CTE REQ and PHY change collision tests
To avoid violation of BT 5.3 Core Vol 6, Part B section 5.1.10.1
there was added a command pause mechanism that allows to postpone
handling of CTE REQ if there is pending PHY change procedure or
PHY change if there is pending CTE REQ procedure.

The commit adds unit tests for the functionality.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-02-02 10:53:51 +01:00
Krzysztof Chruscinski 5cf70e4860 tests: drivers: clock_control: nrf_calibration: Skip test for nrf52832
On nrf52832 disabling low frequency clock results in RTC COUNTER
reset. It is unexpected and system clock can be disrupted and
test may hang. Disable test which restarts LF clock for nrf52832.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-01 14:16:18 -06:00
Krzysztof Chruscinski 18c0c7a2e5 tests: drivers: clock_control: api: nrf: Disable tests for nrf52832
On nrf52832 LF clock cannot be stopped during runtime because
it resets RTC COUNTER. Testsuite run on nrf clock control driver
assumes that it will not happen. Disabling testing of LF clock
for nrf52832.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-01 14:16:18 -06:00
Krzysztof Chruscinski 4012e7ddc6 tests: logging: log_api: Execute message dropping test on 1 cpu
Ensure that test is executed on 1 CPU. When target has multiple
CPUs other core may process logging and we won't get expected number
of dropped messages.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-01 08:16:10 -05:00
Krzysztof Chruscinski 3e58625acd tests: logging: log_api: Reworking suite setup
Reworking test suite setup.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-01 08:16:10 -05:00
Joakim Andersson 17f8932f16 modules: trusted-firmware-m: Use TF-M install headers as interface
Use the set of headers that the TF-M build system places in the
install output. Not all public header files are available in the
interface/include directory and the TF-M build system uses the install
mechanism of cmake to include additional headers based on platform
or configuration.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2022-02-01 11:31:36 +01:00
Andrzej Puzdrowski f3a61dfecc tests/subsys/fs/multi-fs: remove write_protection flash handler
Removed the write_protection handler from the test_ram_backend.
This change was made due to deprecation of the flash write-protection
API.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-02-01 10:46:28 +01:00
Andrzej Puzdrowski 3d0e7553af tests/subsys: CONFIG_TEST_FLASH_DRIVERS=y only for qemu_x86
CONFIG_TEST_FLASH_DRIVERS is dedicated for qemu_x86.
This patch moves it to per board project configuration.

Setting this property for each target will cause build
failures.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-02-01 10:46:01 +01:00
Erwan Gouriou 6a6c47b619 tests/drivers: gpio_basic_api: Add overlay to test nucleo_wl55jc
Add and overlay to enable gpio api test on this board.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-01-31 14:37:11 -06:00
Gerard Marull-Paretas aa660bf7b3 tests: boards: intel_s1000_crb: fix k_sleep arguments
k_sleep was still called with integer arguments, however, an initialized
k_timeout_t is expected. Use K_MSEC for that.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-31 15:25:42 -05:00
Andrzej Puzdrowski 7adee4dc23 test/subsys/storage/stream_flash: fix build size issue
This test uses SoC's flash from offset of 64 KB which might
overlap with executable for a target
(for instance nrf52840dk_nrf52840).
This patch moves this region to 128 KB which solves the issue.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-01-31 16:49:43 +01:00
Vinayak Kariappa Chettimada f759c813bb tests: Bluetooth: Fix missing Scan Max Data for Broadcast Audio test
Fix missing Kconfig value for Scan Max Data in the
Broadcast Audio test.

Regression in commit faa89c779c ("Bluetooth: Controller:
Fix Periodic Adv Report to scan max data length").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-01-31 12:13:08 +01:00
Emil Gydesen 9140a8ac46 Bluetooth: shell: Add LE Audio shell commands
Adds audio.c which covers all the LE Audio shell commands.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-27 12:01:34 +02:00
Emil Gydesen e572fc565f Bluetooth: Audio: Add broadcast audio BSIM tests
Add broadcast babblesim test cases that tests basically
functionality. Due to the lack of ISO support in the
controller, this won't actually start any audio streams.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-27 12:01:34 +02:00
Emil Gydesen cf06fa85f2 Bluetooth: Audio: Add BAP broadcast sink support
Add support for the BAP broadcast sink role. This role
allows a device to sync to a broadcast ISO stream.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-27 12:01:34 +02:00
Emil Gydesen ab87e0a2ba Bluetooth: Audio: Add BAP broadcast source support
Add the BAP broadcast source implementation. This role
allows a device to broadcast ISO data.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-27 12:01:34 +02:00
Emil Gydesen 5b25c33554 Bluetooth: Audio: Add BAP unicast audio BSIM tests
Add initial babblesim tests for unicast audio.
Due to lack of ISO support in the babblesim, these
won't attempt to actual initate audio streams.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-27 12:01:34 +02:00
Emil Gydesen 59bafc430f Bluetooth: Audio: Add BAP unicast client support
Add the BAP unicast client implementation. This role
can discover BAP unicast server services and initiate
BAP audio streams.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-27 12:01:34 +02:00
Emil Gydesen 03862b3db5 Bluetooth: Audio: Add BAP unicast server support
Add the Basic Audio Profile (BAP) unicast server
functionality. This allows a device to act as the
unicast server role, which can accept unicast streams
initiated by a unicast client.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-27 12:01:34 +02:00
Emil Gydesen 5de473782e Bluetooth: Tests: Fix ctrl iso audio dependency
Change the dependency from BT_AUDIO to ISO.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-27 12:01:34 +02:00
Krzysztof Chruscinski c5989c21aa tests: logging: log_api: Add test for LOG_PRINTK
Added test that validates CONFIG_LOG_PRINTK option where
printk is redirected to logging.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-27 10:02:21 +01:00
Krzysztof Chruscinski 9302a0119f tests: logging: log_api: Test refactoring
Refactored test to make it more flexible and prepare
for case when logging thread is enabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-27 10:02:21 +01:00
Krzysztof Chruscinski 07e0a5f08a tests: logging: log_core_additional: Add panic handler for test backend
Backend implemented in the test did not implemented panic
function and test crashed when log_panic was used.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-27 10:02:21 +01:00
Maciej Perkowski 0c830822ae tests: lib: ring_buffer: Increase timeot
The tests from tests/lib/ringbuffer fails on all nrf platforms due
to a timeout. Increasing the timeout value solves the issue.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2022-01-26 14:39:12 -05:00
Andy Ross 4c1f1edf21 test/kernel/mbox: Drop needless _1cpu_ from test cases
This test is already running with CONFIG_MP_NUM_CPUS=1.  All those
1cpu declarations are needless.  And some of them (like the init
tests) have side effects that make it difficult to do things like
"filter for only MP cases".

(Indeed, this is a heavily MP-unsafe test; almost all cases written to
rely on ordering between a parent thread and its child.  And that's
doubly so for COHERENE platforms because lots and lots of the test
objects are on stacks.  MP_NUM_CPUS=1 is definitely the right thing
here.)

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2022-01-26 13:34:45 -05:00
Andy Ross 53c8d61529 tests/kernel/interrupt: Don't wait so long just for a tick
There's no reason to wait a whole second here just to know if a tick
should have fired (though, yes, on some older/legacy/non-tickless
configurations, 128 ticks is actually more than a second).

Some simulators are very slow; busy waiting is expensive.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2022-01-26 13:34:45 -05:00
Ederson de Souza 1b99804634 Revert "tests/kernel/obj_tracking: Filter cAVS 2.5 builds to prevent DSP host hangs"
This reverts commit ae8745df6f.

Patch "kernel/init.c: Initialise logging subsystem after arch" should
fix this, so no more need to filter this test out.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-01-26 10:09:19 -05:00
Thomas Ebert Hansen 520a5b11c7 tests: Bluetooth: bsim: Fix test names
The LL test for LLCP are using the old non-inclusive names.

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2022-01-26 13:10:29 +01:00
Thomas Ebert Hansen 22f8143286 tests: Bluetooth: bsim: Remove unknown tests
Remove unknown tests from the GATT test list.

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2022-01-26 13:10:29 +01:00
Daniel Leung 1e16feacda tests: semaphore: fix empty loop error for XCC
When building with XCC, k_therad_access_grant() expands to
a loop but does nothing if no building for userspace. XCC
does not like this and emits error:

  main.s: Assembler messages:
  main.s:4563: Error: invalid empty loop

So add #ifdef to only enable the loop if userspace is enabled.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-25 21:16:32 -05:00
Daniel Leung b6854d0cbc tests: condvar_api: fix empty loop error for XCC
When building with XCC, the for loop to call k_therad_access_grant()
is an empty loop because k_thread_access_grant() does nothing
if no building for userspace. XCC does not like this and emits
error:

  main.s: Assembler messages:
  main.s:1951: Error: invalid empty loop

So add #ifdef to only enable the loop if userspace is enabled.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-25 21:16:32 -05:00
Andy Ross 82bc7d0733 tests/lib/ringbuffer: Run with one CPU
The stress ('scuse me, "zstress") cases here are all written to
exercise reader/writer threads at different priority combinations.
That's defeated if the threads are allowed to run on different CPUs
(because being "low" priority doesn't matter if you have a spare CPU
to run on).

There is also extensive use of stack buffers to pass data through the
ring buffer zero copy implementation, which runs afoul of the
KERNEL_COHERENCE rules on intel_adsp platforms (where stack memory is
incoherent between CPUs and can't be shared like that).

Fix both issues by just setting CONFIG_MP_NUM_CPUS=1

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2022-01-24 12:23:46 -05:00
Emil Gydesen 1041f0c2ac Bluetooth: GATT: Initial GATT BSIM tests
Adds initial GATT BSIM tests for the client
and server functionality, testing simple
reads and writes.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-21 14:39:16 -05:00
Andy Ross ae8745df6f tests/kernel/obj_tracking: Filter cAVS 2.5 builds to prevent DSP host hangs
This test is triggering some kind of bug that will reliably cause a
full host crash/hang of the x86 host environment on TGL/cAVS 2.5.
It's interfering with CI testing, so filter it out for now while we
figure it out.

Interestingly it doesn't have any trouble on older cavs15.  And even
more so, it seems to be some kind of build interaction.  If I disable
LOG=y, it passes. But when it fails, it actually fails BEFORE the boot
entry and core 0 initialization code is reached (i.e. LONG before any
logging initialization).  Something is wrong with the generated file;
maybe a linker or rimage bug?  The signature is reported OK by the
ROM, but that's the last we hear from the device before it blows up.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2022-01-21 13:22:15 -05:00
Andy Ross 64bdc044c4 tests/kernel/queue: Mark SMP-unsafe case 1cpu, reduce logging output
The test_queue_multithread_competition case wants to be sure that an
inserted item is recevied by the highest priority thread of several
waiting, but that only works if the threads aren't racing against each
other on different CPUs.

Also, the test_queue_loop case would produce a LOT of console output
very quickly.  On a few occasions, I saw this overflow the 8k output
buffer of the intel_adsp devices at exactly the wrong time (with
respect to the polling loop in the host python script), cause a flush
of the stream, and then miss the SUCCESSFUL message.  Quiet things
down a bit, there's not a lot of value of verbosity in a CI test.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2022-01-21 13:22:15 -05:00
Andy Ross 6f8bb5d9fe tests/kernel/semaphore: Skip COHERENCE-hostile test cases
These two cases use a k_pipe to transfer data, and do it (as is
customary) by copying into or out of buffers on the stack.  But that
doesn't work when KERNEL_COHERENCE=y, because the pipe code has a
possibly-too-sophisticated zero copy implementation, and will do the
copy into the destination thread synchronously with the k_put_put()
call from the other CPU.

Normally the fix is to use a static buffer instead, but in this case
the buffers are shared between multiple simultaneous threads, so can't
be shared.

Just skip the tests, pending some rework to how they communicate.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2022-01-21 13:22:15 -05:00
Andy Ross 8fe7d9d6df tests/kernel/mp: Must enable KERNEL_COHERENCE explicitly
This is test assumes that shared static/global variables are coherent
between the CPUs.  That's true on incoherent platforms only when
CONFIG_KERNEL_COHERENCE=y.  Normally that gets turned on along with
SMP, but this is using the lower level mp API directly and didn't have
that.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2022-01-21 13:22:15 -05:00
Hake Huang 946414cdf9 tests: driver: build-test: add min_ram restriction
below two build test can not fit in SRAM size

drivers.modem.build
drivers.modem.quectel_bg9x.build

build error report:

region `SRAM' overflowed by 20688 bytes
collect2: error: ld returned 1 exit status

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2022-01-21 12:29:49 -05:00
Piotr Pryga 4d3985f93c Bluetooth: Controller: Enable PDU CP bit when CTE RX is enabled
The CP bit is read in DF connected mode while interpreting
LL_CTE_RSP PDU, hence it must be available in struct pdu_data
type.

There were missing two Kconfig options in new LLCP tests.
They were reponsbile for disable of CP bit instruct pdu_data.
That caused tests to fail during compilation.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-01-21 09:30:23 -05:00
Piotr Pryga b6be9fef1c tests: Bluetooth: Fix failing tests related with direction finding
Fixes build issues for tests in related with CTE REQ and
hci commands.
Fixes issues in unit tests for CTE REQ/RSP control proedures.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-01-21 09:30:23 -05:00
Andy Ross 8d13be016a tests/kernel/fatal/exception: Remove legacy irq_lock() usage
The irq_lock() API is a legacy API not to be used for synchronization
by new code, and in any case is only being used in cargo-cult fashion
here.  These test cases all do synchronous exceptions, there's
literally nothing to synchronize against.

    (And in this case they're exposing a legacy wart.  On platforms where:

    1. SMP=y, which causes irq_lock() to be implemented as a somewhat
       complicated global lock

    2. No ARCH_EXCEPT() macro is defined, which causes the kernel to
       use a fallback that simply aborts the current thread.

    ...this test will then abort a thread holding the lock, which will
    cause it to be orphaned (if it weren't a legacy API, the kernel
    should probably attempt to clean it up in k_thread_abort(), but it
    is, and it doesn't), so the next attempt to lock it will hang.
    And it's even worse, because this test builds with SMP=y and
    MP_NUM_CPUS=1, so the hand will happen with interrupts masked on a
    system with only one CPU, and everything will lock up solid.)

Fixes #41877

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2022-01-19 15:10:55 -05:00
Mahesh Mahadevan 27cf263673 tests: arch: arm_irq_vector_table: Update to run on MXRT595
Update the custom vector table to add the OS Event timer
interrupt which is used on RT595 as the kernel system timer

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-01-19 13:35:09 -06:00
Antony Pavlov 3c6d749e49 tests: kernel: fatal: add MIPS exception comments
We don't use TLB at the moment. Jumping to address 0 (USEG)
leads to TLB exception (instruction fetch).

Division by zero leads to TRAP exception.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
2022-01-19 13:48:21 -05:00
Antony Pavlov 59c7507e1a tests: kernel: context: add MIPS support
This test requires explicit architecture support, which this commit
adds for MIPS.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
2022-01-19 13:48:21 -05:00
Flavio Ceolin 5a7040f4ba tests: pm: Add a power domain test
Add simple test to exercise power domain behavior
with device runtime.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-01-19 13:35:32 -05:00
Jordan Yates 00317ef53a tests: pm: power_domains: initial demo
Add an initial demonstration of a physical power domain running on the
`qemu_cortex_m3` platform.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-19 13:35:32 -05:00
Gerard Marull-Paretas b768fb6f94 tests: lib: devicetree: drop get_dev_data/get_dev_config usage
Replace all get_dev_data()/get_dev_config() accessor utilities with
dev->data and dev->config.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas bbcd112335 tests: drivers: i2c: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Daniel Leung 7dac931e36 tests: kernel/events/event_api: memory coherence fixes
When CONFIG_KERNEL_COHERENCE=y, the k_event struct objects
cannot be declared on stacks since they are incoherent among
CPUs in the system.

So mark them as static to place them in global data section
and thus are coherence between CPUs.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-18 20:26:42 -05:00
Andy Ross 96b4a86a51 test: boards/intel_adsp: Add test of adsp_mem API
Add a simple board-specific test of the memory mapping driver.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-18 19:18:30 -05:00
Andy Ross 4796037cf7 tests/kernel/queue: Coherence fixes for tests/kernel/queue
When CONFIG_KERNEL_COHERENCE=y, it's not legal to place shared data
(like the queue elements in this test case) on the stack, because that
memory is incoherent with respect to other CPUs in the system.

Make them static (another option would have been to mark the test case
1cpu).

Fixes #41860

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2022-01-18 19:18:09 -05:00
Enjia Mai e61e63e33f tests: interrupt: refine the interrupt testcases
This PR include 2 changes to refine the testcases:
1. Now we using IPI to trigger interrupt in testing instead of INT
   instruction, this means we don't need to hardcode the vector
   number. That can avoid some problem.

Fixes: #40374

2. Refined the test cases. Tigger interrupt by INT instruction and
   IPI cannot be masked by irq_disabled(). Unless it's a external
   interrupt, such as a timer. Now remove those incorrect part of
   these testcases.

Signed-off-by: Enjia Mai <enjiax.mai@intel.com>
2022-01-18 13:24:28 -05:00
Andrei Emeltchenko b565683aec tests: ibecc: Fix using global device pointer
Removing global device pointer fixes issues with uninitialized device.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-01-18 13:22:53 -05:00
Andrei Emeltchenko 69ac4b29de edac: ibecc: Refactor error inject code
Refactor code removing duplicated parts.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-01-18 13:22:53 -05:00
Tomasz Bursztyka d02ef74d86 tests/ivshmem: Make sure it enters usermode before testing the driver
So it will also test the ivhmem usermode handlers.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-18 13:22:25 -05:00
Andrew Hedin 7f004f1b35 net: lwm2m: Add LwM2M gateway object
Add support for the gateway object [EXPERIMENTAL] used by the
MG100, BT510, and BT610 LwM2M demo.

Signed-off-by: Andrew Hedin <andrew.hedin@lairdconnect.com>
2022-01-18 13:19:12 -05:00
Krzysztof Chruscinski 1e74821896 tests: logging: log_api: Fix test suite setup
After switching to new ztest suite was wrongly setup and
no tests were run. Replaced ## with macro that resolves
and concatenates.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-18 13:12:38 -05:00
Jim Shu e2d67d60ba tests: mem_protect: enlarge heap size of RISCV64
Because k_thread size in RISCV64 is near 512 bytes, (num_of_thread *
256) bytes heap size is not enough. Enlarge heap size in RISCV64
to the (num_of_thread * 1024) bytes like x86_64 and ARM64.

Signed-off-by: Jim Shu <cwshu09@gmail.com>
2022-01-18 13:11:36 -05:00
Gerard Marull-Paretas ddc168fa78 pm: s/PM_DEVICE_(DT_(INST))_REF/PM_DEVICE_(DT_(INST))_GET
In order to align with macros used to obtain a device reference (e.g.
DEVICE_DT_GET), align the PM macros to use "GET" instead of "REF". This
change should have low impact since no official release has gone out yet
with the "REF" macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-18 12:14:06 -05:00
Gerson Fernando Budke 58936e7639 soc: arm: atmel_sam: samv71: Fix SPI build dependency
The SAM spi driver depends on GPIO driver to work. It seems that this
dependency chain it is not handled. This select GPIO driver when SPI
driver is enabled. It rework GPIO and SPI Kconfig to select driver by
devicetree and drop entries at Kconfig.defconfig.series file.

Fixes #41525

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-01-18 12:12:52 -05:00
Carlo Caione 8edf9817c0 tests/kernel/smp: Add SMP switch torture test
Formalize and rework the issue reproducer for #40795 and add it to the
SMP test suite.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-01-18 12:05:54 -05:00
Anders Storrø 54271d23e8 Bluetooth: Mesh: Bsim test for LPN terminate cb
Test covering a corner case scenario where the LPN has received a
friend offer, but has not yet established a connection. In this case
the LPN terminate callback should not be triggered if the LPN is
disabled, which is monitored by this test.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2022-01-18 10:41:18 -05:00
Emil Gydesen ffd4fd571a Bluetooth: CSIS: Merge the two client discovery functions
Merges bt_csis_client_discover and
bt_csis_client_discover_sets, as they should be done
together for the discovery procedure from the CSIP
spec.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen e9703294b1 Bluetooth: CSIS: Rename bt_csis_client_set
Rename struct bt_csis_client_set to
struct bt_csis_client_csis_inst, as that is more descriptive
of the actual content of the struct.

This also avoids the confusion about what a "set" is,
which is clearly not a single instance of CSIS
on a single remote server.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen 47e23ab344 Bluetooth: CSIS: Add bt_csis_client_set_info struct
Several APIs worked on the bt_csis_client_set struct,
which not only included information about a set, but
also a reference to a specific CSIS instance.

A specialized struct only for the set information
is more useful in those scenarios.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen 3953289fda Bluetooth: CSIS: Modify bt_csis_client_get_lock_state to read all members
Modify bt_csis_client_get_lock_state to be the Ordered Access
procedure, which means that instead of reading a single lock value
on a single device, it will read the lock value for all
set members supplied in the function, and return true if any
of them is locked, or false otherwise.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen f13aa0e059 Bluetooth: CSIS: Remove addr from bt_csis_client_set_member
Remove the addr struct from bt_csis_client_set_member as that
was only used by the upper layers and not the CSIS client
itself, and as such should only reside in the
upper layers.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen f2401ecbe9 Bluetooth: CSIS: Don't expose SIRK type to upper layers
Change how the SIRK is exposed to the upper layers.
The SIRK will always be the unencrypted 16 octet
SIRK now, instead of a struct.

This not only allows us to avoid having a
__packed struct in the API, but also gives a better
API as we don't expose encrypted data to the upper layers.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen 061fb633a5 Bluetooth: CSIS: Remove conn from bt_csis_client_lock_changed_cb
The connection pointer can be inferred based on the
set pointer, by using e.g. CONTAINER_OF.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen fa1be6436a Bluetooth: CSIS: Refactor bt_csis_client_discover_sets to use member
Refactor bt_csis_client_discover_sets to use the
bt_csis_client_set_member struct instead of a bt_conn.
The bt_csis_client_set_member represents a remote server
(set member), and make it possible to avoid sending indexes
of instances around instead of bt_csis.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen 728f390f65 Bluetooth: CSIS: Remove unused functions and callbacks from csis.h
Remove the lock and release sets functions, as well
as the discover member function as they have been removed
from the implementation a while ago.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen 2bf89990ee Bluetooth: CSIS: Expose bt_csis to client via bt_csis_client_set_member
Use the bt_csis_client_set_member struct to store the individual
bt_csis client struct. This way they are exposed to the
client application.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Flavio Ceolin 3a57a8060e tests: pm_multicore: Avoid possible race condition
Use the given cpu argument in the policy callback to
avoid possible race condition.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-01-18 10:27:35 -05:00
Anders Storrø 499c4fb1e3 Bluetooth: Mesh: Add LPN-disable BabbleSim test
Adds test to check correct behaviour for disabling
LPN feature.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2022-01-17 15:49:46 -05:00
Krzysztof Chruscinski 262cc55609 logging: Deprecate v1, default to v2
Reduced logging mode selection to deferred, immediate, minimal and
frontend. Decoupled logging version from mode and created CONFIG_LOG1
which can be used to explicitly select deprecated version.

From now on, chosing CONFIG_LOG_MODE_{IMMEDIATE,DEFERRED} will result
in version2.

Deprecated CONFIG_LOG2_MODE_{IMMEDIATE,DEFERRED} with cmake warning.

Codebase adapted to those changes.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-17 15:49:10 -05:00
Alexander Mihajlovic 1cd1f41d3a tests: drivers: adc: Add support for nucleo_wl55jc
Add support for nucleo_wl55jc board to adc_api test.

Signed-off-by: Alexander Mihajlovic <a@abxy.se>
2022-01-17 11:48:30 -05:00
Henrik Brix Andersen dc7903c0dc tests: drivers: can: stm32: filter out boards without st,stm32-can
Filter out boards without st,stm32-can compatibles enabled in their
devicetree in the stm32-specific CAN driver test.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-17 11:47:28 -05:00
Manojkumar Subramaniam 0757678514 tests: drivers: STM32: Enabling ADC tests for nucleo_h7a3zi_q
This commit enables test_adc to build and run for this new board

Signed-off-by: Manojkumar Subramaniam <manoj@electrolance.com>
2022-01-17 11:45:21 -05:00
Jordan Yates bb00120e8b tests: drivers: adc: test dummy ADC driver
Add a testcase for compiling the dummy `vnd,adc` driver.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-17 08:13:41 -05:00
Francois Ramu f6c0362664 tests: drivers: spi loopback remove conf for most of the stm32 boards
The testcase is including a generic configuration conf
for the stm32 target boards when running the SPI loopback in
interrupt and DMA mode. Thus, the board specific conf file is useless.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-01-14 10:09:00 -06:00
Francois Ramu a7d2b2a9f9 tests: drivers: spi loopback testcase on spi2 for stm32 boards
Overwrites the overlay for testing the SPI2 when running on
nucleo_f302r8 and 96b_carbon targets.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-01-14 10:09:00 -06:00
Francois Ramu a3680c1b00 tests: drivers: spi loopback testcase yaml for stm32 dma
This commit adds two stm32 config to execute the testcase
when the SPI is using interrupt mode for transfer.
when the SPI is using DMA for transfer (not Interrupt nor ASYNC mode).
to run the on some specific (listed) stm32 boards on SPI instance.
Note the hw fixture (physical connection on the board)

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-01-14 10:09:00 -06:00
Dominik Chat 3e6ab47455 sensors: Implement MPU9250 driver
MPU9250 driver for 9-axis
gyroscope, accelerometer, magnetometer

Signed-off-by: Dominik Chat <dominik.chat@nordicsemi.no>
2022-01-14 12:33:04 +01:00
Andy Ross 528bef2d22 lib/os: Add sys_winstream lockless shared memory byte stream IPC
It's not uncommon to have Zephyr running in environments where it
shares a memory bus with a foreign/non-Zephyr system (both the older
Intel Quark and cAVS audio DSP systems share this property).  In those
circumstances, it would be nice to have a utility that allows an
arbitrary-sized chunk of that memory to be used as a unidirectional
buffered byte stream without requiring complicated driver support.
sys_winstream is one such abstraction.

This code is lockless, it makes no synchronization demands of the OS
or hardware beyond memory ordering[1].  It implements a simple
file/socket-style read/write API.  It produces small code and is high
performance (e.g. a read or write on Xtensa is about 60 cycles plus
one per byte copied).  It's bidirectional, with no internal Zephyr
dependencies (allowing it to be easily ported to the foreign system).
And it's quite a bit simpler (especially for the reader) than the
older cAVS trace protocol it's designed to replace.

[1] Which means that right now it won't work reliably on arm64 until
we add a memory barrier framework to Zephyr!  See notes in the code;
the locations for the barriers are present, but there's no utility to
call.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2022-01-13 14:01:23 -05:00
Morten Priess 7c89f1fe9f Bluetooth: controller: Support for separate ISO RX data path
Provides interface, data structures and demuxing capability for ISO RX
PDU allocation and transport from LLL to HCI.
Uses the RXFIFO composite for simplicity and reduced overhead.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2022-01-13 10:32:37 +01:00
Tom Burdick 0e96f59e83 dma: Add suspend resume implementation for edma
Implement the suspend and resume transfer api calls for NXP's eDMA.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-01-12 17:33:48 -05:00
Daniel Leung 8113b59c02 tests: mslab_api: remove double asterisk inside func comments
Doxygen treats "/**" as documentation even if the comment block
is inside the function. So remove the extra asterisk for those
"TESTPOINT" comments.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-12 16:02:16 -05:00
Daniel Leung 8f7f62869a tests: remove @return doc for void functions
For functions returning nothing, there is no need to document
with @return, as Doxgen complains about "documented empty
return type of ...".

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-12 16:02:16 -05:00
Anas Nashif 5e05393afa tests: ztress: fix dependency on SMP
Use CONFIG_MP_NUM_CPUS=1 with ztress and do not disable SMP completely.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-01-12 14:13:21 -05:00
Krzysztof Chruscinski d68c99c517 tests: ztest: ztress: Disable for qemu_cortex_a9
Disable test for platform since it fails there for unknown
reason.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-12 08:49:59 -05:00
Krzysztof Chruscinski af335f85d9 tests: ztest: ztress: Test tweaks and disabling SMP
Disable SMP in the test. Minor tweaks in the test.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-12 08:49:59 -05:00
Krzysztof Chruscinski 902cff3d62 tests: lib: ringbuffer: Update test to use ztress
Updated test to use stress testing framework instead of implementing
own framework.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-11 18:19:44 -05:00
Mark Holden 7b2b283677 debug: coredump: allow for coredump backends to be defined outside of tree
Move coredump_backend_api struct to public header so that custom backends
for coredump can be defined out of tree. Create simple backend in test
directory for verification.

Signed-off-by: Mark Holden <mholden@fb.com>
2022-01-11 18:17:24 -05:00
Daniel Leung 7d561a3ea5 tests: lib/mem_blocks: add test for heap listeners
This adds simple tests to make sure the heap listener interface
works with memory blocks allocator.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-11 16:10:53 -05:00
Daniel Leung 7f06fb4129 tests: lib/mem_blocks: add tests for multi mem_blocks allocator
This adds a few tests to make sure the multi memory blocks
allocator functions work correctly.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-11 16:10:53 -05:00
Daniel Leung 50f8f3caea tests: add new tests for the new memory blocks allocator
This adds some new tests to make sure the new memory blocks
allocator work correctly.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-11 16:10:53 -05:00
Gerard Marull-Paretas 97cc216957 tests: drivers: gpio: gpio_basic_api: add support for gd32vf103v_eval
Add DT overlay to run gpio_basic_api test on GD32VF103V-EVAL board. In
order to make testing easy a couple of accessible pins have been
selected: PD0 and PD1 pins exposed via JP13 and JP4 respectively.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-01-11 11:50:35 +01:00
Francois Ramu 0434c1fcb8 tests: drivers: uart async on stm32h743 nucleo board
connect USART2 D53 / TX (pd5) to D52 / RX (pd6)
on the ARDuino connector CN9 of the nucleo board

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-01-11 11:49:23 +01:00
Yuval Peress ab1caef8c3 ztest: Update ztest with more powerful testing APIs
1. Test suites in prior ztest serve no purpose other than logical
ordering of tests into a named-group. Move the construct of setup and
teardown into the test suite and away from individual tests.
Additionally, add the constructs of before/after to the test suites.
This model more closely resembels other testing frameworks such as gTest
and Junit.
2. Test can be added to a suite by using ZTEST() or ZTEST_F() where _F
stands for fixture. In the case where _F is used, the argument `this`
will be provided with the type `struct suite_name##_fixture*`. Again,
this models other modern testing frameworks and allows the test to
directly access the already set up data related to the test suite.
3. Add the concept of test rules (from Junit). Rules are similar to the
before/after functions of the test suites but are global and run on all
suites. An example of a test rule can be to check that nothing was
logged to ERROR. The rule can cause the test to fail if anything was
logged to ERROR during an integration test. Another example would be a
rule that verifies that tests ran within some defined timeout.

Signed-off-by: Yuval Peress <peress@google.com>
2022-01-11 11:47:30 +01:00
Jim Shu 5a93c74ba3 tests: disable division-by-zero test in RISC-V arch
Because RISC-V arch (M extension) doesn't trigger exception for
division-by-zero, this test can't support RISC-V and is disabled in
RISC-V.

Signed-off-by: Jim Shu <cwshu@andestech.com>
2022-01-11 11:47:03 +01:00
Gerard Marull-Paretas 8d41e13ada tests: pm: policy_api: test policy behavior
Add a new test to verify the policy API behavior. Test also checks that
custom policies can be implemented.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-11 10:46:20 +01:00
Gerard Marull-Paretas 696caa0524 pm: policy: return a reference to the next state
Return a constant reference to the next state instead of a copy of
struct pm_state_info. When the next state should be active, just return
NULL. Struct copying should be in general avoided, specially in code
paths executed frequently as is this one.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-11 10:46:20 +01:00
Peter Mitsis 192265c661 tests: pipes: Add pipe flush tests
Extends the pipes tests to include tests for k_pipe_flush() and
k_pipe_buffer_flush().

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2022-01-10 12:17:14 -05:00
Lixin Guo 76a4c6dc72 tests: workq: add support for null name parameter
Validate k_work_queue_start() API with null name config, this should
not affect the name of queue's thread.

Signed-off-by: Lixin Guo <lixinx.guo@intel.com>
2022-01-10 11:03:01 -05:00
Daniel Leung be9779753f tests: lib/heap: add test for heap listeners
This adds test to make heap listeners are working correctly.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-10 10:28:04 -05:00
Daniel Leung ae415272c1 sys: heap_listener: extend to cover more events
This extends the heap_listener to cover more events,
specifically, allocation, free and realloc.

Note that typedef are used so the callback can be
documented.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-10 10:28:04 -05:00
Daniel Leung 39d17a180a sys: heap_listener: resize_cb to also take heap ID
Add a parameter to the resize callback to also take the heap ID.
This allows a single callback to be used for multiple heaps if
so desired.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-10 10:28:04 -05:00
Henrik Brix Andersen e0ac59f31c tests: canbus: isotp: implementation: switch to DEVICE_DT_GET()
Switch from using device_get_binding() to DEVICE_DT_GET().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-10 11:24:51 +01:00
Henrik Brix Andersen b8d8b69440 tests: canbus: isotp: conformance: switch to DEVICE_DT_GET()
Switch from using device_get_binding() to DEVICE_DT_GET().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-10 11:24:51 +01:00
Henrik Brix Andersen 5d05d2e3c7 tests: drivers: can: timing: switch to DEVICE_DT_GET()
Switch from using device_get_binding() to DEVICE_DT_GET().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-10 11:24:51 +01:00
Henrik Brix Andersen c8f72460be tests: drivers: can: fd: switch to DEVICE_DT_GET()
Switch from using device_get_binding() to DEVICE_DT_GET().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-10 11:24:51 +01:00
Henrik Brix Andersen 1c4d10b8f7 tests: drivers: can: api: switch to DEVICE_DT_GET()
Switch from using device_get_binding() to DEVICE_DT_GET().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-10 11:24:51 +01:00
Henrik Brix Andersen 8af4bb722d drivers: can: rename API functions for better consistency
Rename a few CAN API functions for clarity and consistency with other
Zephyr RTOS APIs.

CAN_DEFINE_MSGQ() becomes CAN_MSGQ_DEFINE() to match K_MSGQ_DEFINE().

can_attach_isr() becomes can_add_rx_filter() since a filter callback
function is not an interrupt service routine (although it is called in
isr context). The word "attach" is replaced with "add" since filters are
added, not attached. This matches the terminology used is other Zephyr
APIs better.

can_detach() becomes can_remove_rx_filter() to pair with
can_add_rx_filter().

can_attach_msgq() becomes can_add_rx_filter_msgq() and documentation is
updated to mention its relationship with can_add_rx_filter().

can_register_state_change_isr() becomes can_set_state_change_callback()
since a state change callback function is not an interrupt service
routine (although it is called in isr context). The word "register" is
replaced with "set" since only one state change callback can be in
place.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-10 10:44:37 +01:00
Francois Ramu e5554d741c tests: drivers: spi loopback with DMA testing on stm32h743 nucleo
with this config, the testcase PASSED on the nucleo_h743zi
using DMA for SPI transfer (through DMAMUX request)
Connect pins D11 and D12 on the ARDUIno connector CN7

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-01-07 15:06:28 -06:00
Erwan Gouriou b5b32b9b3e tests/drivers/clock_control: stm32: Add test suite for H7 series
Add clock_control test suite for H7 boards

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-01-07 18:19:16 +01:00
Erwan Gouriou fc23da19af tests/drivers/clock_control: stm32u5: Factorize tests in yaml file
To ease maintenance, add a common section.
It appears that using DTC_OVERLAY_FILE in the common section
preserves the required overlay order.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-01-07 18:19:16 +01:00
Erwan Gouriou 73c1233461 tests/drivers/clock_control: stm32u5: Add a pll_msis_160 overlay
Instead of relying on default board configuration,
add a specific test for this config.

Additionally rename existing pll_msi_80 to pll_msis_160.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-01-07 18:19:16 +01:00
Erwan Gouriou 228a96e41e tests/drivers/clock_control: stm32u5: Use a clear_clocks overlay
Instead of relying on existing board clock configuration,
use a clear_clocks.overlay file to first reset the clock
configuration to the default .dtsi state, then apply a
new configuration.
This method should be more robust when trying to use on more
boards and has the benefit to provide correct configuration
examples.

This relies on the fact that overlays are applied in the order
they are provided in DTC_OVERLAY_FILE CMake variable.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-01-07 18:19:16 +01:00
Erwan Gouriou c6fd75af54 tests/drivers/clock_control: stm32: Move u5 tests in dedicated folder
Before adding more tests, organize things a little.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-01-07 18:19:16 +01:00
Tomasz Bursztyka 20b653f387 tests/x86: Improve ACPI output on info test
Print out DMAR's device id for each device scopes.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Daniel DeGrasse e6cac6f029 tests: disk: Add fixture for sdcard test
Add fixture disk_sdcard for the sdcard test, since the test requires an
SD card to be present on the board.

Fixes #41331

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-07 08:01:22 -06:00
Immo Birnbaum aa6245603b tests: subsys: logging: revert #40848
revert #40848 which excluded certain logging test cases on qemu_cortex_a9
due to #39978.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2022-01-07 07:58:43 -06:00
Immo Birnbaum 095d92a697 tests: subsys: logging: revert #40842
revert #40842 which excluded certain logging test cases on qemu_cortex_a9
due to #39978.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2022-01-07 07:58:43 -06:00
Herman Berget 6ede31428d Bluetooth: Host: Reassemble extended advertising reports
The host reassembles fragmented advertising reports from the controller.

Non-complete advertising reports from different advertisers may not be
interleaved. If non-complete advertising reports from an advertiser
is received while advertising reports from another advertiser is
reassembled, an error message is logged and the advertising report is
discarded. Future scan results may be incomplete.

Advertising reports from legacy PDUs or complete extended advertising
reports may be interleaved as these do not require reassembly.

If the controller sends more advertising data than fits in the
reassembly buffer, the data is truncated. Further advertising reports
from the advertiser are discarded until the final complete advertising
report is received and discarded.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-01-07 15:35:39 +02:00
Jakub Rzeszutko 2caf587095 tests: lib: getopt
Add tests for the getopt library.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2022-01-06 21:26:59 +01:00
Jordan Yates d336954d1c tests: remove manual `CONFIG_GPIO_EMUL`
Remove the manual selection of `CONFIG_GPIO_EMUL` as it is now enabled
by default when devicetree nodes exist.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-06 11:56:15 -05:00
Dino Li e79b6f1a81 tests: drivers: gpio: basic: add it8xxx2_evb test configuration
Add basic GPIO API test configuration for the IT8XXX2.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-01-05 14:57:54 -05:00
Gerard Marull-Paretas 38d583bbf4 tests: drivers: gpio: gpio_basic_api: add support for gd32f403z_eval
Add DT overlay to run gpio_basic_api test on GD32F403Z-EVAL board. In
order to make testing easy a couple of accessible pins have been
selected: PD0 and PD1 pins exposed via P3 and P2 respectively.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-01-04 20:49:00 -05:00
Gerard Marull-Paretas 3bf7a7a326 tests: drivers: gpio: gpio_basic_api: add support for gd32f450i_eval
Add DT overlay to run gpio_basic_api test on GD32F450I-EVAL board. In
order to make testing easy a couple of accessible pins have been
selected: PC6 and PC7, the last 2 pins on the DCI camera 2.54" header.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-01-04 20:49:00 -05:00
Henrik Brix Andersen 2ff9de3741 tests: drivers: can: timing: enable loopback tests on native_posix
Enable the CAN timing tests on native_posix and native_posix_64.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-04 15:13:40 -06:00
Henrik Brix Andersen 5bc57c1139 tests: drivers: can: api: enable loopback tests on native_posix
Enable the CAN driver loopback tests on native_posix and
native_posix_64.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-04 15:13:40 -06:00
Henrik Brix Andersen 99a310b29b drivers: can: loopback: convert the CAN loopback driver to dts
Convert the CAN loopback driver from being configured via Kconfig to
multi-instance configured via devicetree.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-04 15:13:40 -06:00
Flavio Ceolin 23335e1cc1 tests: pm: mgmt_soc: Remove log in state notification entry
The notification is sent after the subsystem select the power state to
use and after suspend devices. The callback should not try to access a
device. In this case, uart through LOG macros.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-01-04 15:04:57 -06:00
Flavio Ceolin 451667c1da tests: pm: mgmt_soc: Cleanup headers
Removed not necessary headers.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-01-04 15:04:57 -06:00
Flavio Ceolin cd495321de tests: pm: mgmt_soc: Use PM_STATE_COUNT
Use PM_STATE_COUNT to know the number of existent states.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-01-04 15:04:57 -06:00
Gerard Marull-Paretas 32bea9a7fb tests: lib: devicetree: use vnd,gpio-device
The vnd,gpio-device compatible is now used by the test GPIO driver
(CONFIG_GPIO_TEST) introduced in #41387. This means that we can't define
new devices with this compatible when CONFIG_GPIO=y.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-01-04 14:44:07 -05:00
Enjia Mai e8119640c0 tests: benchmark: fix code coverage incorrect for latency_measure
Fixing code coverage data cannot be generated correctly when running
tests/benchmark/latency_measure test suite. This is because the gcov
data do not generate completely when the measuring thread stop. So
our solution is:

In main(), just waiting for the measuring thread to complete before
the gcov data start to dump out, to make sure all the gcov data can
be output completely.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-01-04 11:53:17 -05:00
Jedrzej Ciupis fcda8699cb drivers: timer: extend nrf_rtc_timer
This commit introduces the following changes:

* nrf_rtc_timer is extended with a capability to handle RTC overflow,
allowing it to operate on absolute RTC ticks, rather than relative
ticks.
* overflow handling is ZLI-proof and relies on the sys clock
handler being executed twice every RTC counter's overflow.
* callbacks are given an absolute RTC tick value as a parameter instead
of CC register's value. The absolute RTC tick value is the RTC counter
value set during CC channel configuration extended to 64 bits.
* in case the timer's target time is in the past or is the current tick,
the timer fires as soon as possible, however still from the RTC's ISR
context.
* in case an active timer is set again with the same target time, it is
not scheduled again - only its event data is updated. Otherwise, the
timer is scheduled as usual.
* a scheduled timer can be aborted.
* system clock functions are now using 64 bit values internally.

Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Signed-off-by: Paweł Kwiek <pawel.kwiek@nordicsemi.no>
2022-01-04 17:44:32 +01:00
Lixin Guo b5b629a115 tests: work: add support for k_work_flush() API
Add test for flushing work items in order, see if it works
as expected.

Signed-off-by: Lixin Guo <lixinx.guo@intel.com>
2022-01-04 09:27:18 -05:00
Lixin Guo 874c893b03 tests: work: add support for k_work_queue_unplug API
Validate unplug a already unplugged queue, this should not
affect the status of queue and return expected value.

Signed-off-by: Lixin Guo <lixinx.guo@intel.com>
2022-01-04 09:27:18 -05:00
Lixin Guo ef7e01091e tests: work: add support for work_cancel_sync API
Add test for cancelling unqueued(idle) work items, this should not
affect the work item and return value as expected.

Signed-off-by: Lixin Guo <lixinx.guo@intel.com>
2022-01-04 09:27:18 -05:00
Daniel DeGrasse f6497e37da tests: kernel: Fix assumption in test_kernel_cpu_idle
test_kernel_cpu_idle assumes that CPU's next timer wakeup will be
1 millisecond in the future based on kernel timer it sets. Move tick
synchronization delay into test loop so this will always be the case.

Fixes #41347

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-04 09:13:57 -05:00
Francois Ramu 433424d1ca tests: drivers: uart async on stm32wl55jc nucleo board
connect USART1 D1 / TX (pb6) to D0 / RX (pb7)
on the ARDuino connector CN9 of the nucleo board

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-01-04 09:12:32 -05:00
Francois Ramu 8f8830e22a tests: drivers: spi loopback on the stm32wl55jc nucleo board
connect SPI1 MISO pin D12 (pa6) on SPI1 MOSI pin D11 (pa7)
on the ARDuino connector CN5 of the nucleo board

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-01-04 09:12:32 -05:00
Francois Ramu 148db8b187 tests: drivers: dac loopback on stm32wl55jc nucleo board
define DAC1 output1 on PA10 (ARD connector A2)
define ADC1 in1 on PB14 (ARD connector A4)
connect A2 to A4 on the nucleo target board (CN8)

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-01-04 09:12:08 -05:00
Jordan Yates ca6a329c9f tests: drivers: remove custom `vnd,gpio` inst
Remove the custom GPIO driver instantiation for `vnd,gpio` compatibles
in "build_all" tests. The devices are now instantiated in `gpio_test.c`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-04 09:10:40 -05:00
Piotr Pryga 26a66ee299 tests: Bluetooth: df: Fix not building unit tests
There were changes done to controller code that cause
tests to do not build and fail during execution.
Changes are related with:
- modified code related with extended advertising ADI
  field handling
- added generic double buffer data structure that is
  used in controller
- moved code that was building only when DF is enabled
- added EVENTS_PHYEND that is not available in nrfbsim
  board

The PR addresses those issues.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-01-04 09:10:05 -05:00
Piotr Pryga 578902960d Bluetooth: Controller: Add CTE recv and sample in connected mode
In connected mode when Receiving Constant Tone Extensions feature
is enabled, controller shall be able to receive CTE in any
data channel packet.
The commit adds required changes to allow receive of CTE for
all data channel packets in peripheral role.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-01-04 09:10:05 -05:00
Sebastian Bøe 5536e6198b tests: arm_thread_swap_tx: nucleo_l552ze_q: Update flash partition
Due to a recent change in TFM, some more space should be allocated
to mcuboot flash partition (some space should be allocated for OTP)
(Cf commit db07170a34f ("Platform: Allocate space in flash for OTP")
in trusted-firmware-m repo)
Take this into account and increase mcuboot flash partition for
nucleo_l552ze_q_ns target.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2022-01-04 12:33:23 +01:00
Jimmy Brisson 2e1f26fd77 Tests: disable mps3_an547_ns fpu sharing test
TFM disables the FPU on this target, so the test will usagefault
with a NOCP exception type when run.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Signed-off-by: Jimmy Brisson <jimmy.brisson@linaro.org>
2022-01-04 12:33:23 +01:00
Alberto Escolar Piedras 8baee12f71 tests: bsim: Make all tests scripts executable
Test scripts should be executable.
The regression system will work around it by making them executable
if they are not, but that causes changes to the local tree.
Fix it instead so people doesn't get local changes when running regression.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2022-01-04 11:06:19 +01:00
Alberto Escolar Piedras 2e3acec199 tests: bsim: Use different sim_ids for different tests
Different tests should use different simulation ids so they don't
collide with each other at random when run in parallel.
Fix it.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2022-01-04 11:06:19 +01:00
Aleksandr Khromykh 18569edbea bsim: test: fix missing warnings in bsim test build system
bsim test build system hides compile warnings.
The problem had been fixed before but due to a regression came again.
This commit adds extra cc flags to prevent this.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2022-01-03 20:35:20 +01:00
Henrik Brix Andersen b1b77c1774 drivers: can: change can_tx_callback_t function signature
Change the can_tx_callback_t function signature to use an "int" (not an
uint32_t) for representing transmission errors.

The "error" callback function parameter is functionally equivalent to
the return value from can_send() and thus needs to use the same data
type and needs to be able to hold negative errno values.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-01 07:40:29 -05:00
Gerard Marull-Paretas c0fff657c5 pinctrl: use groupN instead of pinsN for groups
The pinsN group name can be a confusing in some circumstances, so change
it to groupN. Some platforms (e.g. nrf or gd32) are already using
groupN. Documentation and API tests have been updated.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-01 07:39:08 -05:00
Gerard Marull-Paretas 5dc6ed3ce3 pinctrl: require ; after PINCTRL_DT_(INST_)DEFINE macros
The PINCTRL_DT_(INST_)DEFINE macros already defined the trailing ;,
making its usage inconsistent with other macros such as
DEVICE_DT_DEFINE.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-01 07:39:08 -05:00
Mark Holden 7803a4e590 arch: riscv: ARCH_EXCEPT macro
Enable ARCH_EXCEPT macro for non-usermode scenario for RISC-V
Macro will now raise an illegal instruction exception so that mepc will
hold expected value in exception handler, and generated coredump can
reconstruct the failing stack

Coredump tests running on renode (for RISC-V) can now utilize fatal error
path through k_panic

Signed-off-by: Mark Holden <mholden@fb.com>
2022-01-01 07:38:20 -05:00
Krzysztof Chruscinski 525c316716 tests: ztest: Add test for stress test framework
Add testsuite for ztress.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-01 07:37:22 -05:00
Vinayak Kariappa Chettimada 48f4eb9a4e tests: Bluetooth: bsim: Test updated to use Periodic Sync Recv Enable
Updated the ISO BabbleSim test to use Periodic Sync Receive
enable command to disable Periodic Sync reports and yet
receive the BIGInfo report.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-12-29 18:01:17 +01:00
Lixin Guo 0ef5dac70e tests: workq: add support for k_work_queue_init()
According to documentation, the memory of struct: k_work_q should
be zeroed.

Signed-off-by: Lixin Guo <lixinx.guo@intel.com>
2021-12-24 20:47:03 -05:00
Pavel Vasilyev b1d2bb0b47 tests: Bluetooth: Mesh: Add tests to cover message publication
This commit adds 3 tests that check:
- Publish period state
- Publish retransmit count and interval steps states
- Canceling periodic publication and publication retransmission

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2021-12-23 14:57:54 +01:00
Andrzej Głąbek 7fa4a33ea1 tests/lib/devicetree/devices: Exclude thingy52_nrf52832 platform
This test cannot be built for thingy52_nrf52832, as this board uses
regulator devices that need the SX1509B GPIO expander driver that
in turn depends on I2C which needs to be disabled in this test.
Commit b579c12714 addressed a similar
problem for hsdk platforms by excluding those. Use the same solution.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-12-23 12:51:01 +01:00
Aleksandr Khromykh 0350e38d62 test: Bluetooth: Mesh: fix racing between bsim devices in provisioning test
Bsim devices work asynchronously before access to Phy.
Interprocess OOB communication might be broken because of this.
PR adds synchronization for devices. Drift is 100ms between them.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2021-12-23 11:20:08 +01:00
Henrik Brix Andersen d1ff466ceb tests: drivers: can: fd: remove can_attach_workq() tests
Remove the tests for can_attach_workq().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-12-22 18:04:02 +01:00
Henrik Brix Andersen aace49f600 tests: drivers: can: api: remove can_attach_workq() tests
Remove the tests for can_attach_workq() and convert the
test_send_receive_buffer() test case to using a message queue.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-12-22 18:04:02 +01:00
Andries Kruithof fca65843b9 Bluetooth: controller: inclusive naming for EDTT
Update the testnames according to the Bluetooth 5.3 specification
for inclusive naming

Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
2021-12-22 17:49:36 +01:00
Piotr Pryga c0889b0cc1 tests: Bluetooth: df: remove duplicated code from CTE req tests
There is a common implementation of connection handling code
that may be shared by tests: connection_cte_req and connection_cte-
tx_params.
This commit removes code implemented in common.c and common.h
files. The same code is currently available in ../df/common/
directory.
All calls were updated to use function from common implementation.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-12-22 12:18:17 +01:00
Piotr Pryga d4b0cbee8e tests: Bluetooth: df: Add tests for set conn CTE TX params
Add unit tests for HCI command HCI_LE_Set_Connection_CTE_-
Transmit_Parameters.

Part of a code that was available in df/connection_cte_req/common.c,
related with artificial handling of connection, is moved to
df/common/bt_conn_common.c.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-12-22 12:18:17 +01:00
Krzysztof Chruscinski d65654518f tests: drivers: gpio: gpio_basic_api: nrf: Extend test
Extend test configuration for nrf52840dk to validate use of
GPIO SENSE and GPIOTE IN event for edge interrupts.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-12-22 12:03:00 +01:00
Nicolas Pitre a3a31257df net: npf: add the ability to do MAC address masked matching
Add the ability to do matching on partial MAC addresses.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2021-12-21 17:06:35 +01:00
Nicolas Pitre faa0b2a848 net: introduce a network packet filter framework
This provides the infrastructure to create network packet filter rules
and to apply them to the RX and TX packet paths. Rules are made of
simple condition tests that can be linked together, creating a facility
similarly to the Linux iptables functionality.

A couple of generic and Ethernet-specific condition tests are also
provided.

Additional tests can be easily created on top of this.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2021-12-21 17:06:35 +01:00
Krzysztof Chruscinski 62b57651e8 logging: Cleanup in log_instance
Cleanup in log_instance.h:
 - prefixing internal macros with Z_
 - adding doxygen documentation
 - using COND_CODE_1 instead of ifdefs

Additionally, added LOG_INSTANCE_PTR macro which allows to get
pointer to instance. It can be used to reuse single instance
for multiple module layers when doing instance logging.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-12-21 09:36:09 +01:00
Henrik Brix Andersen b3c1eea269 Revert "tests: Bluetooth: Mesh: Add tests to cover message publication"
This reverts commit 9b99ab6896.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-12-21 07:46:26 +01:00
Carles Cufi 38ce8d615d Revert "drivers: timer: extend nrf_rtc_timer"
This reverts commit 26e297572a.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-20 21:04:26 +01:00
Yong Cong Sin 215571ad64 tests: drivers: build_all: Build MHZ19B
Include MH-Z19B in the build all test.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2021-12-20 18:47:47 +01:00
Michael Schmidt 557870c05f drivers: virt_ivshmem: Allow multiple instances of ivShMem devices.
- Supporting multiple instances of ivShMem virtual devices.
- Introduces DT based configuration for ivShMem devices.
- Add DTS overlay file to test new multiple ivshmem instance capability.
- Enable BDF unspecified device initialization.
  (limited to one instance. An improved version of pcie_bdf_lookup()
  will come soon that fixes this limitation)
- Make PCIE DTS file macros available for a proper ivshmem device
  properties parsing.

Sample for dts file:
pcie0 {
	label = "PCIE_0";
	#address-cells = <1>;
	#size-cells = <1>;
	compatible = "intel,pcie";
	ranges;
    ivshmem0: ivshmem@800 {
	    compatible = "qemu,ivshmem";
	    reg = <PCIE_BDF_NONE PCIE_ID(0x1af4,0x1110)>;
	    label = "IVSHMEM";
	    status = "okay";
    };
};

Signed-off-by: Michael Schmidt <michael1.schmidt@intel.com>
2021-12-20 19:42:27 +02:00
TOKITA Hiroshi da68cde759 tests: skip arch_nop test when machine timer uses divided sys clock
When the case machine timer clock uses the divided system clock,
k_cycle_get_32() can't measure accurately how many cycles elapsed.

For example, use the value as timer clock obtained by dividing
the system clock by 4.
In this case, measuring a duration with k_cycle_get32() has up to 3
(4-1) cycles systematic error.

To run this test, we need to insert an appropriate of nops
with consideration for the errors.
'nop' can not repeat with for loop.
Must insert as separated statement.
But we don't have a convenient function such as
BOOST_PP_REPEAT in C++.

At this time, Implementing a generic test is a bit difficult.
Skipping this test in the case.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2021-12-20 17:51:30 +01:00
TOKITA Hiroshi 1421c1728b coredump: add support for Longan Nano boards
Longan Nano boards pass the test that with calling coredump().

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2021-12-20 17:51:30 +01:00
Lukas Gehreke 53dea67733 drivers: modem: Added simcom sim7080 modem driver.
Implemented driver for the simcom sim7080 modem.
This driver features Socket offloading, TCP, UDP, DNS,
SMS, GPS and FTP.

Signed-off-by: Lukas Gehreke <lk.gehreke@gmail.com>
2021-12-20 17:48:47 +01:00
Henrik Brix Andersen 2269408572 dts: bindings: can: remove #address-cells and #size-cells
Remove the requirement for specifying #address-cells and #size-cells
properties for CAN controller devicetree nodes.

CAN controllers do not have a common concept of devicetree child nodes
and thus have no need for these properties. This is in line with
upstream Linux kernel devicetree bindings.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-12-20 17:45:05 +01:00
Robert Lubos 860e59e881 tests: net: ipv6: Verify Route Info data in Router Advertisment
Verify that Route Info data received in Router Advertisment creates a
route and correctly populates the net_route_entry structure.

Additionally, extend the MTU on the test interface, to accomodate the
extended Router Advertisement message.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-12-20 17:44:28 +01:00
Robert Lubos 111992bb71 tests: net: route: Add new route tests
Add new route tests to cover lifetime and preference functionality.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-12-20 17:44:28 +01:00
Robert Lubos e9db822635 net: route: Add support for route preference
Implement a concept of Route Preference, as specified in RFC 4191. The
Zephyr host will prefer routes with higher preference, if they lead to
the same prefix through different neighbours.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-12-20 17:44:28 +01:00
Pavel Vasilyev 9b99ab6896 tests: Bluetooth: Mesh: Add tests to cover message publication
This commit adds 3 tests that check:
- Publish period state
- Publish retransmit count and interval steps states
- Canceling periodic publication and publication retransmission

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2021-12-20 17:42:24 +01:00
Jedrzej Ciupis 26e297572a drivers: timer: extend nrf_rtc_timer
This commit introduces the following changes:

* nrf_rtc_timer is extended with a capability to handle RTC overflow,
allowing it to operate on absolute RTC ticks, rather than relative
ticks.
* overflow handling is ZLI-proof and relies on the sys clock
handler being executed twice every RTC counter's overflow.
* callbacks are given an absolute RTC tick value as a parameter instead
of CC register's value. The absolute RTC tick value is the RTC counter
value set during CC channel configuration extended to 64 bits.
* in case the timer's target time is in the past or is the current tick,
the timer fires as soon as possible, however still from the RTC's ISR
context.
* in case an active timer is set again with the same target time, it is
not scheduled again - only its event data is updated. Otherwise, the
timer is scheduled as usual.
* a scheduled timer can be aborted.
* system clock functions are now using 64 bit values internally.

Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Signed-off-by: Paweł Kwiek <pawel.kwiek@nordicsemi.no>
2021-12-20 16:25:49 +01:00
Torsten Rasmussen 52ff0cf208 cmake: tests: add cmake_minimum_required() to tests
Adding cmake_minimum_required() as this is required by CMake.

CMP0000 is a deprecated policy which allows to omit this function call,
however doing so will result in CMake printing a warning.

Adding cmake_minimum_required() to tests missing this call will remove
the warning and also allow us to remove the policy setting.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-12-18 14:58:55 +01:00
Damian Krolik 3aedda9852 lib: os: add heap event listener
* add generic heap event listener module that can be used
  for notifying an application of heap-related events
* use the listener module in newlib libc hooks
* add a unit test

Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
2021-12-18 07:49:15 -05:00
Jimmy Johnson 5c28b218fa drivers: sensor: add ti tmp108 driver support
Adding support for the TI TMP108 temperature sensor. This includes
over/under temp interrupt support as well as one shot, continuous
conversion and power down modes.

Signed-off-by: Jimmy Johnson <catch22@fastmail.net>
2021-12-17 21:15:25 +01:00
Anas Nashif 05ecd46a84 tests: fix typos and misnamed platforms
Various obsolote and misnamed platfomrs in test filters theat went
undetected for a while.

Fixes #41222

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-12-17 12:24:37 -05:00
Gerard Marull-Paretas 0c0ad3d332 tests: lib: devicetree: api: test DT_INST_PARENT
Check that DT_INST_PARENT behavior is correct. Re-uses existing overlay
definitions (child of TEST_SPI_BUS_0) to test the behavior.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-16 11:10:01 -06:00
Gerard Marull-Paretas 91b8abfb4d pm: device_runtime: suspend device on enable
The pm_device_runtime_enable did not suspend devices, so it assumed that
the device was in a physically suspended state. This change makes sure
that device is left in a suspended state if the device is initially
active.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-16 10:41:04 +01:00
Gerard Marull-Paretas 59b455eb9c pm: device_runtime: simplify error handling for get/put
In case runtime PM is not enabled (or not built-in), the get/put
functions always return 0 (instead of -ENOTSUP/-ENOSYS). When runtime PM
is disabled, a device is left into active state. Similarly, when device
runtime PM is not built-in, it is safe to assume that a device will
be active when it is called. If a user implements a custom solution, it
is its responsability to make sure that a device is active when using
it. For all these reasons, the -ENOTSUP/-ENOSYS are error codes that
should always be ignored by devices using get/put, since in practice it
means that: device is active, function is a no-op. The example below
illustrates how error handling is simplified:

```c
/* before: safe to ignore -ENOSYS/-ENOTSUP since device is active (we
 * can continue)
 */
ret = pm_device_runtime_get(dev);
if ((ret < 0) && (ret != -ENOSYS) && (ret != -ENOTSUP)) {
	return ret;
}

/* now */
ret = pm_device_runtime_get(dev);
if (ret < 0) {
	return ret;
}
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-16 10:41:04 +01:00
Michał Narajowski da1663ed3b test/bluetooth/tester: Use Health Client Unack API
Unacknowledged API is now separate from Ack.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-12-16 10:15:36 +01:00
Asbjørn Sæbø bd3f5d9b2b Bluetooth: Audio: Increase L2CAP buffer count
Increase the L2CAP buffer count, for the media control shell to work.

(The buffer count was set to an even higher value in the
topic-le-audio branch, but that setting was not upmerged.)

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2021-12-15 14:59:55 -05:00
Asbjørn Sæbø fabbb87986 Bluetooth: Audio: Enable controller extended and periodic adv for tests
The le-audio host shell enables extended advertising.  Therefore, for
the shell to be usable, extended and periodic advertising must also be
enabled for the controller.

The controller configuration are added to board-specific files for the
time being, as the advertising features are still experimental
upstream.

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2021-12-15 14:59:55 -05:00
Krzysztof Kopyściński 0f6dc7a3cd bluetooth: tester: allow to set DisplayYesNo IO capability
This allows us to run SCPK tests with it.

signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-12-15 15:08:37 +01:00
Flavio Ceolin 8cd6744498 tests: pm: Test state lock with runtime
Add device pm state lock to device runtime test.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-12-14 19:23:05 -05:00
Flavio Ceolin 28ca83f097 tests: pm: Test pm device state lock
Test pm device state lock API.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-12-14 19:23:05 -05:00
Flavio Ceolin 18b932f10d pm: device_runtime: Return possible error on enable
Change the function pm_device_runtime_enable() to return 0 on
success or an error code in case of error.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-12-14 19:23:05 -05:00
Bartosz Bilas 0bd304f9d9 drivers: sensor: ina23x: add support for INA237
Add the new driver for INA237 variant which is
quite similar to the already supported INA230.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-12-14 13:48:54 -06:00
Bartosz Bilas 2df7140947 drivers: sensor: ina230: driver refactoring
Create an explicit ina230 driver which is supposed to
work with 230 and 231 variants. While at it switch
to i2c_dt_spec helpers and change device-tree node
names to use - instead of _ in order to follow
convention.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-12-14 13:48:54 -06:00
Ederson de Souza bdaac354f4 kernel: Bring back object tracking
When CONFIG_TRACING_OBJECT_TRACKING is enabled, the kernel will keep
lists of some objects (detailed below), so that debuggers or other tools
can keep track of them.

The lists of objects are:

struct k_timer *_track_list_k_timer;
struct k_mem_slab *_track_list_k_mem_slab;
struct k_sem *_track_list_k_sem;
struct k_mutex *_track_list_k_mutex;
struct k_stack *_track_list_k_stack;
struct k_msgq *_track_list_k_msgq;
struct k_mbox *_track_list_k_mbox;
struct k_pipe *_track_list_k_pipe;
struct k_queue *_track_list_k_queue;

Note that while CONFIG_TRACING is needed, one can always use
CONFIG_TRACE_NONE=y. Also, tracking will only be done for objects that
are also being traced (so, to prevent tracking of some type of object,
such as k_timer, just make CONFIG_TRACING_TIMER=n).

Some simple "sanity checking" tests are also added in this patch.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2021-12-14 07:42:31 -05:00
Lixin Guo d7bbfabfc3 tests: work: exclude hifive1 board
Exclude hifive1 board from tests/kernel/workq/work/kernel.work,
this board has a issue with this test suite and block all related
CI.

Signed-off-by: Lixin Guo <lixinx.guo@intel.com>
2021-12-14 07:41:41 -05:00
Alexandre Bourdiol d252740923 tests: drivers: pwm_loopback: nucleo_h743zi: change PWM output pin
PA1 is connected to ethernet RMII Reference Clock signal
and it impacts the TIMER signal.
Change to PA3 on Arduino A0 connector

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-12-13 20:34:13 -05:00
NingX Zhao 3419038bc1 tests: improve the testcases of queue
In test_queue_append_list_error function, try to append an unnormal
list to check if the data is successful to append, and improve the
coverage for queue.c

Signed-off-by: NingX Zhao <ningx.zhao@intel.com>
2021-12-13 20:31:35 -05:00
Daniel DeGrasse 90b7fb0dd1 tests: drivers: disk: Add disk driver test
Adds a disk driver test, intended for the NXP USDHC driver but valid for
any disk device. The test performs multiple reads and writes to the
disk, and verifies that the driver does not write out of bounds to the
provided buffer.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-13 20:30:06 -05:00
Daniel DeGrasse 1067c2fdb7 tests: arch: arm: irq_vector_table Add correct ISR table for iMX.RT SOCs
RT1xxx SOCs using the GPT timer require a custom ISR table for the arm
irq_vector_table test, since they use a custom system timer implemented
using the GPT peripheral. Implement the required vector tables within
the irq_vector_table test to enable it to run.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-13 20:13:21 -05:00
Daniel DeGrasse 369a54514f tests: kernel: threads: Correct test assertion in thread_apis test
Thread APIs test for k_busy_wait incorrectly asserted that a delay of
100 us should produce a delay in cycles less than or equal to to 100 cycles
of the hardware clock. Since most hardware clocks are fast, this assertion
was valid, but it does not test for the actual delay.

Fix the assertion to verify that a delay of 100 us produces a delay in
cycles less than or equal to 100 us worth of hardware clock cycles.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-13 20:13:21 -05:00
Daniel Leung c1ac125068 tests: coredump: skip acrn_ehl_crb
The coredump tests output quite a large amount of data into
the console. However, the ACRN console only has very limited
history (comparatively), such that twister is unable to
match the necessary strings to consider the tests passed.
So skip those tests on acrn_ehl_crb.

Fixes #40887

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-12-13 19:27:24 -05:00
Aymeric Aillet 50540ed594 driver: i2c: TCA9546A: Rename to TCA954x
Prepare the driver to upcoming support of more mux references.
Rename all TCA9546A related files to TCA954x.
Keep ti,tca9546a and ti,tca9546a-channel compatible
for backward compatibility reasons.
New tca954x-base binding embedding common properties,
tca9546a binding inherits from it and define its own compatibles fields.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2021-12-13 18:07:08 +01:00
Kent Hall ce95e033fb tests: drivers: counter: Update tests for STM32F4 timer counter driver
Updates counter driver test suite to support STM32F4 timers.

Signed-off-by: Kent Hall <kjh2166@columbia.edu>
2021-12-11 14:20:17 -05:00
Johann Fischer 5296339fde usb: rework to use macro STRUCT_SECTION_FOREACH
Replace deprecated macro USBD_CFG_DATA_DEFINE by
USBD_DEFINE_CFG_DATA which places usb_cfg_data structures
in specific iterable section.

Replace __usb_data_start, __usb_data_end usage patterns
  size_t size = (__usb_data_end - __usb_data_start);
  for (size_t i = 0; i < size; i++) {...}
by
  STRUCT_SECTION_FOREACH(usb_cfg_data, ...) {...}

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 07:22:15 -06:00
Carles Cufi 0b96dd419d tests: lib: mpsc_pbuf: Fix address-of-packed-mem warning
The warning below appears once -Waddress-of-packed-mem is enabled:

/__w/zephyr/zephyr/tests/lib/mpsc_pbuf/src/main.c: In function
'item_put_data_overwrite':
/__w/zephyr/zephyr/tests/lib/mpsc_pbuf/src/main.c:497:3: error:
converting a packed 'struct test_data_ext' pointer (alignment 1) to a
'uint32_t' {aka 'const unsigned int'} pointer (alignment 4) may result
in an unaligned pointer value [-Werror=address-of-packed-member]
  497 |   mpsc_pbuf_put_data(&buffer, (uint32_t *)&item, len);

To avoid the warning, as well as several others related to the same
problem, use an intermediate void * variable.

More info in #16587.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-10 14:08:59 +01:00
Carles Cufi cfbaac6733 tests: kernel: Fix address-of-packed-mem warning
The warning below appears once -Waddress-of-packed-mem is enabled:

/__w/zephyr/zephyr/tests/kernel/mem_protect/userspace/src/main.c: In
function 'test_main':
/__w/zephyr/zephyr/tests/kernel/mem_protect/userspace/src/main.c:1024:17:
error: converting a packed 'k_thread_stack_t' {aka 'struct
z_thread_stack_element'} pointer (alignment 1) to a 'struct
z_x86_thread_stack_header' pointer (alignment 4096) may result in an
unaligned pointer value [-Werror=address-of-packed-member]
 1024 |  hdr = ((struct z_x86_thread_stack_header *)ztest_thread_stack);

To avoid the warning, use an intermediate void * variable.

More info in #16587.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-10 14:08:59 +01:00
Flavio Ceolin f3718ed701 tests: pm: s/power/pm tag
Use tag "pm" in power management tests.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-12-10 07:43:01 -05:00