[rtems commit] psxfile01: Fix one second sleep

Sebastian Huber sebh at rtems.org
Mon Jan 7 13:24:04 UTC 2019


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

Author:    Jiri Gaisler <jiri at gaisler.se>
Date:      Mon Jan  7 14:22:22 2019 +0100

psxfile01: Fix one second sleep

Checking of atime in psxfile01 (line 713) can fail since a delay for
rtems_clock_get_ticks_per_second (line 699) gives a delay of less than
one second, depending on when the last tick occurred. atime is measured
in whole seconds, and a fast processor might read the file before a new
second occurs. Add one tick to the delay will solve the problem.

---

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

diff --git a/testsuites/psxtests/psxfile01/test.c b/testsuites/psxtests/psxfile01/test.c
index 1ea3dad..121b08f 100644
--- a/testsuites/psxtests/psxfile01/test.c
+++ b/testsuites/psxtests/psxfile01/test.c
@@ -696,7 +696,7 @@ since new path is not valid");
   ctime2 = buf.st_ctime;
 
 
-  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
+  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() + 1);
   rewind( file );
   while ( fgets(buffer, 128, file) )
     printf( "%s", buffer );




More information about the vc mailing list