tests-events-timing - print debug info only in case of failure.

In the 'Testing accuracy of equeue semaphore' test case result is printed out in each loop iteration.
Since debug prints should not exist in the final test version I suggest to print information only in case of failure.
Additionally time needed to print single info is equal to ~25 ms (K64F/GCC_ARM). The while loop is designed to execute until 20000 ms elapses, so this print has also impact on number of times the loop is executed (number of semaphore accuracy checks).
pull/6135/head
Przemyslaw Stekiel 2018-02-19 11:24:19 +01:00
parent 04f0f2b1aa
commit 2b68eb19e3
1 changed files with 4 additions and 1 deletions

View File

@ -107,7 +107,10 @@ void semaphore_timing_test() {
equeue_sema_wait(&sema, delay);
int taken = timer.read_us() - start;
printf("delay %dms => error %dus\r\n", delay, abs(1000*delay - taken));
if (taken < (delay * 1000 - 5000) || taken > (delay * 1000 + 5000)) {
printf("delay %dms => error %dus\r\n", delay, abs(1000 * delay - taken));
}
TEST_ASSERT_INT_WITHIN(5000, taken, delay * 1000);
led = !led;