[rtems commit] psxtimes01: Fix sporadic failures

Sebastian Huber sebh at rtems.org
Fri Dec 7 13:33:23 UTC 2018


Module:    rtems
Branch:    master
Commit:    9921ab6973604eff15f1663c0ab6191f137bec32
Changeset: http://git.rtems.org/rtems/commit/?id=9921ab6973604eff15f1663c0ab6191f137bec32

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Dec  5 10:03:13 2018 +0100

psxtimes01: Fix sporadic failures

It is not enough to just wait for at least the first clock tick to get
non-zero times.  In _times() we round down, so the uptime must be
greater than or equal to the clock tick interval.  We do not know when
the timecounter is started during the system initialization.  We have to
wait until at least two ticks happened.

---

 testsuites/psxtests/psxtimes01/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testsuites/psxtests/psxtimes01/init.c b/testsuites/psxtests/psxtimes01/init.c
index 7e191d0..d5b573b 100644
--- a/testsuites/psxtests/psxtimes01/init.c
+++ b/testsuites/psxtests/psxtimes01/init.c
@@ -48,7 +48,7 @@ rtems_task Init(
   rtems_test_assert( sc == -1 );
   rtems_test_assert( errno == EFAULT );
 
-  while ( rtems_clock_get_ticks_since_boot() == 0 )
+  while ( rtems_clock_get_ticks_since_boot() <= 2 )
     ;
 
   puts( "_times( &start_tm ) -- OK" );



More information about the vc mailing list