This fixes the failure to use a resolvable private address in this
scenario.
1. call `bt_le_oob_get_local`, will generate and mark RPA as valid
2. start connectable adv w/ IDENTITY bit
3. start connectable adv w/o IDENTITY
4. RPA is not set (in `bt_id_set_private_addr`) because RPA
is still marked as valid
When EXT_ADV is enabled and the controller supports it, a different code
path is taken that doesn't have this issue.
Unconditionally invalidating the RPA when starting advertising works around
this issue.
Fixes#56326
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Add BabbleSim test to make sure data can be sent immediately upon
connection from the L2CAP channel connection callback
Signed-off-by: Donatien Garnier <donatien.garnier@blecon.net>
The RSSI value in net_pkt (net_pkt_cb_ieee802154.rssi) was used
inconsistently across drivers. Some drivers did cast a signed dBm value
directly to net_pkt's unsigned byte value. Others were assigning the
negative value of the signed dBm value and again others were offsetting
and stretching the signed dBm value linearly onto the full unsigned byte
range.
This change standardizes net_pkt's rssi attribute to represent RSSI on
the RX path as an unsigned integer ranging from 0 (–174 dBm) to 254 (80
dBm) and lets 255 represent an "unknown RSSI" (IEEE 802.15.4-2020,
section 6.16.2.8). On the TX path the rssi attribute will always be
zero. Out-of-range values will be truncated to max/min values.
The change also introduces conversion functions to and from signed dBm
values and introduces these consistently to all existing call sites. The
"unknown RSSI" value is represented as INT16_MIN in this case.
In some cases drivers had to be changed to calculate dBm values from
internal hardware specific representations.
The conversion functions are fully covered by unit tests.
Fixes: #58494
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Add a new BabbleSim test checking that the value of the Bluetooth
identity stored in the settings is correct.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
Increase RAM requirements for some test, we have many exotic platforms
failing to link due to the size of the test.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
- Add integration_platforms to avoid excessive filtering
- Make sure integration platforms are actually part of the filter
- Fix some tags and test meta data
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
In some cases, when GitHub CI is running several Qemu processes,
each with heavy loads, SMP tests have shown some flakiness. This
exhibits itself as something like
```
... pthread_pressure on qemu_riscv32 failed (Timeout)
```
That is actually not at all limited to POSIX or any particular
architecture, but is mainly to do with the host scheduler and
perhaps memory barrier operations being lost in ISA translation
by Qemu.
Collectively, we can refer to these issues as "scheduler noise".
To reduce scheduler noise in the `pthread_pressure` testsuite,
enable `CONFIG_PTHREAD_CREATE_BARRIER` in `testcase.yaml`.
Note: end-users will likely not experience the need to enable
this in `prj.conf`. E.g. the following basic test demonstrates
0 failures locallly.
```
TEST=tests/posix/pthread_pressure
twister --build-only -T $TEST &>/dev/null
FAIL=0
for ((i=0; i < 100; i++)); do
echo "Run $((i+1))/100"
twister --test-only -T $TEST &>/dev/null
if [ $? -ne 0 ]; then
FAIL=$((FAIL+1))
echo "Failed $FAIL times"
fi
done
echo "Failure Rate: $((FAIL))/100"
```
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
The default tick rate for the nRF RTC timer is 32768 Hz, so one tick
is ~30 us. This turns out to be too little for the following loop
executed in user mode on the Network core in nRF5340:
```
do {
t0 = k_uptime_ticks();
rem_ticks = k_timer_remaining_ticks(&remain_timer);
t1 = k_uptime_ticks();
} while (t0 != t1);
```
The time between the two calls to `k_uptime_tick()` is there always
above 30 us, so the loop never ends.
This patch decreases the tick rate for all nRF platforms because on
other nRf SoCs the time mentioned above is also close to 30 us and
apparently changes in code completely unrelated to this test affect
execution time of system calls in the above loop - the test started
to fail after commit 0014dd05f0 that
changes fdtable was merged and if `fdtable.c` is for example just
temporarily excluded from the build, the test passes.
The root cause of the problem seems to be related to user space
handling and this should to be investigated further. This patch
is applied only to allow this test to pass for the time being.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Use 13% instead of the default 10% when the nRF RTC timer is used
so that the allowed drift is at least one tick long (~122 us in
this case).
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
-- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>