Changeset 4984ee4 in rtems


Ignore:
Timestamp:
Sep 9, 2014, 3:13:51 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
f59e64f2
Parents:
b5f9ad2
git-author:
Sebastian Huber <sebastian.huber@…> (09/09/14 15:13:51)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/10/14 05:12:55)
Message:

sptests/sp39: Convert to sptests/spintrcritical21

Use interrupt critical section test support. Do not print end of test
message in case of failure.

Location:
testsuites/sptests
Files:
1 added
1 deleted
2 edited
4 moved

Legend:

Unmodified
Added
Removed
  • testsuites/sptests/Makefile.am

    rb5f9ad2 r4984ee4  
    77    sp10 sp11 sp12 sp13 sp14 sp15 sp16 sp17 sp18 sp19 \
    88    sp20 sp21 sp22 sp23 sp24 sp25 sp26 sp27 sp27a           \
    9     sp30 sp31 sp32 sp33 sp34 sp35      sp37 sp38 sp39 \
     9    sp30 sp31 sp32 sp33 sp34 sp35      sp37 sp38 \
    1010    sp40 sp41 sp42 sp43 sp44 sp45 sp46 sp47 sp48 sp49 \
    1111    sp50 sp51 sp52 sp53 sp54 sp55 sp56 sp57 sp58 sp59 \
     
    5454_SUBDIRS += sptls01
    5555_SUBDIRS += spintrcritical20
     56_SUBDIRS += spintrcritical21
    5657_SUBDIRS += spcontext01
    5758_SUBDIRS += spfatal26
  • testsuites/sptests/configure.ac

    rb5f9ad2 r4984ee4  
    5454sptls01/Makefile
    5555spintrcritical20/Makefile
     56spintrcritical21/Makefile
    5657spcontext01/Makefile
    5758spfatal26/Makefile
     
    99100sp37/Makefile
    100101sp38/Makefile
    101 sp39/Makefile
    102102sp40/Makefile
    103103sp41/Makefile
  • testsuites/sptests/spintrcritical21/init.c

    rb5f9ad2 r4984ee4  
    1717#include "system.h"
    1818
     19#include <intrcritical.h>
     20
    1921#include <rtems/rtems/eventimpl.h>
    2022
    21 const char rtems_test_name[] = "SP 39";
     23const char rtems_test_name[] = "SPINTRCRITICAL 21";
    2224
    2325/*
     
    2931 */
    3032
    31 rtems_timer_service_routine test_event_from_isr(
    32   rtems_id  timer,
    33   void     *arg
    34 );
    35 rtems_timer_service_routine test_event_with_timeout_from_isr(
    36   rtems_id  timer,
    37   void     *arg
    38 );
     33static volatile bool case_hit;
    3934
    40 volatile bool case_hit;
     35static rtems_id main_task;
    4136
    42 rtems_id main_task;
    43 rtems_id other_task;
     37static rtems_id other_task;
    4438
    45 rtems_timer_service_routine test_event_from_isr(
     39static rtems_timer_service_routine test_event_from_isr(
    4640  rtems_id  timer,
    4741  void     *arg
     
    6559    fatal_directive_check_status_only( status, RTEMS_SUCCESSFUL, "event send" );
    6660
    67     case_hit = TRUE;
     61    case_hit = true;
    6862  }
    6963  status = rtems_event_send( main_task, 0x01 );
     
    7165}
    7266
    73 rtems_timer_service_routine test_event_with_timeout_from_isr(
     67static bool test_body_event_from_isr( void *arg )
     68{
     69  rtems_status_code status;
     70  rtems_event_set   out;
     71
     72  (void) arg;
     73
     74  status = rtems_event_receive( 0x01, RTEMS_DEFAULT_OPTIONS, 0, &out );
     75  rtems_test_assert( status == RTEMS_SUCCESSFUL );
     76
     77  return case_hit;
     78}
     79
     80static rtems_timer_service_routine test_event_with_timeout_from_isr(
    7481  rtems_id  timer,
    7582  void     *arg
     
    8390     *  just send and make it happy.
    8491     */
    85     case_hit = TRUE;
     92    case_hit = true;
    8693  }
    8794  status = rtems_event_send( main_task, 0x01 );
    8895  fatal_directive_check_status_only( status, RTEMS_SUCCESSFUL, "event send" );
     96}
     97
     98static bool test_body_event_with_timeout_from_isr( void *arg )
     99{
     100  rtems_status_code status;
     101  rtems_event_set   out;
     102
     103  (void) arg;
     104
     105  status = rtems_event_receive( 0x01, RTEMS_DEFAULT_OPTIONS, 1, &out );
     106  rtems_test_assert( status == RTEMS_SUCCESSFUL || status == RTEMS_TIMEOUT );
     107
     108  return case_hit;
    89109}
    90110
     
    94114{
    95115  rtems_status_code     status;
    96   rtems_id              timer;
    97   rtems_event_set       out;
    98   int                   i;
    99   int                   max;
    100   uint32_t              iterations = 0;
    101116
    102117  TEST_BEGIN();
    103118
    104119  main_task = rtems_task_self();
    105 
    106   /*
    107    *  Timer used in multiple ways
    108    */
    109   status = rtems_timer_create( 1, &timer );
    110   directive_failed( status, "rtems_timer_create" );
    111120
    112121  status = rtems_task_create(
     
    123132   * Test Event send successful from ISR -- receive is forever
    124133   */
    125   case_hit = FALSE;
    126   iterations = 0;
    127   max = 1;
    128134
    129   while (1) {
    130     if ( case_hit )
    131       break;
    132     status = rtems_timer_fire_after( timer, 1, test_event_from_isr, NULL );
    133     directive_failed( status, "timer_fire_after failed" );
    134 
    135     for (i=0 ; i<max ; i++ )
    136       if ( _Event_Sync_state == THREAD_BLOCKING_OPERATION_SATISFIED )
    137         break;
    138 
    139     status = rtems_event_receive( 0x01, RTEMS_DEFAULT_OPTIONS, 0, &out );
    140     directive_failed( status, "rtems_event_receive" );
    141     if ( case_hit == TRUE )
    142       break;
    143     max += 2;
    144 
    145     /* with our clock tick, this is about 30 seconds */
    146     if ( ++iterations >= 4L * 1000L * 30L)
    147       break;
    148   }
     135  case_hit = false;
     136  interrupt_critical_section_test(
     137    test_body_event_from_isr,
     138    NULL,
     139    test_event_from_isr
     140  );
    149141
    150142  printf(
    151143    "Event sent from ISR hitting synchronization point has %soccurred\n",
    152     (( case_hit == TRUE ) ? "" : "NOT ")
     144    case_hit ? "" : "NOT "
    153145  );
     146
     147  rtems_test_assert( case_hit );
    154148
    155149  /*
    156150   * Test Event send successful from ISR -- receive has timeout
    157151   */
    158   case_hit = FALSE;
    159   iterations = 0;
    160   max = 1;
    161152
    162   while (1) {
    163     if ( case_hit )
    164       break;
    165     status = rtems_timer_fire_after(
    166       timer, 1, test_event_with_timeout_from_isr, NULL );
    167     directive_failed( status, "timer_fire_after failed" );
    168 
    169     for (i=0 ; i<max ; i++ )
    170       if ( _Event_Sync_state == THREAD_BLOCKING_OPERATION_SATISFIED )
    171         break;
    172 
    173     status = rtems_event_receive( 0x01, RTEMS_DEFAULT_OPTIONS, 10, &out );
    174     directive_failed( status, "rtems_event_receive" );
    175     if ( case_hit == TRUE )
    176       break;
    177     max += 2;
    178 
    179     /* with our clock tick, this is about 30 seconds */
    180     if ( ++iterations >= 4L * 1000L * 30L)
    181       break;
    182   }
     153  case_hit = false;
     154  interrupt_critical_section_test(
     155    test_body_event_with_timeout_from_isr,
     156    NULL,
     157    test_event_with_timeout_from_isr
     158  );
    183159
    184160  printf(
    185161    "Event sent from ISR (with timeout) hitting synchronization "
    186162      "point has %soccurred\n",
    187     (( case_hit == TRUE ) ? "" : "NOT ")
     163    case_hit ? "" : "NOT "
    188164  );
     165
     166  rtems_test_assert( case_hit );
    189167
    190168  TEST_END();
  • testsuites/sptests/spintrcritical21/spintrcritical21.scn

    rb5f9ad2 r4984ee4  
    1 *** TEST 39 ***
     1*** BEGIN OF TEST SPINTRCRITICAL 21 ***
    22Event sent from ISR hitting synchronization point has occurred
    33Event sent from ISR (with timeout) hitting synchronization point has occurred
    4 *** END OF TEST 39 ***
     4*** END OF TEST SPINTRCRITICAL 21 ***
  • testsuites/sptests/spintrcritical21/system.h

    rb5f9ad2 r4984ee4  
    3333#define CONFIGURE_MAXIMUM_TASKS             2
    3434#define CONFIGURE_MAXIMUM_TIMERS            1
     35#define CONFIGURE_MAXIMUM_USER_EXTENSIONS   1
    3536
    3637#include <rtems/confdefs.h>
Note: See TracChangeset for help on using the changeset viewer.