Changeset 03e86553 in rtems


Ignore:
Timestamp:
Dec 5, 2018, 7:05:54 AM (5 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
9921ab6
Parents:
fcd577a
git-author:
Sebastian Huber <sebastian.huber@…> (12/05/18 07:05:54)
git-committer:
Sebastian Huber <sebastian.huber@…> (12/07/18 13:22:00)
Message:

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.

Location:
testsuites
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • testsuites/sptests/spedfsched04/init.c

    rfcd577a r03e86553  
    6565  status = rtems_rate_monotonic_create( Task_name[ argument ], &RM_period );
    6666  directive_failed( status, "rtems_rate_monotonic_create" );
     67
     68  rtems_test_spin_until_next_tick();
    6769
    6870  while ( FOREVER ) {
  • testsuites/support/include/test_support.h

    rfcd577a r03e86553  
    1212
    1313#include <stdarg.h>
     14#include <rtems.h>
    1415
    1516#ifdef __cplusplus
     
    2930
    3031/*
    31  *  Spin for specified number of ticks.
     32 *  Spin for specified number of ticks.  The first tick we spin through is a
     33 *  partial one.
    3234 */
    33 void rtems_test_spin_for_ticks(int ticks);
     35void rtems_test_spin_for_ticks(rtems_interval ticks);
    3436
    3537/*
  • testsuites/support/src/spin.c

    rfcd577a r03e86553  
    1818 *  Burn CPU for specified number of ticks
    1919 */
    20 void rtems_test_spin_for_ticks(int ticks)
     20void rtems_test_spin_for_ticks(rtems_interval ticks)
    2121{
    22   rtems_interval        start;
    23   rtems_interval        now;
     22  rtems_interval start;
     23  rtems_interval now;
    2424
    2525  start = rtems_clock_get_ticks_since_boot();
    2626  do {
    2727    now = rtems_clock_get_ticks_since_boot();
    28     /*
    29      *  Spin for <= ticks so we spin >= number of ticks.
    30      *  The first tick we spin through is a partial one.
    31      *  So you sping "ticks" number of ticks plus a partial
    32      *  one.
    33      */
    34   } while ( (now-start) <= ticks );
     28  } while ( now - start < ticks );
    3529}
    3630
     
    4034void rtems_test_spin_until_next_tick( void )
    4135{
    42   rtems_interval        start;
    43   rtems_interval        now;
     36  rtems_interval start;
     37  rtems_interval now;
    4438
    4539  start = rtems_clock_get_ticks_since_boot();
    4640  do {
    4741    now = rtems_clock_get_ticks_since_boot();
    48   } while ( now != start );
     42  } while ( now == start );
    4943}
Note: See TracChangeset for help on using the changeset viewer.