summaryrefslogtreecommitdiffstats
path: root/testsuites/support/src/spin.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-12-05 08:05:54 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-12-07 14:22:00 +0100
commit03e86553d2839c123fa79ed382ea3ee10bede78c (patch)
tree50ec0e07dffc2889bd292ffcca81bcb9e7017114 /testsuites/support/src/spin.c
parentpsxtests/Makefile.am: Fix ticket number for ucontext.h (diff)
downloadrtems-03e86553d2839c123fa79ed382ea3ee10bede78c.tar.bz2
tests: Fix rtems_test_spin_until_next_tick()
This bug surfaced due to sporadic failures in sptimecounter02. Adjust rtems_test_spin_for_ticks() to include the partial tick in the argument value.
Diffstat (limited to '')
-rw-r--r--testsuites/support/src/spin.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/testsuites/support/src/spin.c b/testsuites/support/src/spin.c
index 5b6d3d484e..57c4e323d5 100644
--- a/testsuites/support/src/spin.c
+++ b/testsuites/support/src/spin.c
@@ -17,21 +17,15 @@
/*
* Burn CPU for specified number of ticks
*/
-void rtems_test_spin_for_ticks(int ticks)
+void rtems_test_spin_for_ticks(rtems_interval ticks)
{
- rtems_interval start;
- rtems_interval now;
+ rtems_interval start;
+ rtems_interval now;
start = rtems_clock_get_ticks_since_boot();
do {
now = rtems_clock_get_ticks_since_boot();
- /*
- * Spin for <= ticks so we spin >= number of ticks.
- * The first tick we spin through is a partial one.
- * So you sping "ticks" number of ticks plus a partial
- * one.
- */
- } while ( (now-start) <= ticks );
+ } while ( now - start < ticks );
}
/*
@@ -39,11 +33,11 @@ void rtems_test_spin_for_ticks(int ticks)
*/
void rtems_test_spin_until_next_tick( void )
{
- rtems_interval start;
- rtems_interval now;
+ rtems_interval start;
+ rtems_interval now;
start = rtems_clock_get_ticks_since_boot();
do {
now = rtems_clock_get_ticks_since_boot();
- } while ( now != start );
+ } while ( now == start );
}