Previously, the echo test followed a flow like the following:
-STEP- -HOST PC- -DEVICE-
0 send _sync
1 echo back _sync
2 send echo_count
3 echo back echo_count
4 send first echo packet
5 echo back echo packet
(repeat echo steps)
However, as noted by issue #6659, this test would somtimes fail between
steps 4 and 5. To ensure each KV pair makes to the correct destination,
we usually write the KV back. Step 4 does not wait for this to happen
and starts sending echo packets. So the device is acting as the "echo
server".
This change makes the host PC the "echo server". The idea being that the
device will be slower and the host pc should always be able to keep up
with it, not the other way around.
test_case_2x_callbacks test was redesigned to eliminate ticker rescheduling and improve time mesure accuracy.
Constant ticker rescheduling (detach()/attach_us() calls)
was causing the gap between consecutive callback calls was not exact 1ms
but 1ms + time needed to call the callback and attach new one.
New design just uses two tickers to update counter alternatively every 1ms without rescheduling them
This commit fixes ticker cross-schedule bug in test_case_2x_callbacks subtest
In effect of this bug:
ticker_callback_1_switch_to_2 was called only once
ticker2 was never been fired because it was repeatedly detached just before fire and attached again
The test for construction of local static objects doesn't check
to see if the object returned has been fully initialized. Because
of this, an error with ARMCC was not detected.
This patch adds an assert to the race_test to ensure that the
object has been properly initialized.
LowPoterTimer test gives sometimes failed result while testing measured time accumulation. The check which verifies if total number of elapsed milliseconds is valid fails. Test assumes that delta value equal to 1 ms is sufficient for all test cases, which is not true since in case where time measurement is performed few times in sequence the measurement error also accumulates and 1 ms might be not enough. To solve this problem delta value for milliseconds tests must be updated.
1) if we receive more than one __sync, previous handshake would consider
it as echo_count and try to decode the value. Now we skip superfluous __sync.
2) reduce the uart load produced by the test, as we are heavily running tests in
parallel and not one-to-one this update was required.
In test_case_2x_callbacks two tickers are setup to repeatedly
reschedule each other. When these tickers are deleted this
rescheduling is still occurring and can lead to a deleted ticker
being scheduled.
When this happens the following error message is displayed:
Thread 0x0 error -6: Not allowed in ISR context
Note - this problem was not detected by CI since the test reported
the correct results back to the host test and only experienced this
error on tear down.
This problem can be reproduced on an nrf51 by first building the ticker
test with:
"mbed test -t GCC_ARM -m NRF51_DK -n tests-mbed_drivers-ticker
--compile -DMBED_TRAP_ERRORS_ENABLED=1
-DMBED_HEAP_STATS_ENABLED=1 -DMBED_STACK_STATS_ENABLED=1"
And then running testing with:
"mbed test -t GCC_ARM -m NRF51_DK -n tests-mbed_drivers-ticker --run"
This commit reverts commit c1c0f1ea57
because it causes nightly builds to fail. This is because extra tests
added in tests-mbed_drivers-ticker fail on some targets, such as the
KL46Z, MAX32625MBED, MAX32630FTHR, NCS36510, NRF51 and NRF52_DK.
Remove the direct use of the microsecond and low power ticker from
the tests. This enforces that sleep mode is properly locked when
using timers. Furthermore, this prepares the codebase for new ticker
changes which allow differing clock frequencies and timer bit widths.
Increase the Timeout period from 1ms to 10ms so interrupt latency has
1/10th the effect on the measurement. This prevents failures due to
interrupt latency causing a drift.
In case the target supports a page size of 1 byte, i.e. is able to
program flash 1 byte at a time, which is the case of STM32 F4 targets,
there is no reason for flash_device.program to return an error when
trying to write on an "unaligned" address.
1) mbed-os-tests-mbedmicro-rtos-mbed-basic tests use to fail when run in loop
after 20-25, This was because the stack used by test application was in range of
744-840 bytes. So bumped the stack size to 1024 bytes.
2) Corrected the assert and taken out the assert which was not required.
In the new approach the host controls the device activity when the test
should start, finish and pass/fail status is send to device. Also deprecate
the test cases which can't accurately test.
Reduce RAM consumption so all tests can still be built when using
CMSIS/RTX5. Also reduce clutter by removing the per target stack size
defines in the tests.
Fixes#4196. As someone might not be aware that settting default_lib to small has
some implications regarding thread safety, therefore we print an error.