Commit graph

12590 commits

Author SHA1 Message Date
Peter Mitsis 8d40d3ba30 tests: latency_measure: Update sample output
Updates the sample output in the latency_measure benchmark's
README file to cover events.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2024-01-08 10:10:21 +01:00
Peter Mitsis a8914c56d2 tests: latency_measure: Add events
Adds events to the latency_measure benchmark.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2024-01-08 10:10:21 +01:00
Arkadiusz Cholewinski b3e1cc9f4f PM: Add testing pm_device_state_str function.
Add testing pm_device_state_str function in device_driver_init testcase.

Signed-off-by: Arkadiusz Cholewinski <arkadiuszx.cholewinski@intel.com>
2024-01-05 14:47:14 -05:00
Piotr Narajowski cf174804fb bluetooth: tester: Add CCP Tests
Adding support for remaining CCP test cases.
Also removing callback descriptions from btp files not to get confused
with header files.

Signed-off-by: Piotr Narajowski <piotr.narajowski@codecoup.pl>
2024-01-05 14:41:52 -05:00
Peter Mitsis 38010c111e test: latency_measure: Update sample output
Updates the sample output in the latency_measure benchmark's
README file.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2024-01-05 14:35:53 +01:00
Peter Mitsis 7103b0cdeb tests: latency_measure: Add FIFO support
Adds FIFO support to the latency_measure benchmark. This covers
both k_fifo_put() and k_fifo_get() with and without context switches
as well as variations for userspace support.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2024-01-05 14:35:53 +01:00
Peter Mitsis c2d2cf6d2b tests: latency_measure: Add LIFO support
Adds LIFO support to the latency_measure benchmark test. This covers
both k_lifo_put() and k_lifo_get() with and without context switches
as well as variations for userspace support.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2024-01-05 14:35:53 +01:00
Peter Mitsis 911182c6b9 tests: latency_measure: Change reporting strings
Changes the summary lines used in the latency_measure benchmark
so that they follow a consistent pattern.

    OBJECT  action.<brief details about action>

This makes it easier to locate results belonging to a particular
object group. It also has the benefit to keep results colocated
should the output be sorted by an external tool.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2024-01-05 14:35:53 +01:00
Peter Mitsis 6291a57e67 tests: latency_measure: Tidy up header inclusions
Moves the inclusion of the app_memdomain header file into the
tests' utils.h so that any file that includes this can make
use of the BENCH_BMEM macro.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2024-01-05 14:35:53 +01:00
Jonathan Rico 7127c2a733 tests: Bluetooth: Add debug options to host/l2cap/stress
Enable quality-of-life kconfig options.
Add destroy callbacks to track lifetime of app buffers.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-01-05 14:30:18 +01:00
Emil Gydesen 87c8b897b3 include: util: Add mem_xor functions
Add functions to do XOR on arrays of memory, with one that
takes arbitrary sizes and one for 32 bits and 128 bits as
those are common sizes for this functionality.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-01-05 09:06:36 +01:00
Erik Brockhoff 5f99c36ca1 Bluetooth: controller: fix procedure collision handling
If an instant based remote procedure 'overtakes' a local ditto
the local procedure will be 'completed' by remote rejection
but collision flag would not get set ensuring that a new local
conflicting procedure cannot be started before the remote is completed.
This can thus lead to invalid local initiation.

Added unittest to cover case

Fix by ensuring collision flag is set also in the above mentioned
scenario.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2024-01-05 09:05:26 +01:00
Manuel Argüelles 7e2600d309 tests: drivers: pwm: add overlays for ucans32k1sic
Enable pwm tests on ucans32k1sic board.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2024-01-05 09:03:00 +01:00
Fabio Baltieri e517af4cff charger: add a driver for bq25180
Add a driver for the TI BQ25180. Implement enable/disable and current
set/get.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-01-05 09:00:21 +01:00
Robert Lubos 312e000a5f tests: net: socket: tls: Fix race on TCP socket close
One of the tests closed the underlying TCP connection right after
establishing one. This caused a certain race between incoming TLS
handshake data and entering FIN1 state (experienced on nrF52840), where
the TLS handshake data could be received after the FIN1 state was
entered, causing the server side to send RST packet. This disrupted the
test flow, as graceful TCP connection teardown was expected.

Fix this, by adding a small delay for such case to avoid the race.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-01-04 17:10:15 -06:00
Christopher Friedt 80e3f4aee6 tests: posix: common: rwlock: remove overspecified pthread_attr_t
Much of tests/posix/common still overspecifies pthread_attr_t
options.

Default thread attributes are perfectly fine for the vast
majority of spawned threads in this testsuite, so simply use
a NULL pthread_attr_t* argument.

This fixes piles of bugs because we have not properly used
pthread_attr_destroy() appropriately.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-04 15:13:47 -05:00
Christopher Friedt e14f362547 tests: posix: common: sem: remove overspecified pthread_attr_t
Much of tests/posix/common still overspecifies pthread_attr_t
options.

Default thread attributes are perfectly fine for the vast
majority of spawned threads in this testsuite, so simply use
a NULL pthread_attr_t* argument.

This fixes piles of bugs because we have not properly used
pthread_attr_destroy() appropriately.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-04 15:13:47 -05:00
Christopher Friedt 90021b81d5 tests: posix: common: pthread: do not overspecify pthread_attr_t
Much of tests/posix/common still overspecifies pthread_attr_t
options.

Default thread attributes are perfectly fine for the vast
majority of spawned threads in this testsuite, so simply use
a NULL pthread_attr_t* argument.

This fixes piles of bugs because we have not properly used
pthread_attr_destroy() appropriately.

This is only a partial cleanup for pthread.c

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-04 15:13:47 -05:00
Christopher Friedt d9cffcfc36 tests: posix: common: mutex: remove overspecified pthread_attr_t
Much of tests/posix/common still overspecifies pthread_attr_t
options.

Default thread attributes are perfectly fine for the vast
majority of spawned threads in this testsuite, so simply use
a NULL pthread_attr_t* argument.

This fixes piles of bugs because we have not properly used
pthread_attr_destroy() appropriately.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-04 15:13:47 -05:00
Christopher Friedt bfb4a5141c tests: posix: common: mqueue: remove overspecified pthread_attr_t
Much of tests/posix/common still overspecifies pthread_attr_t
options.

Default thread attributes are perfectly fine for the vast
majority of spawned threads in this testsuite, so simply use
a NULL pthread_attr_t* argument.

This fixes piles of bugs because we have not properly used
pthread_attr_destroy() appropriately.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-04 15:13:47 -05:00
Christopher Friedt aefbbe2788 tests: posix: common: key: remove overspecified pthread_attr_t
Much of tests/posix/common still overspecifies pthread_attr_t
options.

Default thread attributes are perfectly fine for the vast
majority of spawned threads in this testsuite, so simply use
a NULL pthread_attr_t* argument.

This fixes piles of bugs because we have not properly used
pthread_attr_destroy() appropriately.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-04 15:13:47 -05:00
Rodrigo Peixoto 2cfd28e5ca tests: zbus: add HLP priority boost tests
Add the dedicated tests for HLP priority boost.

Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
2024-01-04 09:41:54 +01:00
Rodrigo Peixoto 73f0bcc7fc tests: zbus: fix unit tests to work with priority boost
The test considers using zbus inside ISR.

Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
2024-01-04 09:41:54 +01:00
Sebastian Bøe c25ac487af tests: crypto: rand32: Check return code of sys_csrand_get
Check the return code of sys_csrand_get when testing the function.

Ignoring it is bad practice and can also be a security issue if users
copy-paste this test code.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2024-01-03 23:57:13 -06:00
Christopher Friedt 67a74e4350 tests: posix: test_realtime: improve test reliability
Previously posix_apis.test_realtime was failing (very)
frequently in CI, and in particular, when running on Qemu,
POSIX, or SMP targets.

We are using CLOCK_REALTIME for this test, which incurs an
additional syscall overhead above CLOCK_MONOTONIC. The act
of sleeping itself also incurs a syscall overhead.

The latency from one iteration to the next of the internal
loop is a bit of a random process due to scheduler or clock
noise (although the noise itself is still bounded).

In order to make this test robust against such noise, assert
only on the average time from one iteration to the next,
rather than the instantaneous time.

Rather than calculating a sample mean, use a running average
(aka Cumulative Moving Average) to save some bytes.

Report results, including low and high watermarks before
asserting that the average iteration time within expected
range.

==============================================================
START - test_realtime
I: n: 20, sleep: 100, margin: 10, lo: 110, avg: 110, hi: 110
 PASS - test_realtime in 2.198 seconds
==============================================================

Expect to see the low and high watermarks change more on
Qemu and POSIX platforms when running several jobs in parallel
with twister (such as in CI).

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-04 08:27:29 +09:00
Christopher Friedt 1695b5a0b2 tests: unit: util: add array for-each tests
Add tests for the following two macros

* ARRAY_FOR_EACH(array, idx_var)
* ARRAY_FOR_EACH_PTR(array, ptr_var)

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-04 08:27:29 +09:00
Jukka Rissanen fa0e04e2ed tests: net: dhcpv6: Adjust the source address of test pkt
We would drop the received packet if the source address is our
address so tweak the test and make source address different.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-01-03 19:00:33 +00:00
Jukka Rissanen 155e2149f2 tests: net: ipv6: Adjust the source address of test pkt
We would drop the received packet if the source address is our
address so tweak the test and make source address different.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-01-03 19:00:33 +00:00
Robert Lubos 48601fde96 tests: net: socket: tls: Make sure sockets are closed on test failure
Add after() function for the test suite, which does cleanup on still
open sockets. Otherwise, an individual test case failure affects all
other test cases, blurring the test suite results.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-01-03 19:00:15 +00:00
Robert Lubos f70715eeb3 tests: net: socket: tls: Add more tests covering poll()
Add new test cases, covering TLS/DTLS socket poll() functionality.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-01-03 19:00:15 +00:00
Krzysztof Chruściński c0bb064d4e tests: unit: util: Fix compliance check warnings
As code is moved from test.inc to main.c a compliance check is
run for the first time on that code. Fixing warnings.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-01-02 16:01:11 +00:00
Krzysztof Chruściński 7b872d11ba tests: unit: util: Rework test structure for C++ testing
Rework test structure to handle C++ test in a better way. Similar
approach already applied in other tests which are executed for C
and C++. Getting rid of test.inc which due to non-standard extension
was not covered by complience check.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-01-02 16:01:11 +00:00
Jeremy Bettis 5a727a382a drivers: Add level intrs in gpio_ite_it8xxx2_v2
Implement level based gpio interrupts, by using a worker queue to
repeatedly call the gpio callbacks until the gpio is no longer active.

Update unit test for new interrupts.

Bug #66401

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2024-01-02 10:10:39 +01:00
Jeremy Bettis 6c567d4899 tests: Add unittest for gpio_ite_it8xxx2_v2
Add a unittest for 100% of the lines in gpio_ite_it8xxx2_v2. The test
fakes the registers by overriding the ECREG macro to call a function
provided by the test.

Does not test the code guarded by
CONFIG_SOC_IT8XXX2_GPIO_GROUP_K_L_DEFAULT_PULL_DOWN

Bug #66401

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2024-01-02 10:10:39 +01:00
cyliang tw d00125875c tests: drivers: adc: adc_api: support numaker_pfm_m467
Add support for Nuvoton numaker board numaker_pfm_m467.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2024-01-02 10:10:27 +01:00
Mariusz Skamra 4a77bdb4e8 tests: Bluetooth: tester: Add initial support for HAP
This adds initial support for Hearing Aid Profile BTP service commands.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2024-01-02 10:10:15 +01:00
Christopher Friedt 10156f5f1d posix: mqueue: pop mode as int with va_arg()
There was some discussion about whether it was suitable to have
an architecture-specific workaround in mqueue.c after that
workaround was copied to a different source file in a PR.

The original issue was that newlib and picolibc declare mode_t
to be unsigned short instead of unsigned long when __svr4__
is not defined along with __sparc__. This is specifically
impactful, because va_arg() deals (mainly) with 32-bit and
64-bit values that are all naturally aligned to 4 bytes.

#if defined(__sparc__) && !defined(__sparc_v9__)
#ifdef __svr4__
typedef unsigned long __mode_t;
#else
typedef unsigned short __mode_t;
#endif

A uint16_t is naturally aligned to 2 bytes, so not only would
a 16-bit mode_t be corrupted, it would also generate a warning
with recent gcc versions which is promoted to error (rightfully
so) when run through CI.

mqueue.c:61:35: error: 'mode_t' {aka 'short unsigned int'} is
  promoted to 'int' when passed through '...' [-Werror]
   61 |                 mode = va_arg(va, mode_t);

Instead of using an architecture-specific workaround, simply
add a build assert that the size of mode_t is less than or
equal to the size of an int, and use an int to retrieve it
via va_arg().

Signed-off-by: Christopher Friedt <cfriedt@meta.com>

# Please enter the commit message for your changes. Lines starting
# with '#' will be kept; you may remove them yourself if you want to.
# An empty message aborts the commit.
#
# Date:      Fri Dec 29 10:06:44 2023 -0500
#
# On branch posix-mqueue-always-use-int-for-mode-t-va-arg
# Changes to be committed:
#	modified:   lib/posix/mqueue.c
#	modified:   tests/posix/common/testcase.yaml
#
2024-01-01 16:36:31 -05:00
Krzysztof Chruściński b46d961abf tests: lib: cbprintf_package: Add test case for cbprintf_convert
Add test case for converting statically generated package which
contains RO and RW indexes. Converting shall append RW string
and discard RO index.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2023-12-28 12:18:50 +00:00
Pieter De Gendt cc920696ed tests: unit: util: Add tests for IF_DISABLED
Add a testcase for the IF_DISABLED macro.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-12-28 12:06:28 +00:00
Christopher Friedt 1f67dcbd89 posix: remove deprecated non-standard PTHREAD_MUTEX_DEFINE, etc
Remove the previously deprecated and non-standard macros
* PTHREAD_MUTEX_DEFINE()
* PTHREAD_COND_DEFINE()

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-28 03:40:57 -05:00
Fabio Baltieri 4307882dd1 input: kbd_matrix: add actual key mask runtime control
Add an option to enable a input_kbd_matrix_actual_key_mask_set API to
enable or disable keys dynamically in the mask. This can be useful if
the exact key mask is determined in runtime and the device is using a
single firmware for multiple matrix configurations.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-12-27 16:50:21 +00:00
Théo Battrel ba80bc7134 Tests: Bluetooth: Fix conn_stress compilation warn
On newer GCC version warnings were emitted because of a `memcpy`. The
size parameter was larger than the source's size because it was using
the size of the destination, which was a `bt_uuid_128` when the source
is a `bt_uuid_16`.

Fix the issue by creating a new variable for CCC UUID in both the
central and peripheral code. The variable need to be static because the
discover parameters must remain valid until the start of the discover
attribute callback.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-12-27 16:07:46 +00:00
Andrei Emeltchenko 5d0ba230b8 tests: samples: watchdog: Add intel_rpl_p_crb overlay
Add overlay to enable watchdog for build test and sample.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-12-27 16:06:19 +00:00
Bindu S 3974882b42 tests: drivers: spi: spi_loopback: Enabled SPI in RPL-P
Added overlay and conf to enable SPI tests on RPL-P board.

Signed-off-by: Bindu S <bindu.s@intel.com>
2023-12-27 16:06:19 +00:00
Anisetti Avinash Krishna b14feec6c4 boards: x86: rpl_crb: rpl_p_crb: Enabled GPIO in RPL-p
Enabled GPIO basic api test for RPL-P platform

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2023-12-27 16:06:19 +00:00
Ian Wakely 2a647c81cf board: Fixing ADC API tests for W5500_EVB_PICO.
When duplicating the rpi_pico board, I had missed this test file.

Signed-off-by: Ian Wakely <raveious.irw@gmail.com>
2023-12-27 16:04:26 +00:00
Mateusz Junkier 949e5120d3 pm: increase coverage - add missing api tests
add missing api tests reported by codecov

Signed-off-by: Mateusz Junkier <mateusz.junkier@intel.com>
2023-12-27 15:57:39 +00:00
Mateusz Junkier 501e67acd2 pm: increase coverage - add missing test assert
cover missing lines reported by codecov

Signed-off-by: Mateusz Junkier <mateusz.junkier@intel.com>
2023-12-27 15:57:39 +00:00
Christopher Friedt b702c8e8f0 tests: posix: pthread: test that big stacks can be allocated
In some cases, users want to allocate (comparatively) massive
thread stacks.

Add a test to ensure we can allocate such a stack by default.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-23 22:29:41 -05:00
Anas Nashif 0b999c0943 lib: move utilities into own folder
Move various utilities out of lib into own folder for better assignement
and management in the maintainer file. lib/os has become another dumping
ground for everything and it the Kconfig and contents in that folder
became difficult to manage, configure and test.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-22 09:54:12 +01:00
Anas Nashif e86b44751c tests: usb: move bc12 tests under tests/drivers/usb
Move bc12 under usb, this is not a standalone driver subsystem.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-22 09:54:12 +01:00
Anas Nashif f296ea58a3 tests: ieee802154: fix test identifier
Fix test identifier and use correct component.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-22 09:54:12 +01:00
Seppo Takalo 071cad2e76 net: lwm2m: Deprecate lwm2m_get/set_u64
Deprecate lwm2m_set_u64() and lwm2m_get_u64 as only
LWM2M_RES_TYPE_S64 exist. Unsigned variant is not defined.

Technically these might have worked OK, but it is undefined
what happens to large unsigned values when those are
converted to various payload formats (like CBOR) that might
decode numbers differently depending of their signedness.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-12-22 09:54:07 +01:00
Francois Ramu 82bace6e0d tests: drivers: dma test on stm32f7 requires nocache memory
Config the sram0 to be non-cachable to PASS the DMA testcases
chan_blen_transfer and loop_transfer
on the stm32f746zg and stm32f767zi nucleo boards.

The CONFIG_NOCACHE_MEMORY is useless as the memory region
gets the NOCACHE ATTRibutes for stm32H7 or stm32F7 as well.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-12-22 09:53:39 +01:00
Ian Wakely 9835957df0 board: adafruit_qt_py_rp2040: Adding test overlay.
Adding a board overlay for the ADC API driver test.

Signed-off-by: Ian Wakely <raveious.irw@gmail.com>
2023-12-22 09:53:21 +01:00
Fabio Baltieri 8c83185f6e tests: add an kbd_matrix test suite
Add an initial test suite for the keyboard scanning input library.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-12-21 10:12:33 +00:00
Fabio Baltieri 978b0bb5ea tests: input: add a gpio-kbd-matrix test suite
Add an initial test suite for the gpio-kbd-matrix driver.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-12-21 10:12:17 +00:00
Anas Nashif 2b43582236 tests: add a tag for nano libc tests
tag nano libc tests with nano so we can exclude them if needed. Now they
cause issues when collecting coverage information from tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-21 09:18:44 +01:00
Jukka Rissanen 6d41e68352 net: ipv4: Check localhost for incoming packet
If we receive a packet from non localhost interface, then
drop it if either source or destination address is a localhost
address.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-21 09:18:24 +01:00
Christopher Friedt 5c78c66fc2 tests: posix: headers: check for pthread get / set guardsize
Add checks to ensure that pthread_getguardsize() and
pthread_setguardsize() are callable.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-20 14:20:58 +00:00
Christopher Friedt 5e245bd42e tests: posix: tests for pthread_getguardsize() pthread_setguardsize()
Add tests for pthread_getguardsize() and pthread_setguardsize().

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-20 14:20:58 +00:00
Christopher Friedt 746a3b943d tests: posix: use consistent min stack sizes
* Use PTHREAD_STACK_MIN as provided by the specification
  instead of a hard-coded value of 1024
* add extra stack size to semaphore tests

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-20 14:20:58 +00:00
Sylvio Alves ecda72079e esp32: overlays: remove unused dt-binding headers
All overlay headers are not necessary to be included.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-12-20 14:17:49 +00:00
Seppo Takalo 6161fbdf21 net: lwm2m: Transmission state indications
Allow engine to give hints about ongoing CoAP transmissions.
This information can be used to control various power saving
modes for network interfaces. For example cellular networks might
support release assist indicator.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-12-20 11:57:48 +00:00
Anders Storrø 7d373c7c28 Bluetooth: Mesh: Fix broken proxy adv test
Relaxes test requirements for proxy_adv_multi_subnet_coex
to resolve failing test on CI.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-12-20 11:48:18 +01:00
Robert Lubos 0bc8de8444 tests: net: socket: tls: Disable vmu_rt1170 platform
Due to unresolved bug (see #61129 for details) building TLS tests fails
on vmu_rt1170 platform. Therefore disable this platform for this test
suite.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-12-20 11:10:57 +01:00
Robert Lubos a416553dba tests: net: socket: tls: Add more tests covering socket behaviors
A first batch of tests for TLS sockets, covering expected socket
behaviors:
  * Verify that blocking/non-blocking tx/rx work as expected
  * Verify that timeouts on tx/rx are calculated properly
  * Verify proper behaviors when interacting with a socket from
    different threads (close/shutodown/send).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-12-20 11:10:57 +01:00
Robert Lubos be4400e80d tests: net: socket: tls: Add helper for TLS connection establishment
Move the code responsible for TLS connection establishment to a helper
function, as it'll be needed as well in other test cases.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-12-20 11:10:57 +01:00
Robert Lubos 833d565c36 tests: net: socket: tls: Remove unnecessary delay from test cases
SO_TYPE and SO_PROTOCOL test cases does not really establish connection,
so teardown delay at the end is not needed.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-12-20 11:10:57 +01:00
Aleksandr Khromykh ac4cfe9880 Bluetooth: Mesh: remove 20ms tx delay in adv bearer
The recommendation to have 20ms is fair for two
consecutive messages over a single bearer. When mesh
sends two messages it can be interpreted as two
bearers working in parallel. No need to keep
an artificial 20ms delay for that. Delay was
removed and all related bsim tests were fixed.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-12-19 16:20:36 +01:00
Aleksandr Khromykh 8d51a1dac5 tests: Bluetooth: Mesh: relax beacon test time conditions
Some beacon tests have strict time conditions and depend
on randomization interval that doesn't guarantee test pass.
This change fixes strict conditions.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-12-19 16:20:36 +01:00
Dmitrii Golovanov fbe95e4a73 tests: unit: Fix Power-of-Two test build issue
Fix linker error for the PoT test build with code coverage.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-12-19 10:03:47 -05:00
Yong Cong Sin a1042c4079 tests: kernel: timer_behavior: exclude renode instead of boards
We just need to exclude renode simulation and not the physical
boards, let's do just that.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-12-19 07:33:39 -05:00
Andrei Emeltchenko 0223fe897f tests: lib: acpi: Convert to FFF
Convert fake functions to FFF.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-12-19 11:04:19 +01:00
Andrei Emeltchenko 751f871b20 tests: acpi: Add unit test for ACPI table parsing
Initial unit test for ACPI table parsing.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-12-19 11:04:19 +01:00
Andrei Emeltchenko abbbc43be8 tests: acpi: Rename acpi to integration test
Rename test to integration and allow to include unit tests for ACPI.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-12-19 11:04:19 +01:00
Andrei Emeltchenko 8924feb960 tests: Refactor ACPI info sample
Take into account multiple DMAR HARDWARE_UNIT tables.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-12-19 11:04:19 +01:00
Emil Gydesen 8df987935b Bluetooth: MPL: Add track position notifications during seeking
When seeking the media player should notify clients about the
track position change.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-12-19 08:51:21 +01:00
Emil Gydesen cda5e58aa5 Bluetooth: CAP: Commander discovery support
Implement the CAP Commander discovery function.

Adds support for it in the shell.

This includes initial babblesim and unit testing as well.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-12-19 08:50:40 +01:00
Yong Cong Sin 170531eb2d tests: kernel: gen_isr_table: rework multi_level_bit_masks tests
Reworked and combined the multi-level interrupt bit masks tests
to work on any configuration of bits in every level.

Updated the bits configuration in the testcase to use
non-symetric numbers so that shifting a level with the wrong
number of bits will certainly cause the test to fail.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-12-18 15:09:36 -05:00
Daniel Leung 48349351a9 tests: kernel/cache: skip i-cache range tests if Xtensa MMU
With MMU enabled on Xtensa, user_buffer is not marked as
executable. Invalidating the i-cache by region will cause
an instruction fetch prohibited exception. So skip all
i-cache tests, instead of just the range ones to avoid
confusions of only running the test partially.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-12-18 12:25:04 +01:00
Fabio Baltieri f9313b1745 input: add a linux-evdev device
Add a device driver to read events from a Linux evdev device node and
inject them back as Zephyr input events.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-12-18 12:23:59 +01:00
Ryan McClelland 9804c60a4e tests: lib: c_lib: fix double promotion error
Fix double promotion warnings

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-12-18 09:21:12 +00:00
Marek Vedral 0d304b9223 samples: debug: Add support for qemu_cortex_a9 in GDB stub sample
This commit adds a devicetree overlay file and an extra condition in the
CMakeLists.txt file to allow remote debugging for the qemu_cortex_a9
board.

Signed-off-by: Marek Vedral <marek.vedral@gmail.com>
2023-12-18 09:31:42 +01:00
Anders Storrø f70929a8f1 tests: Bluetooth: Mesh: Add proxy adv coex test.
Adds test that verifies correct Proxy advertisement behavior for
a device where the Proxy adv requirements changes over time,
both for single and multiple subnets.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-12-18 09:29:41 +01:00
Anders Storrø 6c67ab3a63 Bluetooth: Mesh: Refactor proxy adv
Refactors proxy advertising implementation to allow fair sharing of
advertising resources between all subnets.

In the new implementation, each subnet is agnostic to any other subnet
that might have active proxy advertisement work. When proxy
advertisement is triggered, the implementation will first check how
many subnets that has active work. If there are more than one active
subnet, a maximum timeslot will be calculated to ensure that all active
subnets get access to the medium. The implementation will then poll
the next eligible subnet for a proxy advertising request. If the
duration of this request exceeds the maximum timeslot, the duration
for the next advertisement will be set to the maximum value.

If a proxy advertisement for a subnet is interrupted by other
advertising activity, the implementation will now ensure that the
interrupted proxy adv continues from the point where it was
interrupted so that the subnet gets to utilize the entire allocated
timeslot.

This PR also alters the priv_proxy_net_id_multi Bsim test to align
with the refactored proxy advertising scheme.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-12-18 09:29:41 +01:00
Pavel Vasilyev fe70e50d41 Bluetooth: Mesh: Added support for randomly delaying publications
The section 3.7.3.1 of the mesh specification recommends to delay
a message publication in certain cases:
- at power-up or upon state change for a time between 20 to 500 ms
- for periodic publications for a time between 20 to 50 ms

This change implements this recommendation by adding the
`CONFIG_BT_MESH_DELAYABLE_PUBLICATION` Kconfig option which enables
the randomization code and by adding the `bt_mesh_model_pub.delayable`
bit field which allows each model decide whether the publications
should be delayed for this model or not.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-12-18 09:29:24 +01:00
Andrej Butok 25cb4683d2 test: mcuboot: enable test on rt1010/1015/1040 and k22f/82f platforms
Enable mcuboot test for mimxrt1010/1015/1040 and frdm_k22f/82f boards

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2023-12-18 09:28:34 +01:00
Peter Mitsis 4e37071f57 tests: disable timeslicing on app_kernel
Updates the app_kernel benchmark so that its default configuration
does not enable timeslicing. As it is still valuable to know what
kind of performance overhead is incurred by enabling timeslicing,
new test configurations have been added.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-12-18 09:28:08 +01:00
Peter Mitsis d84598256c tests: disable timeslicing on latency_measure
Updates the latency_measure benchmark so that its default
configuration does not enable timeslicing. As it is still
valuable to know what kind of performance overhead is
incurred by enabling timeslicing, new test configurations
have been added.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-12-18 09:28:08 +01:00
Peter Mitsis 94829f444c tests: Initialize array in pipe test
As the pointer to the data buffer passed to k_pipe_put() is now a
'const', that buffer must be initialized before calling k_pipe_put()
to avoid a compiler warning.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-12-15 14:51:35 -05:00
Jonathan Rico a05a47573a Bluetooth: ATT: Internalize ATT PDU TX pool
Why?
- metadata is easier to manage as an array + index
  - less error-prone -> less memory-management bugs
- we can. because of the previous refactor
- PDU allocations are more predictable
- ATT buffer size can be optimized by app
- isolates ATT from the rest of the ACL users
  - decouples ATT PDU size from e.g. SMP w/ LESC

Drawbacks:
- higher memory usage
- kconfig change

The higher memory use is only temporary, as this will be followed-up
with more refactors that should bring it back down.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Co-authored-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-12-15 17:14:56 +02:00
Richard Wheatley a40a8a5f49 boards: arm: apollo4p_evb add connector to apollo4p_evb
Generic Connector for the apollo4p_evb
Ran tests/drivers/gpio/gpio_basic_api
Ambiq does not support DUAL Edged Interrupts.
Added Connector Usages as defined by the Ambiq BSP.

Signed-off-by: Richard Wheatley <richard.wheatley@ambiq.com>
2023-12-15 14:35:32 +01:00
Tomasz Moń 3e7368829b usb: device_next: uac2: interface descriptor macros
Add macros to initialize full set of descriptors required for USB Audio
Class 2 instance. Descriptors start with Interface Association
Descriptor that binds together the AudioControl interface and all
AudioStreaming interfaces.

AudioStreaming interfaces have alternate setting 0 without any endpoints
and alternate setting 1 with isochronous endpoint with max packet size
calculated on maximum sample frequency, number of channels, subslot size
and clock synchronization (asynchronous endpoints require +1 sample).

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-12-15 14:24:44 +01:00
Tomasz Moń a825147d0c tests: usb: uac2: test descriptor macros
Compare devicetree generated class specific descriptors for headset
example against reference hex values.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-12-15 14:24:44 +01:00
Joakim Andersson cb13e21eae tests: net: socket: tcp: Fix build for nrf5340dk_nrf5340_cpuapp_ns
Fix build for nrf5340dk_nrf5340_cpuapp_ns.
Test takes up almost all of the flash, leaving no room for the image
to be signed. Disable the bootloader to free up flash-usage.

Fixes: #66469

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2023-12-15 14:05:55 +01:00
Peter Mitsis 6b1a3207dd tests: Fix bias adjustment in latency_measure
Updates the non-blocking semaphore and mutex benchmark sub-tests in
the latency_measure benchmark to remove the timestamp bias adjustment.
As the timestamps are not sampled during each iteration of those
sub-tests, there is no need to correct for any bias from the sampling.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-12-15 11:42:06 +00:00
Juha Ylinen f9fa2ae77c tests: net: coap: Add test case for transmission parameters
Add new test case.

Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
2023-12-15 11:41:27 +00:00
Juha Ylinen d09d3d82ef net: lib: coap: Change coap_pending_init()
Replace function parameter 'retries' with pointer to structure
holding coap transmission parameters. This allows setting the
retransmission parameters individually for each pending request.

Add coap transmission parameters to coap_pending structure.

Update migration guide and release notes.

Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
2023-12-15 11:41:27 +00:00
Flavio Ceolin dca352bfa3 tests: arm64_high_addresses: Remove unused build option
This test does not define any syscall. It does not need to set
CONFIG_APPLICATION_DEFINE_SYSCALL.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-12-14 19:07:39 +00:00
Mariusz Skamra daa7a99b8c tests: bsim: has: Change printk to LOG
Replace combination of printk() to LOG_DBG() to fix the order of the
test execution logs. The printk() is printed immediately, while logs are
buffered, thus the messages from test are printed out before the stack
logs.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-12-14 19:07:28 +00:00
Mariusz Skamra 0b8b67e346 tests: bsim: has: Clean up the #ifdef
Use if(IS_ENABLED(...)) {...} instead.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-12-14 19:07:28 +00:00
Jukka Rissanen 67d21c8b1d tests: net: if: Add test to check device readiness
Add tests that check if device is ready or not, and
then verify the functionality of net_if_up() in that case.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-14 14:21:31 +01:00
Piotr Golyzniak 5a3b9799aa doc: test: improve pytest documentation
Improve documentation about pytest integration with Twister. Add
examples of usage, improve description of available options and
introduce automatic doc generation of two plugin classes (DeviceAdapter
and Shell) basing on their docstrings from source code.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2023-12-14 10:12:21 +01:00
Christopher Friedt 04c9903055 posix: pthread_once: simplify and reduce size of pthread_once_t
Since pthread_once() is both the initializer and executor of
pthread_once_t, it can have maximally two states. Since the
implementation in Zephyr previously aimed to maximize libc
compatibility, we opted to use the definition of pthread_once_t
from newlib, which is a structure with two ints.

It does not make sense to use 64 bits to manage 2 possible
states. The control for that should effectively be a bool.

We maintain compatibility with newlib by asserting (at build
time), that newlib's pthread_once_t is larger than Zephyr's
new struct pthread_once (which just contains a bool).

This allows us to delete the non-standard pthread_key.h
header file (finally).

Reuse the pthread_pool_lock in order to synchronize the related
init function (so that it is only called maximally once from any
thread). The spinlock is only used to test the state and the
init function is not called with the spinlock held.

The alternative was to use an atomic inside of
struct pthread_once. But again, that could be up to 64-bits with
Zephyr's atomics implementation.

Ideally we would use C11 generics or something to support atomics
on 8, 16, 32, and 64-bit primitives.

Lastly, also update declarations for C11 threads as they mostly
mirror our pthread implementation.

This needed to be done as a single commit in order to ensure
continuity of build.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-14 09:32:58 +01:00
Anas Nashif 21561e4e03 tests: coredump: no need for special xtensa entry
We use the same code flow now on all architectures, so no need for a
special entry for xtensa.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-14 09:32:27 +01:00
Anas Nashif 044e2d6bff arch: make CONFIG_EXCEPTION_DEBUG cross arch config
Define CONFIG_EXCEPTION_DEBUG globally and remove architecture specific
definition of config.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-14 09:32:27 +01:00
Armando Visconti 1badec4bfd drivers/sensor: add support to LIS2DU12 accelerometer
The LIS2DU12 is a linear 3-axis accelerometer with advanced digital
functions whose MEMS and ASIC have been expressly designed to build
an outstanding ultralow-power architecture in which the anti-aliasing
filter operates with a current consumption among the lowest in the
market.
This driver is based on stmemsc HAL i/f v2.3

https://www.st.com/en/datasheet/lis2du12.pdf

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2023-12-14 09:28:52 +01:00
Maureen Helm 5ff4f46d9e tests: drivers: dma: Refactor tests to use data relocation
Eliminates dma tests' dependency on CONFIG_NOCACHE_MEMORY=y for
configuring dma data linker sections. This allows optionally relocating
dma source and destination data to sram or other custom linker section
on boards that don't support dma access to flash.

Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2023-12-14 09:27:43 +01:00
Anas Nashif 740d0c3b50 lib: heap: make multi-heap feature configurable
Make multi-heap configurable via Kconfig and adapt existing tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-13 17:27:54 -05:00
Anas Nashif 2e24e9da9e tests: shared_multi_heap: fix identifier
Adapt identifier and be consistent with other heap tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-13 17:27:54 -05:00
Anas Nashif 11365fc4f8 tests: move shared_multi_heap to tests/lib
Move shared_multi_heap test under lib alongside all other heap tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-13 17:27:54 -05:00
Anas Nashif 44381f957a tests: multi_heap: adapt test identifiers
Change identifier to match with other heap related tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-13 17:27:54 -05:00
Anas Nashif dd2dcbed54 tests: move mheap_api_concept into tests/lib/multi_heap
Move multi-heap tests out of kernel folder along side all other heap
related tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-13 17:27:54 -05:00
Anas Nashif d6d716b32a lib: heap: build heap utilities only on demand
Build the heap features only when needed and based on Kconfigs being
set.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-13 17:27:54 -05:00
Evan Perry Grove 6df4576249 tests: drivers: Add nucleo_f722ze board support
Add overlays for the adc_api and counter_basic_api tests. Support
Nucleo F722ZE in the dac_api test.

Signed-off-by: Evan Perry Grove <evan@4grove.com>
2023-12-13 13:57:55 +01:00
Anders Storrø 25d44a828d Bluetooth: Mesh: Rename prov_dev->provisionee
Renames "prov device" references and options to
"provisionee" to align implementation with Mesh
Protocol specification v1.1, section 5.4.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-12-13 13:57:46 +01:00
Kevin ORourke fbfd36e81e drivers: clock_control: stm32: Add HSE CSS support
Add support for enabling the clock security system, which can detect
failures of the HSE clock.

Includes tests for nucleo_h743zi and nucleo_g474re.

Signed-off-by: Kevin ORourke <kevin.orourke@ferroamp.se>
2023-12-13 13:56:43 +01:00
Armando Visconti 72620baefe tests: drivers: build_all: add die_temp test case
Add test case for all drivers that are supporting the die temperature
feature, and fix right away all the yet undiscovered issues.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2023-12-13 09:42:23 +01:00
Daniel Leung 8bf20ee975 xtensa: mmu: rename prefix z_xtensa to xtensa_mmu
This follows the idea to remove any z_ prefix. Since MMU has
a large number of these, separate out these changes into one
commit to ease review effort.

Since these are no longer have z_, these need proper doxygen
doc. So add them too.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-12-13 09:41:24 +01:00
Jonathan Rico 2dab5dd0a0 tests: Bluetooth: add babblesim connection stress test
This is supposed to stress the host buffer and metadata handling.

It is not really testing any particular thing, ie. the pass criteria is
just that each peripheral can send and receive a fixed number of GATT
notifications without any device crashing or locking up.

Original version by Ahmed Moheib (from cloud2ground).

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-12-12 21:43:45 +02:00
Tomasz Bursztyka dc49dad7e0 tests/kernel: Exlude bogus platforms on cache test
Until these get fixed.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-12-12 19:11:13 +01:00
Tomasz Bursztyka a2be813d99 tests/kernel: Add qemu_x86/x86_64 to cache test and enable cache
How cache test could be ran without CONFIG_CACHE_MANAGEMENT?

Adding qemu_x86/x86_64 as cache related API in x86 has proven to be
very brittle against changes recently: no test was at least verifying
it builds properly, not to mention running it.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-12-12 19:11:13 +01:00
Ricardo Rivera-Matos 16519a5b3c drivers: charger: Updates drivers to use charge_enable handler
Updates existing drivers to make use of the charge_enable handler.

Signed-off-by: Ricardo Rivera-Matos <ricardo.rivera-matos@cirrus.com>
2023-12-12 10:49:39 -06:00
Mariusz Skamra 874e724492 tests: Bluetooth: ascs: Add expect_bt_bap_stream_ops_released_called
This adds the expect_bt_bap_stream_ops_released_called function that
takes an array of streams to verify as an argument. It's more versatile
approach than having expect_bt_bap_stream_ops_released_called_twice
erc. functions, that scales bad.
The function ignores the arhument list order, so that the user does not
have to predict the exact order of function calls.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-12-12 15:33:13 +01:00
Mariusz Skamra cb6c856d76 tests: Bluetooth: ascs: Limit the default number of ASEs
This limits the default number of ASEs available to 1.
The value can be overwritten in test case specific parameters
in testcase.yaml file.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-12-12 15:33:13 +01:00
Mariusz Skamra 92d5cdec75 tests: Bluetooth: ascs: Remove duplicated config setting
This removes duplicated CONFIG_BT_ISO_MAX_CHAN config setting and leaves
the default value set to 1.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-12-12 15:33:13 +01:00
Mariusz Skamra f58f74a091 tests: Bluetooth: ascs: Fix minor comment issue
This fixes opcode comment.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-12-12 15:33:13 +01:00
Mariusz Skamra e3e567ad82 tests: Bluetooth: ASCS: Add tests for invalid operations in Releasing state
This adds missing tests for invalid operations initiated by
locally or by client on ASE in Releasing state.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-12-12 15:33:13 +01:00
Mariusz Skamra c797f9b5f3 tests: Bluetooth: ascs: Remove redunadant tests
This removes 2 tests related to ASCS handling ACL disconnection.
c3c83c7049 modified the ACL disconection
behavior, so that ASE goes directly to idle state, not waiting in
releasing state for CIS disconnection. Thus the tests where state
machine waits for CIS disconnection can be removed now.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-12-12 15:33:13 +01:00
Mariusz Skamra 3b4ce7f8e9 tests: bsim: gatt: ccc_store: Reproduce the subscription lost issue
Zephyr by default renews the characteristic value subscription on every
reconnection. If the ACL is disconnected in the middle of this
procedure, all the subscriptions waiting to be renewed are removed, even
if the device was successfully subscribed already.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-12-12 15:32:45 +01:00
Mariusz Skamra 90770afa23 tests: bsim: gatt: ccc_store: Replace bt_gatt_write with bt_gatt_subscribe
This changes the way the GATT Client subscribes to the characteristic
value changes. The bt_gatt_write usage was replaced by dedicated
bt_gatt_subscribe API function call, so that the test verifies the GATT
Client API side as well.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-12-12 15:32:45 +01:00
Henrik Brix Andersen fe74ffe2d5 drivers: can: drop POSIX from the native Linux SocketCAN driver name
Rename the native Linux SocketCAN driver to reflect that it can can now be
used in both native_posix and native_sim (with or without an embedded
C-library).

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-12-12 14:28:26 +00:00
Benedikt Schmidt 995824ae80 tests: drivers: smbus: enable SMBus
Enable SMBus for the smbus_emul test.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-12-12 10:57:41 +01:00
Flavio Ceolin c724a6c5ef tests: pm: device_runtime_api: Check async behavior
Additional test to check if getting a device while there
is a pending async put does not trigger unnecessary device
state changes.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-12-12 10:57:34 +01:00
Flavio Ceolin 3f7325e34b tests: pm: device_runtime: Checks async put with delay
Checks that async put respects the given delay.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-12-12 10:57:34 +01:00
Flavio Ceolin b5ca7a06b4 pm: device_runtime: Add delay to async put
Add a delay parameter to asynchronous device runtim put. This allows
to delay the put operation what is useful to avoid multiple states
transitions.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-12-12 10:57:34 +01:00
Juha Ylinen 69e28939dd net: lib: coap: Add new API to configure retransmission settings
Add new functions to the public CoAP API to configure CoAP packet
retransmission settings. Application may need to re-configure the
settings for example when cellular modem changes connection from
LTE-M to NB-IoT or vice versa.

Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
2023-12-12 10:56:29 +01:00
Emil Gydesen cdd4bc6a48 Bluetooth: GMAP: Add GMAP BSIM test
Add BSIM testing of GMAP, with all spec-specified audio
configuration combinations added and tested.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-12-11 18:30:57 +01:00
Emil Gydesen 9c8ec58beb Bluetooth: GMAP: Add GMAP shell
Add the GMAP shell module with support for running the
various audio configurations in an easy way.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-12-11 18:30:57 +01:00
Robert Lubos 504d927483 tests: net: socket: tcp: Add tests for TCP keep alive feature
Verify that TCP keep alive options can be set properly and that TCP
connections time out correctly when keep-alive probes fail to get
replies.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-12-11 10:11:10 +01:00
Seppo Takalo b4bdbfd76b test: lwm2m: Run interop tests in tickless mode
Tickless mode is important to be tested against real server.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-12-11 09:57:09 +01:00
Joakim Andersson a8e340eb7e tests: flash: Use a flash partition that is known to be nonsecure
With TF-M enabled the storage_partition can be used as memory that is
known to be configured as non-secure flash region.
The slot1_ns_partition partition is only correct when TF-M is built
with BL2 enabled.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2023-12-11 09:56:55 +01:00
Andrei Emeltchenko effca0609d tests: fatal: Add message explaining OOPS
Add message explaining the cause of the OOPS like it is done in many
other cases.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-12-11 09:56:33 +01:00
Mariusz Skamra a42fb9d586 tests: bsim: gatt: Fix missing connection reference release
This fixes missing connection reference release.
The bt_conn_le_create returns the connection object reference that needs
to be released by API caller.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-12-11 09:54:13 +01:00
Szymon Janc a2184305f2 bluetooth: tester: Enable Periodic Advertising support
This is required by GAP/PADV/PASM/BV-01-C and GAP/PADV/PAM/BV-01-C
qualification test cases.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-12-11 09:50:48 +01:00
Aleksandr Khromykh 450ad68ca8 tests: Bluetooth: Mesh: delayable message unit tests
Commit adds unit tests for the newly created
access delayable messages.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-12-11 09:50:18 +01:00
Henrik Brix Andersen 0bf4efc780 tests: drivers: build_all: can: add build test for native posix linux
Add build-only test for the native POSIX Linux (SocketCAN) driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-12-10 09:24:30 +01:00
Lingao Meng 683098728a Bluetooth: Mesh: Use memslab replace with net_buf_pool
Use memslab more efficiency than net_buf_pool and consume
less ram with flash resource.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2023-12-08 20:19:10 +00:00
Seppo Takalo 725ceb72b7 test: lwm2m: Implement missing test case 103
Testcase 103 required "Disabled" functionality.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-12-08 20:18:37 +00:00
Seppo Takalo 51869b3e45 test: lwm2m: Implement bootstrap tests 4 - 7
* LightweightM2M-1.1-int-4 - Bootstrap Delete
* LightweightM2M-1.1-int-5 - Server Initiated Bootstrap
* LightweightM2M-1.1-int-6 - Bootstrap Sequence
* LightweightM2M-1.1-int-7 - Fallback to bootstrap

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-12-08 20:18:37 +00:00
Juha Heiskanen 34d4e50374 tests: mode: Modem CMUX DTE / DCE test
Added unite test for for validate modem CMUX DTE & DCE role
communication together.

Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
2023-12-08 20:17:58 +00:00
Juha Heiskanen 6943cd497c tests: modem: Modem backend mock update
Added possibility for link 2 modem mock instance for
validating P2P communication without any data stubbing.

Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
2023-12-08 20:17:58 +00:00
Fabio Baltieri fa8a7c3898 test: add a test for the kbd_matrix_state command
Add a test for the kbd_matrix_state shell command, both 8 and 16 bit row
variants.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-12-08 20:16:39 +00:00
Yong Cong Sin 2e37da45e5 tests: interrupt: sw_isr_table: fix index test for n+1 instance
The index test did not account for the level 2 table offset
when testing the (n + 1) instance, fix that.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-12-08 08:40:41 -05:00
Yong Cong Sin 7934a47332 tests: interrupt: sw_isr_table: use devicetree/Kconfig as ground truth
Updated the tests to use info from the devicetree or Kconfig as
ground truth and compare that with the output from the
functions under test.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-12-08 08:40:41 -05:00
Yong Cong Sin f3da086ac3 arch: common: sw_isr: make sure that the table index is within range
Assert that the `local_irq` of each levels should only ranges
from `0` to `CONFIG_MAX_IRQ_PER_AGGREGATOR`, so that it doesn't
overflow the other aggregators.

Also, assert that the output of `z_get_sw_isr_table_idx` shouldn't
overflow the ISR table.

Update the `sw_isr_table` tests to test the range of
`CONFIG_MAX_IRQ_PER_AGGREGATOR` instead of the entire range of
level bits.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-12-08 08:40:41 -05:00
Yong Cong Sin a28da922db tests: interrupt: refactor the sw_isr_irq_parent_table tests
Split the `sw_isr_irq_parent_table` test into one that tests
the IRQ table index function which is generic and should
always be tested, and one that tests multi-instance -related
functions which only work in interrupt controller drivers that
has multi-instance implementation.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-12-08 08:40:41 -05:00
Ryan McClelland edf32335cb test: drivers: sensor: adltc2990: fix double promotion
Fix double promotion warning

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-12-08 10:26:11 +00:00
Andrei Emeltchenko 339d0ac4a5 tests: btp_mcp: Fix dead code warning
Remove return statement preventing to return error code.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-12-08 10:05:20 +00:00
Emil Gydesen 203949c42c Bluetooth: VCP: Allow for multiple vol_ctrl cb registers
Modify the VCP volume controller callbacks to support
multiple registers by making it into a linked list.

This allow for multiple applications to get the information
from procedures or notifications.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-12-08 10:04:31 +00:00
Maxmillion McLaughlin 8ab1c75e9b feat: add support for TDK NTCG103JF103FT1 thermistor
Adds compensation table and bindings for NTCG103JF103FT1 thermistor

Signed-off-by: Maxmillion McLaughlin <github@maxmclau.com>
2023-12-08 10:04:12 +00:00
Dmitrii Golovanov 28ff83515d tests: drivers: coredump: Enable code coverage
Enable code coverage for debug.coredump.drivers.api.* test suite
adding custom fatal error handler to dump code coverage data
when the test halts as expected.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-12-07 12:14:32 -05:00
Lingao Meng 786b9a0ad4 Bluetooth: Host: Add const prefix for UUID
Add const prefix for service uuid and char uuid.

Since Service UUID and Char UUID should not change in the service
definition, they are most reasonably defined as rodata, also for
save some ram footprint.

The field `attr->user_data` type is `void *`, as this PR change
all Service UUID to rodata, so there must add (void *) to avoid warning.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2023-12-07 16:16:43 +00:00
Pieter De Gendt 8084a1c908 tests: net: mgmt: Add test cases new worker options
Run the Network event tests also on the system work queue and
synchronous.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-12-07 16:15:53 +00:00
Emil Gydesen 3fec3964e0 Bluetooth: CAP: Move initiator/commander common code to cap_common
The CAP Initiator and the CAP Commendar share quite a lot of
functionality in terms of discovery and performing set-based
procedures.

The code for handling most of this has been moved to
cap_common.c to avoid duplicating code.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-12-07 16:14:42 +00:00
Peter Mitsis 093c7f4137 tests: benchmark: Add case for object core stats
Updates both the app_kernel and latency_measure testcase scripts
to include a scenario involving object core statistics. This can
then be used to estimate the performance cost of using this feature
post-execution by comparing its results to the scenario where it is
not enabled.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-12-07 10:40:36 +00:00
Robert Lubos 429798c141 tests: net: socket: udp: Increase ztest stack size
The default ztest stack size was too small to run new UDP tests on
certain platforms (nrf52840 in this particular case), therefore increase
teh stack size in prj.conf.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-12-07 05:22:58 -05:00
Manuel Argüelles f46a27f20b tests: drivers: spi: enable tests on ucans32k1sic
Add overlays to enable SPI tests on ucans32k1sic board.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-12-06 20:57:42 -06:00
Yong Cong Sin a25e211ad2 tests: shell: shell_uart: add test for multi-instance
Add test that exercise the instance macros of the UART shell
backend.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-12-06 11:27:20 -08:00
Mariusz Skamra 6e856f1038 tests: bsim: pacs: Test bt_pacs_{set, get}_available_contexts_for_conn
This extends existing PACS BSIM tests with the new API function calls.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-12-06 17:54:14 +00:00
Mariusz Skamra 1b0e0fbd14 tests: bsim: pacs: Change printk to LOG
Replace combination of printk() to LOG_DBG() to fix the order of the
test execution logs. The printk() is printed immediately, while logs are
buffered, thus the messages from test are printed out before the stack
logs.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-12-06 17:54:14 +00:00
Mariusz Skamra 78a4b33e5c Bluetooth: audio: pacs: Add bt_pacs_set_available_contexts_for_conn
This adds the function that sets the available contexts value per
connection object so that API user can set different available contexts
per connection.
The lifetime of such overriden value is the same as connection lifetime,
so on reconnection or device reboot all devices return to having the
same available contexts value again.

Fixes: #64968
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-12-06 17:54:14 +00:00
Jonathan Rico b68987fe9e tests: Bluetooth: add pipelined ATT write test
This verifies the zephyr host can tolerate a spec violating peer sending
ATT requests without waiting for responses.

It also tests the opposite, that is that the Zephyr host does not
pipeline requests over the air.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Co-authored-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-12-06 17:53:54 +00:00
Piotr Narajowski 1f19cc782d bluetooth: tester: MCP Client test
Adding support for one missing MCP testcase - verifying characteristic
handles during service discovery.

Signed-off-by: Piotr Narajowski <piotr.narajowski@codecoup.pl>
2023-12-06 17:52:49 +00:00
Dmitrii Golovanov 52442a7c49 tests: gdbstub: Fix incomplete code coverage dump
When the test runs with code coverage, make sure the coverage dump
completes its output under pytest execution before the test debug
session ends in both cases: for Zephyr gdbstub feature and for
Qemu internal GDB stub.

Add few more test operations with breakpoints.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-12-06 17:52:18 +00:00
Emil Gydesen 92a813d28b tests: Bluetooth: Unittest of bt_bap_base API
Adds unittesting of the bt_bap_base API.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-12-06 17:51:47 +00:00
Emil Gydesen c9daed9712 Bluetooth: BAP: Refactor bt_bap_base
This removes the fixed size bt_bap_base, which provides
2 improvements:
1) The RAM usage of the broadcast sink has been reduced.
   For the Broadcast Sink sample it is a reduction of 120
   octets, but with much better scaling for supporting
   more or larger BASEs.
2) The functions to parse BASEs now support arbitrary sized
   BASEs, where they were previously restricted by our
   local Kconfig options. This allow us to parse any BASE
   from a remote device, without encounting memory issues.
   We are still memory restricted on the devices we
   actually want to sync to.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-12-06 17:51:47 +00:00
Andrei Emeltchenko 3879b02550 tests: threads: Remove unneeded option
This option (CONFIG_HEAP_MEM_POOL_SIZE) is not used for the tests.
Moreover it overrides the option, specified in the board's Kconfigs.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-12-06 09:18:14 +00:00
Fabio Baltieri 808c0f1f78 input: kbd_matrix: add actual-key-mask support
Add an optional actual-key-mask property to filter out key combinations
that are not implemented in the actual keyboard matrix.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-12-06 09:16:45 +00:00
Jordan Yates ca72fff802 tests: pm: device_power_domains: remove CONFIG_PM
This test is unrelated to system PM.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-12-06 09:16:12 +00:00
Jordan Yates 955bd413e1 tests: pm: device_power_domains: test multiple claim
Test claiming a device multiple times before releasing it, and validate
that the power domain returns to off.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-12-06 09:16:12 +00:00
Seppo Takalo 30dcf1b309 test: lwm2m: Refactor tests to work with fallback changes
In fallback refactoring to the LwM2M engine, some changes
to the server object are visible in hard-coded test
values.

Also, add Endpoint wrapper class that ensures the registration
state of the returned endpoint.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-12-05 16:40:06 -06:00
Seppo Takalo dc8f6da53c net: lwm2m: Implement fallback mechanism and support for diable
If server registration fails, allow fallback to secondary server,
or fallback to bootstrap.
Also allow fallback to different bootstrap server.

Add API to tell RD client when server have been disabled by
executable command.

Changes to RD state machine:
* All retry logic should be handled in NETWORK_ERROR state.
* New state SERVER_DISABLED.
* Internally disable servers that reject registration
* Temporary disable server on network error.
* Clean up all "disable timers" on start.
* Select server first, then find security object for it.
* State functions return void, error handling is done using states.
* DISCONNECT event will only come when client is requested to stop.
* NETWORK_ERROR will stop engine. This is generic error for all kinds
  of registration or network failures.
* BOOTSTRAP_REG_FAILURE also stops engine. This is fatal, and we cannot
  recover.

Refactoring:
* Server selection logic is inside server object.
* sm_handle_timeout_state() does not require msg parameter. Unused.
* When bootstrap fail, we should NOT back off to registration.
  This is a fatal error, and it stops the engine and informs application.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-12-05 16:40:06 -06:00
Manuel Argüelles 006ee60afc tests: kernel: skip kernel.common.stack_sentinel for hifive1
Test consistently fails with timeout for board `hifive1`, so exclude
this board until fixed.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-12-05 16:20:10 -06:00
Manuel Argüelles 0b32004c09 tests: userspace: exclude ucans32k1sic due to lack of MPU regions
This board have an NXP MPU with 8 configurable regions, of which five
of them are already used by the static MPU configuration. Many of
these tests are failing due to lack of MPU regions or free partition
slots available, even when HW stack protection is disabled when
building with userspace support.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-12-05 16:20:10 -06:00
Martin Åberg 0d0b17095d tests: c_lib: Enable sqrt tests in non-FPU configurations
This enables the sqrt() and sqrtf() tests also in case of soft-float
configurations. It is expected that the tests will link, run and pass
also in such configuration.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2023-12-05 10:47:18 -05:00
Erwan Gouriou bf652b20a9 tests: drivers: adc: Support nucleo_wba55cg
Enable adc tests on this board.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-12-05 14:53:39 +00:00
Pieter De Gendt b31d73f69c tests: net: mgmt: Add test for static event handlers
Add a testcase for event handlers in the iterable section.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-12-05 09:17:42 -05:00
Jonathan Rico 20057b6564 tests: Bluetooth: add missing param to testlib
The lib was refactored, but CI didn't run the tests that used it for
some reason.
A parameter was forgotten.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-12-05 15:09:18 +01:00
Tomasz Bursztyka 64153a7910 tests/x86: Clarify DMAR output
Cleaning the messy output

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-12-05 10:12:29 +00:00
Aleksander Wasaznik f6fced8ecc Bluetooth: Testlib: Add comments
This patch just adds some comments and asserts to clarify the testlibs
att read code.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-12-05 10:12:13 +00:00
Aleksander Wasaznik b52d59dd57 Bluetooth: testlib: Clang format fix
This reformats some code on main branch that was not clang formated. The
syntax is changed from initializer list to multiple statements because
there is a conflict in formating requirements between clang format and
checkpatch.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-12-05 10:12:13 +00:00
Aleksander Wasaznik bbdcf4be7a Bluetooth: testlib: att_read: Fix assert on zero-sized read
`read_data` can be NULL even on success if `read_size` is `0`.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-12-05 10:12:13 +00:00
Aleksander Wasaznik a29473c38e Bluetooth: Testlib: att_read allow ignoring result_size
Allow passing in NULL as `result_size` to ignore it.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-12-05 10:12:13 +00:00
Keith Packard d70e8d5a8f tests/thread_apis: Allow 20µs slop in k_busy_wait test
When testing k_busy_wait(100), don't require that at least 100µs of CPU
time be consumed by the thread itself; some of that time may be used
elsewhere in the system. Instead, just make sure that at least 80µs is
accounted to the thread and allow 20µs to get used elsewhere.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-12-05 09:24:28 +01:00
Christopher Friedt 4153a396f8 tests: posix: headers: enable tests for signal.h entities
Enable existsence checks for newl(-ish)ly added signal.h
definitions.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-04 20:49:35 -05:00
Christopher Friedt c2ab4020b0 tests: posix: pthread: add test for pthread_sigmask()
Add a test for pthread_sigmask().

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-04 20:49:35 -05:00
Christopher Friedt e867c6f36d tests: posix: pthread: use MIN instead of min
MIN() has been defined in sys/util.h for a long time. It doesn't
make sense to separately define a lowercase version.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-04 20:49:35 -05:00
Armando Visconti 3832c67677 tests: drivers: build_all: sensor: fix i3c typo for LPS28DFW
Fix typo in LPS28DFW driver i3c build test.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2023-12-04 19:08:08 +00:00
Fabio Baltieri 7ce03134f5 tests: build_all: input: add few more gpio-kbd-matrix cases
The driver has some non trivial macro setup, add another two test cases
so those gets build tested as well.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-12-04 16:40:35 +00:00
Andrei Emeltchenko 0290ae92b2 tests: acpi: Fix getting APIC id
Fixes accessing wrong memory.

Fixes: #66085

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-12-04 16:39:47 +00:00
Szymon Janc ce45c0ac57 tester: bluetooth: Add support for reporting sync status
Implements sync established and sync lost BTP events.
This was affecting GAP/PADV/PASE/BV-01-C test case.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-12-04 16:39:01 +00:00
Szymon Janc ae15a059a8 bluetooth: tester: Fix missing LE to CPU convertion in BTP
SYnc timeout and skip are 16 bit values and shall be converted to CPU
order before use.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-12-04 16:39:01 +00:00
Szymon Janc bc97d1ead0 bluetooth: tester: Add support for flags in BTP_GAP_PADV_CREATE_SYNC
This allows for more tuning regarding Periodic Advertising Sync
behavior.

Required by GAP/PADV/PASE/BV-01-C qualification test case.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-12-04 16:39:01 +00:00
Jukka Rissanen 0bc1423335 tests: net: mld: Add socket based join/leave tests
Make sure the IPV6_ADD_MEMBERSHIP and IPV4_DROP_MEMBERSHIP
work as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 16:38:49 +00:00
Jukka Rissanen 36f5cfae2c tests: net: igmp: Add socket based join/leave tests
Make sure the IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP
work as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 16:38:49 +00:00
Christopher Friedt 51a011bbd3 tests: logging: add log_blocking testsuite to demonstrate bugfix
Add a testsuite to demonstrate proper functionality of blocking
in the log processing thread.

This serves to demonstrate the previous bugfix, to provide
missing test coverage for the option, and also to document what
pitfalls to avoid when blocking in the log processing thread.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-04 09:15:29 -05:00
Jukka Rissanen f8c88a3fa6 tests: net: dns-sd: Fix IPv4 TTL and IPv6 hop limit checking
We need to use multicast TTL/hoplimit instead of unicast one
in the test.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 15:07:43 +01:00
Jukka Rissanen 921c945dab tests: net: udp: Verify that packet is dropped from stats
Make sure that statistics is properly update for dropped
packets when IPv4 TTL is 0 or IPv6 hop limit is 0.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 15:07:43 +01:00
Jukka Rissanen c32e06fcb5 tests: net: udp: Add IPv6 hop limit 0 test
Make sure packet is dropped if IPv6 hop limit 0 packet is
tried to send.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 15:07:43 +01:00
Jukka Rissanen 28a8c6c00d tests: net: udp: Add IPv4 TTL 0 test
Make sure packet is dropped if TTL 0 packet is tried to
send.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 15:07:43 +01:00
Jukka Rissanen 27d4c5d491 tests: net: udp: Add IPv4 unicast TTL tests
Make sure that setting IPv4 unicast TTL works as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 15:07:43 +01:00
Jukka Rissanen 7474007e64 tests: net: udp: Add IPv6 unicast hop limit tests
Make sure that setting IPv6 unicast hop limit works as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 15:07:43 +01:00
Jukka Rissanen 8bd612c522 tests: net: udp: Add IPv6 multicast hop limit tests
Make sure that setting IPv6 multicast hop limit works as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 15:07:43 +01:00
Jukka Rissanen cee2b3ae26 tests: net: udp: Add IPv4 time-to-live multicast tests
Make sure that setting IPv4 multicast TTL works as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 15:07:43 +01:00
Jukka Rissanen de0268def0 net: context: Add support for adjusting IPv4 multicast ttl
Add option support for adjusting the IPv4 multicast
time-to-live value.

Fixes #60299

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 15:07:43 +01:00
Håvard Reierstad c1bbd48659 bsim: Bluetooth: Mesh: fix provision timeout
Adapts the `pb_remote_timeout` test to the updated `bt_mesh_suspend`
API.
Suspension is scheduled with a small delay to allow publications to be
sent before suspending Mesh.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2023-12-04 14:38:13 +01:00
Håvard Reierstad 1025906331 bsim: Bluetooth: Mesh: Add suspension test
Adds two test-cases; one for suspending and resuming Mesh,
and one for suspending Mesh and disabling Bluetooth before
re-enabling Bluetooth and resuming Mesh.

Both tests checks that periodic publication is stopped during
suspension.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2023-12-04 14:38:13 +01:00
Henrik Eriksen 8f0b1f6424 bluetooth: tester: HAS Preset initialization done by auto-pts client.
- Removed preset initializations. Done in auto-pts client.
- Added one additional preset in overlay-le-audio.conf.

Signed-off-by: Henrik Eriksen <heri@demant.com>
2023-12-04 14:31:11 +01:00
Jukka Rissanen af610bb207 tests: net: shell: Increase number of IP address structs
A warning is printed in start of the test about this.
Increase CONFIG_NET_IF_MAX_IPV6_COUNT=2 and
CONFIG_NET_IF_MAX_IPV4_COUNT=2 so that the tests pass
in frdm_k64f and some other boards.

Fixes #66020

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 09:57:35 +01:00
Jukka Rissanen 3783a7eccd tests: net: dns_sd: Increase the number of contexts
Issue seen in frdm-k64f + some other boards.

Fixes #66033

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 09:57:35 +01:00
Christopher Friedt 88425fe3bb tests: drivers: dma: test dma_emul driver on native_posix boards
Add support for testing the `dma_emul` driver which simply uses
software emulation (i.e. asynchronous memcpy in a workqueue) for
performing DMA operations.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-03 19:22:31 -05:00
Alberto Escolar Piedras 41f4826f27 tests/bsim/bluetooth: Reduce sysbuild boilerplate
Reduce the sysbuild boilerplate required for
the nrf5340bsim targets.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-12-02 07:53:11 -05:00
Martí Bolívar b1532ce449 devicetree: remove label property accessors
These were first deprecated in v3.2. We have kept support for them
for as long as we can, but now their presence is causing CI failures
in some configurations. Specifically, using the deprecated 'label'
property is causing a warning which is promoted to an error in some
twister runs. This is blocking other forward progress in the
devicetree API.

I tried to rework the tests to avoid this, but it was too much effort
for the time I had to work on the task. Removing the APIs is therefore
unfortunately the best way forward to unblocking other work.

Re-work the test suite a bit to maintain coverage where we are using
the label property to test other macros.

Add a migration guide section to help with the transition.

Signed-off-by: Martí Bolívar <mbolivar@amperecomputing.com>
2023-12-01 13:09:56 -08:00
Jonas Remmert 7a2fcc419e drivers/sensor: add support to LPS28DFW pressure sensor
The LPS28DFW is an ultracompact, piezoresistive, absolute pressure sensor.
Compared to the LPS22DF, the LPS28DFW is waterproof and has a Dual FS
capability and does not have SPI. This commit extends the LPS22DF driver to
be compatible with the LPS28DFW device.

Signed-off-by: Jonas Remmert <j.remmert@phytec.de>
2023-12-01 12:19:05 -06:00
Guennadi Liakhovetski dbea13a1c7 llext: fix read-only extension image
When using the LLEXT buffer loader we now avoid copying extensions
from storage to allocated memory by pointing directly into the stored
image. We then also perform linking and relocation in that memory,
which modifies its contents. However, this is impossible if that
storage is read-only. Add a Kconfig flag to distinguish between
writable and read-only storage types. Also use that flag to decide,
whether the extension image in test_llext_simple.c should be defined
as const or not.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-12-01 10:08:12 -05:00
Guennadi Liakhovetski b9bdae8c07 llext: add support for exporting symbols from extensions
Extensions should be able to selectively export their global symbols.
Add a LL_EXTENSION_SYMBOL() macro for that. Change the present
.sym_tab to be a temporary symbol table of all global symbols in an
extensions, used only during linking for internal purposes. Add a new
.exp_tab symbol table to store symbols, exported by an extension
permanently.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-12-01 10:08:12 -05:00
Guennadi Liakhovetski a2acd7b2fb llext: add reference counting
Extend the llext_load() / llext_unload() API to let it be called
repeatedly for the same extension to increment or decrement its
reference counter respectively. We use a mutex to protect the counter
and make both llext_load() and llext_unload() return the use-count to
let the caller identify when the first loading and the last unloading
took place.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-12-01 10:08:12 -05:00
Guennadi Liakhovetski e5c8d181d4 llext: add Xtensa test support
Add support for running a modular "Hello world" example on Xtensa.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-12-01 10:08:12 -05:00
Guennadi Liakhovetski b0b4b0baa0 llext: make local relocations optional
Some applications can decide to link their loadable objects for
exactly the same addresses, where they will be loaded. In those cases
local relocations aren't needed any more and can in fact break the
object if applied while the object is in a temporary storage. Add a
parameter to skip such local relocations.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-12-01 10:08:12 -05:00
Pieter De Gendt b500f7216e tests: net: lib: coap_server: Do not autostart service B with port 0
A race condition for the test occurs as the service might have started
when booting.
Do not autostart the service to verify the port stays 0.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-12-01 10:56:47 +00:00
Jukka Rissanen 5d915398a4 net: sockets: Add additional checks to recvmsg()
Add extra checks that make sure that msg_iov is set
as we cannot receive anything if receive buffers are
not set.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-01 10:56:34 +00:00
Mia Koen 0bcad09392 bluetooth: mesh: Doc fix Bluetooth mesh to Mesh
SIG has changed Bluetooth mesh to Bluetooth Mesh
Updating zephyr docs accordingly
Leaving out old release notes

Signed-off-by: Mia Koen <mia.koen@nordicsemi.no>
2023-12-01 10:56:18 +00:00
Andrei Emeltchenko 9f7209241b tests: acpi: Refactor ACPi test
Use helpers to print scope also for not found entries.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-12-01 10:55:22 +00:00
Kamil Paszkiet 3754a4b315 tests/kernel/timer/timer_behavior: Add possibility to set ip address
added ip address parameter for saleae_logic2.py

Signed-off-by: Kamil Paszkiet <kamilx.paszkiet@intel.com>
2023-12-01 10:53:51 +00:00
Erwan Gouriou 17c099872f tests: uart: Enable fifo on nucleo_wba2cg for async tests
This will allow compiling/testing fifo in CI.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-12-01 10:52:49 +00:00
Marc Desvaux be6b12e012 tests: drivers: adc: adc_dma: add nucleo_l476rg
Add nucleo_l476rg in drivers.adc.dma
test case for twister test

Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-12-01 10:52:22 +00:00
HaiLong Yang f5e871d5e0 test: flash: add gd32 boards
This add gd32vf103v_eval, gd32a503v_eval and gd32f470i_eval boards to
flash common test.

    Boards       | Flash Type
-------------------------------
 gd32vf103v_eval | gd32 fmc v1
 gd32a503v_eval  | gd32 fmc v2
 gd32f470i_eval  | gd32 fmc v3

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
2023-12-01 10:51:52 +00:00
Pieter De Gendt e816fc5a81 tests: modules: nanopb: Add a custom nested library
Add a library to the Nanopb test to demonstrate building with a
dependency on the generated header files.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-12-01 10:50:26 +00:00
Andries Kruithof c3e2be4314 Bluetooth: audio: host: call the stream disable callback
Even though the ASCS Sink ASE state machine does not enter the disabling
state according to ASCS spec, it still makes sense to do so.

the state transition unit tests are updated to verify calling or not
calling the disable callback, depending on the transition of the state

fixes #63230

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2023-12-01 10:50:04 +00:00
Maciej Perkowski 4733a89c50 twister: tests: Add some generic driver tests to the scope
The added tests should be generic enough to run on all reference
platforms.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-11-30 19:38:50 -05:00
Maciej Perkowski ac3d8ebd9e twister: tests: Use inheritance in test_config.yaml
There is no need of repeating the same entries in a scope
that is supposed to extend another one.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-11-30 19:38:50 -05:00
Anas Nashif 589d36adcf tests: crc: remove unrelated tag
Remove net tag from tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-30 11:23:11 -05:00
Anas Nashif e11a71dea0 tests: posix: remove unrelated tags
Remove unrelated tags: net, socket.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-30 11:23:11 -05:00
Manuel Argüelles de93777d14 tests: drivers: gpio: enable tests for ucans32k1sic
Add DT overlays for running GPIO tests on ucans32k1sic board.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-11-30 11:21:59 -05:00
Alberto Escolar Piedras a905292eb0 tests/boards/native_sim/rtc: Rename testcase
As it is not just targetting native_posix anymore.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-30 09:42:25 -05:00
Alberto Escolar Piedras 690479fc36 tests/*: Switch integration platform to native_sim
Swith integration_platforms from native_posix(_64)
to native_sim(_64).

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-30 09:42:25 -05:00
Alberto Escolar Piedras 7a778ebc2d tests/kernel/*: Switch integration platform to native_sim
Swith integration_platforms from native_posix(_64)
to native_sim(_64).
And replace it also in a comment.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-30 09:42:25 -05:00
Alberto Escolar Piedras 700a251366 tests/kernel/sched/schedule_api: Replace delay with Z_SPIN_DELAY()
This macro was introduced for this purpose

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-30 09:42:25 -05:00