Skip to content

Commit 2b68eb1

Browse files
committed
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).
1 parent 04f0f2b commit 2b68eb1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

TESTS/events/timing/main.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,10 @@ void semaphore_timing_test() {
107107
equeue_sema_wait(&sema, delay);
108108
int taken = timer.read_us() - start;
109109

110-
printf("delay %dms => error %dus\r\n", delay, abs(1000*delay - taken));
110+
if (taken < (delay * 1000 - 5000) || taken > (delay * 1000 + 5000)) {
111+
printf("delay %dms => error %dus\r\n", delay, abs(1000 * delay - taken));
112+
}
113+
111114
TEST_ASSERT_INT_WITHIN(5000, taken, delay * 1000);
112115

113116
led = !led;

0 commit comments

Comments
 (0)