diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-01-23 13:05:55 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-01-23 13:05:55 +0000 |
commit | 9185d61c541ad57d3ad472dbf85c1c1dfdafca6c (patch) | |
tree | 00e3aba926bf2db7296cca35c9833af68d6bfd08 /testsuites/sptests/sp39 | |
parent | 2008-01-22 Joel Sherrill <joel.sherrill@OARcorp.com> (diff) | |
download | rtems-9185d61c541ad57d3ad472dbf85c1c1dfdafca6c.tar.bz2 |
2008-01-23 Joel Sherrill <joel.sherrill@oarcorp.com>
* sp39/init.c: Add case for long timeout on blocking operation.
* Makefile.am, configure.ac: Add new test to exercise thread
queue blokcing synchronization. sp39 and sp41 are very similar.
* sp41/.cvsignore, sp41/Makefile.am, sp41/init.c, sp41/sp41.scn,
sp41/system.h: New files.
Diffstat (limited to 'testsuites/sptests/sp39')
-rw-r--r-- | testsuites/sptests/sp39/init.c | 56 |
1 files changed, 54 insertions, 2 deletions
diff --git a/testsuites/sptests/sp39/init.c b/testsuites/sptests/sp39/init.c index 2432291cb5..22ea9a7d63 100644 --- a/testsuites/sptests/sp39/init.c +++ b/testsuites/sptests/sp39/init.c @@ -1,7 +1,7 @@ /* * Classic API Signal to Task from ISR * - * COPYRIGHT (c) 1989-2007. + * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -44,6 +44,23 @@ rtems_timer_service_routine test_event_from_isr( status = rtems_event_send( main_task, 0x01 ); } +rtems_timer_service_routine test_event_with_timeout_from_isr( + rtems_id timer, + void *arg +) +{ + rtems_status_code status; + + if ( _Event_Sync_state == THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED ) { + /* + * We want to catch the task while it is blocking. Otherwise + * just send and make it happy. + */ + case_hit = TRUE; + } + status = rtems_event_send( main_task, 0x01 ); +} + rtems_task Init( rtems_task_argument argument ) @@ -76,7 +93,7 @@ rtems_task Init( directive_failed( status, "rtems_task_create" ); /* - * Test Event send successful from ISR + * Test Event send successful from ISR -- receive is forever */ case_hit = FALSE; iterations = 0; @@ -109,6 +126,41 @@ rtems_task Init( ); /* + * Test Event send successful from ISR -- receive has timeout + */ + case_hit = FALSE; + iterations = 0; + max = 1; + + while (1) { + if ( case_hit ) + break; + status = rtems_timer_fire_after( + timer, 1, test_event_with_timeout_from_isr, NULL ); + directive_failed( status, "timer_fire_after failed" ); + + for (i=0 ; i<max ; i++ ) + if ( _Event_Sync_state == THREAD_BLOCKING_OPERATION_SATISFIED ) + break; + + status = rtems_event_receive( 0x01, RTEMS_DEFAULT_OPTIONS, 10, &out ); + directive_failed( status, "rtems_event_receive" ); + if ( case_hit == TRUE ) + break; + max += 2; + + /* with our clock tick, this is about 30 seconds */ + if ( ++iterations >= 4 * 1000 * 30) + break; + } + + printf( + "Event sent from ISR (with timeout) hitting synchronization " + "point has %soccurred\n", + (( case_hit == TRUE ) ? "" : "NOT ") + ); + + /* * Now try for a timeout case */ iterations = 0; |