Commit graph

10668 commits

Author SHA1 Message Date
Carles Cufi 22f73992b2 Bluetooth: Rework the HCI header set
In order to have clean, self-contained HCI headers that do not have any
dependencies towards the Host or any other part of the system (except
types), reorganize the headers in the following way:

- Split out the macros and structs from hci.h to a new hci_types.h
- Merge the existing hci_err.h into the new hci_types.h

Fixes #58214.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-06-12 06:20:24 -04:00
Emil Gydesen b0d6437653 Bluetooth: Audio: Shell: Increase number of streams for unicast client
Increase CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT to match
CONFIG_BT_ISO_MAX_CHAN.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-06-10 05:16:59 -04:00
Emil Gydesen 9ed72eb0e6 tests: Bluetooth: CAP: BSIM: Set initiator as d=0 and acceptor as d=1
Typically the client is the first device in our babblesim tests, so
reordered the initiator and acceptor for the CAP tests to conform to
that.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-06-10 05:16:39 -04:00
Emil Gydesen b635a47c70 tests: Bluetooth: CAP: Add bsim test for unicast_audio_cancel
Add test of the unicast audio cancel that can cancel any pending
procedures. This is done by adding a new blocking behavior in the
cap acceptor.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-06-10 05:16:39 -04:00
Christopher Friedt d9bae7ce65 tests: posix: improvements to pthread_pressure test
* allow `qemu_cortex_a53`
* disallow `qemu_leon3
* remove `TEST_DURATION_S` range
* additional report formatting

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-06-09 12:27:04 -04:00
Christopher Friedt f35fb33b94 posix: pthread: reimplement pthread_barrier using zephyr objects
Previously pthread_barrier_t was implemented in terms of wait
queues and internal scheduler functions.

This introduced some obstacles and inconsistency. In order
to be more consistent, rely only on Zephyr's public API and
reuse as many concepts as possible.

Deprecate `PTHREAD_BARRIER_DEFINE()` since it's non-standard.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-06-09 12:27:04 -04:00
Carlo Caione edd3437826 riscv: Rename Kconfig symbol to *_PRIVILEGED
Rename SOC_FAMILY_RISCV_PRIVILEGE to SOC_FAMILY_RISCV_PRIVILEGED because
the spec is "privileged".

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-06-09 11:46:29 -04:00
Emil Gydesen 8eaeb73753 tests: Bluetooth: Split CAP initiator tests to unicast and broadcast
Split the cap_initiator_test.c to two new files
cap_initiator_broadcast_test.c and
cap_initiator_unicast_test.c as the two barely had any
common functionality, and the file was getting too large.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-06-09 11:42:39 -04:00
Francois Ramu 433114edca tests: drivers: dac loopback on stm32 boards fix pinout
Change the pinout for ADC/DAC loopback testing on the stm32 boards
nucleo_l073rz: adc_in0_pa0/dac_out1_pa4 --> A0 to A2 on arduino CN8
nucleo_g071rb: adc1_in0_pa0/dac1_out1_pa4 --> A0 to A2 on arduino CN8
stm32l562e_dk: adc1_in13_pc4/dac1_out1_pa4 --> A2 to A4 on arduino CN19
Adjust the ACQuisition time to the MAX value because the default (=0)
is too low for several boards.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-06-08 11:48:22 -04:00
Carles Cufi bcd0e8c175 tests: bluetooth: tester: Fix ATT max attr size assert
ATT attributes can be up to 512 bytes long, so the comparisong needed
fixing.

See spec v5.4, Vol 3, Part F, 3.2.9.

Fixes #57930.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-06-08 09:34:10 -04:00
Francois Ramu c908aead77 tests: drivers: dac channel structure has a buffered parameter boolean
Add the '.buffered' field to the dac_channel_cfg structure
when testing the DAC.
This boolean parameter is initialised to 'true' to PASS the test.
It follows the https://github.com/zephyrproject-rtos/zephyr/pull/57730
Also changed for the samples/drivers/dac

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-06-08 09:33:11 -04:00
Henrik Brix Andersen 98ba1175fd tests: drivers: can: api: fix test_set_timing_data_while_started test
Change the test_set_timing_data_while_started test to actually attempt to
set the data phase timing parameters instead of attempting to set the
nominal/arbitration timing parameters.

Update test descriptions to explicitly mention data phase timing.

Fixes: #59046

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-06-08 06:50:14 -04:00
Vinayak Kariappa Chettimada 273e233d60 tests: bsim: Bluetooth: Fix BIS test ISO Tx Buffers in Controller
Fix BIS test for ISO Tx Buffers in Controller to be 2 for
ISO TX MTU size of 502 bytes.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-06-08 06:47:48 -04:00
Vinayak Kariappa Chettimada 5f38c4ba71 Bluetooth: Controller: Fix Tx ISO SDUs dropped due to strict SN check
Introduce a Kconfig BT_CTLR_ISOAL_SN_STRICT to relax the Tx
ISO Data SDUs being dropped due to strict check of sequence
numbers in ISOAL, i.e. dropped when ISO Data SDUs are
delayed from upper layer with respect to the current
payload number in the ISO radio events.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-06-08 06:47:25 -04:00
Vinayak Kariappa Chettimada 54aa6f1075 Bluetooth: Controller: Fix ISOAL sink create role for ISO Receiver
Fix ISOAL sink create role for ISO Receiver.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-06-08 12:25:31 +02:00
Théo Battrel 24ea25827c Bluetooth: Tests: Check CCC Update
Check that if a bonded peer subscribed to a CCC, a non-bonded peer with
the same address cannot update the CCC.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-06-08 04:10:58 -04:00
Théo Battrel f5ff886260 Bluetooth: Tests: Remove usage of BT_DEBUG_LOG
Remove usage of Kconfig symbol `CONFIG_BT_DEBUG_LOG` from tests. It has
been deprecated since this PR:
https://github.com/zephyrproject-rtos/zephyr/pull/56183

The Kconfig symbols has been replaced by `CONFIG_LOG=y` on most of the
cases. Or it has been removed when not needed anymore.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-06-07 13:56:55 -04:00
Evgeniy Paltsev e9b0b6ae07 test: ARC: skip div-by-zero test in case of SW div implementation
The SW div implementation from libgcc doesn't handle division by
zero case, so the HW exception isn't triggered.

So, skip this test case (as we are already doing for some other
ARC targets).

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-06-07 05:46:40 -04:00
Anas Nashif 7eea4b514a tests: mcumgr: update tags
add mcumgr as a tag for mcumgr tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-06-07 05:41:31 -04:00
Nirosharn Amarasinghe 97935bb0dc tests: Bluetooth: controller: updated ISO-AL tests for lost SDUs
-- Updated test cases to include missing / lost SDUs.
-- Included tests for receiving only framed padding PDUs.
-- Removed tests linked to sink and source configuration params as these
   were unused and removed.

Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
2023-06-06 13:34:45 +02:00
Nirosharn Amarasinghe f0434254fb tests: bluetooth: controller: Release SDU as missing RX unf. padding
Testing:
-- Receiving only padding PDUs for an SDU
-- Receiving leading padding PDUs (not an expected use case)

Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
2023-06-06 13:34:45 +02:00
Anas Nashif 1a526a63c7 tests: ignore benchmark on some qemu platforms
Do not run benchmarks on some special qemu platforms. Those were
previously ignored, but due to tag changes, they started running again.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-06-05 20:53:02 -04:00
Carlo Caione 7a043d6f19 tests: arm_runtime_nmi: Add barriers
Testing NMI on emulated QEMU platforms brings some interesting and wrong
results like:

  START - test_arm_runtime_nmi
  Trigger NMI in 10s: 0 s
  Trigger NMI in 10s: 1 s
  Trigger NMI in 10s: 2 s
  Trigger NMI in 10s: 3 s
  Trigger NMI in 10s: 4 s
  Trigger NMI in 10s: 5 s
  Trigger NMI in 10s: 6 s
  Trigger NMI in 10s: 7 s
  Trigger NMI in 10s: 8 s
  Trigger NMI in 10s: 9 s
  NMI triggered (test_handler_isr)!
      Assertion failed at ... arm_runtime_nmi_fn_test_arm_runtime_nmi:
        (nmi_triggered is false)
  Isr not triggered!

where the NMI handler is correctly called, see `NMI triggered`, but the
assert still fails on `nmi_triggered` being false.

This is due to a limitation in the emulation but also in the test not
being strictly architecturally compliant (you need a DSB;ISB sequence
after writing to SCB).

Add the proper barriers after writing to `SCB->ISCR` to make it
compliant and making it pass on QEMU as well.

Also reduce the timing to 2 sec.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-06-05 20:20:54 -04:00
Christopher Friedt 2d4874dd65 tests: posix: stress test for pthread_create and pthread_join
Recently, a race condition was discovered in `pthread_create()`
and `pthread_join()` that would trigger an assertion in
`kernel/sched.c` of the form below.
```
aborted _current back from dead
```

This was mainly observed in Qemu. Unfortunately, Qemu SMP
platforms exhibit a real and measurable "scheduler noise"
which makes testing rather difficult.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-06-05 19:48:39 -04:00
Christopher Friedt 15ea0412e4 tests: posix: common: add a small delay in pthread_descriptor_leak
The `aborted _current back from dead` error may appear in this
particular test under Qemu (and in particular Qemu SMP) systems.

A small delay between `pthread_create()` and `pthread_join()`
is sufficient to mitigate the issue.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-06-05 19:48:39 -04:00
Christopher Friedt d95ecab47e Revert "tests: posix: pthread: init pthread_attr_t on each iteration"
This reverts commit 7c17bda3c2.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-06-05 19:48:39 -04:00
Théo Battrel cb48626399 Bluetooth: Test: Update ccc_store bsim test
Update `ccc_store` bsim test to remove the 'expected failure'. The issue
being fixed in the following commit.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-06-05 13:54:37 -04:00
Aleksander Wasaznik 75bb62ad24 Bluetooth: Host: Test: bt_addr_from_str
Some basic tests for `bt_addr_from_str`. This proves a bug.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-06-05 08:31:06 -04:00
Declan Snyder 4c8b18920a tests: posix headers: RT1015 increase RAM
RT1015 needs more RAM to do this test, increase size of Zephyr SRAM
by switching zephyr,sram to the OCRAM allocation of the FLEXRAM.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-06-05 10:35:38 +02:00
Alvaro Garcia 4d854a562c drivers: fixed div by zero when reading max17048
Avoid divsion by zero when current rate is zero

Signed-off-by: Alvaro Garcia <maxpowel@gmail.com>
2023-06-02 18:51:25 -04:00
Daniel DeGrasse d5792abbcf tests: drivers: adc: adc_dma: increase sampling interval for MCUX ADC16
Increase hardware sampling interval to 30ms for MCUX ADC16. The ADC
callback in the repeated_samplings test takes roughly 27ms to execute,
so a sampling frequency of this interval still allows the ADC test to
verify the ADC is being sampled at a given interval, while avoiding the
pitfalls that result from a kernel timer shorter than the duration the
ADC callback takes to run.

Fixes #58467

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-06-02 18:49:22 -04:00
Christopher Friedt 386f6c7006 tests: posix: eventfd: add stress test
This test simply counts how many times `eventfd_read()`
and `eventfd_write()` can be called on an
`eventfd(0, EFD_SEMAPHORE | EFD_NONBLOCK)` file
descriptor.

Prior to the recent changes in `eventfd`, we were seeing
approximately < 1000 writes / s. However, the previous
`eventfd` implementation would fail this test with the
result that the number of successful reads was far greater
than the number of successful writes.

This should be impossible, and with the recent `eventfd`
changes that was fixed. Additionally, we are seeing an
increase in over 40x for non-blocking eventfd reads and
writes.

```
START - test_stress
I: BOARD: qemu_riscv64_smp
I: TEST_DURATION_S: 5
I: UPDATE_INTERVAL_S: 1
I: avg: 48537 reads/s
I: avg: 48575 writes/s
PASS - test_stress in 5.002 seconds
```

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-06-02 18:45:46 -04:00
Christopher Friedt d370361fe5 tests: eventfd: blocking read-write test for deadlock bug
Previously, the prototypical use case for `eventfd()` was not
possible in Zephyr due to a deadlock associated with the
`fdtable.c` `k_mutex`.

The prototypical use case for `eventfd()` is to make a
blocking call to `eventfd_read()` from one thread, and then
from another thread, call `eventfd_write()` to "wake up" the
reading thread.

This additional test case ensures that Zephyr supports the
prototypical `eventfd()` use case.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-06-02 18:45:46 -04:00
Christopher Friedt cf7c404aeb tests: posix: eventfd: use reopen in test_write_then_read
Use `reopen()` in one additional place in the eventfd
testsuite.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-06-02 18:45:46 -04:00
Peter Mitsis d26d3f9fd4 test: Change loop calibration count initialization
The kernel/context test_timer_interrupts() test has a loop calibration
phase to estimate the number of loops needed for 1 system tick.
By initializing this calibration to 1 instead of 0, we can avoid an
edge condition where the calibration phase indicates 0 loops are
required (a case that could happen when running on a slow simulator).

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-06-02 17:43:59 -04:00
Anas Nashif 0064b6e8b6 tests: samples: cleanup test tags, add integration_platforms
Use integration platforms and sanitize tags.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-06-02 04:47:06 -04:00
Anas Nashif db4a5f11ea tests: add kernel tag to all benchmarks and samples
All those benchmarks are kernel related, so add the kernel tag to avoid
building them when non kernel changes are being submitted.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-06-02 04:47:06 -04:00
Anas Nashif fa98745a10 tests: remove linker_generator sub tests from kernel
Kernel is being built the same way for all those tests and there is not
much related to the linker generator in any of those tests. Just keep a
small set of tests to have needed coverage in the kernel.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-06-02 04:47:06 -04:00
Anas Nashif cec8fd1c6e tests: ztest: fix tags for testsuite and unify them
Use test_framework as unified tag so we can filter tests in a consistent
way.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-06-02 04:47:06 -04:00
Declan Snyder 670e2a28fb tests: userspace: Support mimxrtXXX_evk_cm33
RT685 and RT494 ran out of mpu regions to do this test,
so add board overlays to disable the USB SRAM MPU
region definition because it is not needed for this test.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-06-01 19:02:58 -04:00
Keith Packard 091948a5a9 tests: Increase a couple of test stack sizes
mem_protect and sprintf stacks both need to be slightly larger than
currently defined in order to avoid stack overflow when using picolibc.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-06-01 13:43:25 -04:00
Lucas Tamborrino 4090b50d2e tests: drivers: dma: Add transfer size config
Set transfer size config to the max dma buffer size
for espressif boards.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-06-01 09:06:35 -04:00
Lucas Tamborrino 676f3fa5bf tests: drivers: dma: loop_transfer: Put tranfer size as config option
Each SoC may have different limitation regarding DMA buffer size.
This commit places the test transfer size in Kconfig so it can
be modified accordingly.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-06-01 09:06:35 -04:00
Théo Battrel f4ecc4e102 Bluetooth: Tests: Check CCC Store
The first test check that if a bonded peer subscribe to a CCC, this
change is correctly stored to flash.

The second test, which is currently failing, is included to reproduce a
bug that occur when CCC or CF store on write is disabled and the other
one is enabled, leading to the delayed store being enabled. Causing the
value of the corresponding `n` selected option to not be stored at all.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-06-01 14:58:39 +02:00
Krzysztof Chruscinski eb44414af9 tests: drivers: uart: async_api: Align test to early RX buffer release
Modify the test to not rely on assumption that RX buffer is released
when it is fully released. RX buffer maybe released after any RX_RDY
event within the buffer, e.g. after each timeout driver may be
switching to the new buffer.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2023-06-01 06:34:53 -04:00
Emil Gydesen f8676f59c9 tests: Bluetooth: Add CAP initaitor test iterations
Add iterations to test_cap_initiator_unicast so that
we test starting again after stopping, as well as recreating
the group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-06-01 10:04:36 +02:00
Keith Packard 27aed8c5f0 tests/watchdog: Switch main return type to int
Zephyr now requires that main return int instead of void.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-05-31 10:36:17 +02:00
Keith Packard 35f51ab998 tests/drivers/display: Switch main return type to int
Zephyr now requires that main return int instead of void.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-05-31 10:36:17 +02:00
Keith Packard 3c8a96532c tests/bluetooth/ll/cis: Switch main return type to int
Zephyr now requires that main return int instead of void.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-05-31 10:36:17 +02:00
Krzysztof Chruściński 4f5be73491 tests: logging: log_link_order: Fix uninitialized memory access
Mocks used in the test were not initializing certain variables.
Valgrind detected that. Test was passing but could fail if some
garbage would end up in that memory.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2023-05-30 13:15:50 -04:00