mirror of https://github.com/ARMmbed/mbed-os.git
tests-mbed_drivers-timerevent: increase tolerance for NRF52_DK
Test inserts event into the TimerEvent object which is scheduled 50 ms in the future. Then test thread hangs on the semaphore for 51 ms and after that time we expect that event handler has been executed. This test fails sometimes on NRF51_DK, NRF52_DK since different clocks are used for event handling and delay. TimerEvent class uses fast us ticker and semaphores are based on lp ticker (NRF51_DK) or System Tick Timer (NRF52_DK). We assume that ticker measurement error is 10% and our 1 [ms] extra corresponds to 2% error. I suggest to increase delay to 2 [ms] (4%). This should be enough for all boards at this moment.pull/7009/head
parent
50a5e2c1f4
commit
a0a07d9725
|
|
@ -32,6 +32,7 @@ using namespace utest::v1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TEST_DELAY_US 50000ULL
|
#define TEST_DELAY_US 50000ULL
|
||||||
|
#define DELTA 2
|
||||||
|
|
||||||
class TestTimerEvent: public TimerEvent {
|
class TestTimerEvent: public TimerEvent {
|
||||||
private:
|
private:
|
||||||
|
|
@ -129,7 +130,7 @@ void test_insert(void) {
|
||||||
int32_t sem_slots = tte.sem_wait(0);
|
int32_t sem_slots = tte.sem_wait(0);
|
||||||
TEST_ASSERT_EQUAL(0, sem_slots);
|
TEST_ASSERT_EQUAL(0, sem_slots);
|
||||||
|
|
||||||
sem_slots = tte.sem_wait(TEST_DELAY_US / 1000 + 1);
|
sem_slots = tte.sem_wait(TEST_DELAY_US / 1000 + DELTA);
|
||||||
TEST_ASSERT_EQUAL(1, sem_slots);
|
TEST_ASSERT_EQUAL(1, sem_slots);
|
||||||
|
|
||||||
tte.remove();
|
tte.remove();
|
||||||
|
|
@ -158,7 +159,7 @@ void test_remove(void) {
|
||||||
TEST_ASSERT_EQUAL(0, sem_slots);
|
TEST_ASSERT_EQUAL(0, sem_slots);
|
||||||
tte.remove();
|
tte.remove();
|
||||||
|
|
||||||
sem_slots = tte.sem_wait(TEST_DELAY_US * 2 / 1000 + 1);
|
sem_slots = tte.sem_wait(TEST_DELAY_US * 2 / 1000 + DELTA);
|
||||||
TEST_ASSERT_EQUAL(0, sem_slots);
|
TEST_ASSERT_EQUAL(0, sem_slots);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue