Changeset 4984ee4 in rtems
- Timestamp:
- Sep 9, 2014, 3:13:51 PM (6 years ago)
- 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)
- Location:
- testsuites/sptests
- Files:
-
- 1 added
- 1 deleted
- 2 edited
- 4 moved
Legend:
- Unmodified
- Added
- Removed
-
testsuites/sptests/Makefile.am
rb5f9ad2 r4984ee4 7 7 sp10 sp11 sp12 sp13 sp14 sp15 sp16 sp17 sp18 sp19 \ 8 8 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 \ 10 10 sp40 sp41 sp42 sp43 sp44 sp45 sp46 sp47 sp48 sp49 \ 11 11 sp50 sp51 sp52 sp53 sp54 sp55 sp56 sp57 sp58 sp59 \ … … 54 54 _SUBDIRS += sptls01 55 55 _SUBDIRS += spintrcritical20 56 _SUBDIRS += spintrcritical21 56 57 _SUBDIRS += spcontext01 57 58 _SUBDIRS += spfatal26 -
testsuites/sptests/configure.ac
rb5f9ad2 r4984ee4 54 54 sptls01/Makefile 55 55 spintrcritical20/Makefile 56 spintrcritical21/Makefile 56 57 spcontext01/Makefile 57 58 spfatal26/Makefile … … 99 100 sp37/Makefile 100 101 sp38/Makefile 101 sp39/Makefile102 102 sp40/Makefile 103 103 sp41/Makefile -
testsuites/sptests/spintrcritical21/init.c
rb5f9ad2 r4984ee4 17 17 #include "system.h" 18 18 19 #include <intrcritical.h> 20 19 21 #include <rtems/rtems/eventimpl.h> 20 22 21 const char rtems_test_name[] = "SP 39";23 const char rtems_test_name[] = "SPINTRCRITICAL 21"; 22 24 23 25 /* … … 29 31 */ 30 32 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 ); 33 static volatile bool case_hit; 39 34 40 volatile bool case_hit;35 static rtems_id main_task; 41 36 42 rtems_id main_task; 43 rtems_id other_task; 37 static rtems_id other_task; 44 38 45 rtems_timer_service_routine test_event_from_isr(39 static rtems_timer_service_routine test_event_from_isr( 46 40 rtems_id timer, 47 41 void *arg … … 65 59 fatal_directive_check_status_only( status, RTEMS_SUCCESSFUL, "event send" ); 66 60 67 case_hit = TRUE;61 case_hit = true; 68 62 } 69 63 status = rtems_event_send( main_task, 0x01 ); … … 71 65 } 72 66 73 rtems_timer_service_routine test_event_with_timeout_from_isr( 67 static 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 80 static rtems_timer_service_routine test_event_with_timeout_from_isr( 74 81 rtems_id timer, 75 82 void *arg … … 83 90 * just send and make it happy. 84 91 */ 85 case_hit = TRUE;92 case_hit = true; 86 93 } 87 94 status = rtems_event_send( main_task, 0x01 ); 88 95 fatal_directive_check_status_only( status, RTEMS_SUCCESSFUL, "event send" ); 96 } 97 98 static 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; 89 109 } 90 110 … … 94 114 { 95 115 rtems_status_code status; 96 rtems_id timer;97 rtems_event_set out;98 int i;99 int max;100 uint32_t iterations = 0;101 116 102 117 TEST_BEGIN(); 103 118 104 119 main_task = rtems_task_self(); 105 106 /*107 * Timer used in multiple ways108 */109 status = rtems_timer_create( 1, &timer );110 directive_failed( status, "rtems_timer_create" );111 120 112 121 status = rtems_task_create( … … 123 132 * Test Event send successful from ISR -- receive is forever 124 133 */ 125 case_hit = FALSE;126 iterations = 0;127 max = 1;128 134 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 ); 149 141 150 142 printf( 151 143 "Event sent from ISR hitting synchronization point has %soccurred\n", 152 (( case_hit == TRUE ) ? "" : "NOT ")144 case_hit ? "" : "NOT " 153 145 ); 146 147 rtems_test_assert( case_hit ); 154 148 155 149 /* 156 150 * Test Event send successful from ISR -- receive has timeout 157 151 */ 158 case_hit = FALSE;159 iterations = 0;160 max = 1;161 152 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 ); 183 159 184 160 printf( 185 161 "Event sent from ISR (with timeout) hitting synchronization " 186 162 "point has %soccurred\n", 187 (( case_hit == TRUE ) ? "" : "NOT ")163 case_hit ? "" : "NOT " 188 164 ); 165 166 rtems_test_assert( case_hit ); 189 167 190 168 TEST_END(); -
testsuites/sptests/spintrcritical21/spintrcritical21.scn
rb5f9ad2 r4984ee4 1 *** TEST 39***1 *** BEGIN OF TEST SPINTRCRITICAL 21 *** 2 2 Event sent from ISR hitting synchronization point has occurred 3 3 Event 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 33 33 #define CONFIGURE_MAXIMUM_TASKS 2 34 34 #define CONFIGURE_MAXIMUM_TIMERS 1 35 #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1 35 36 36 37 #include <rtems/confdefs.h>
Note: See TracChangeset
for help on using the changeset viewer.