From 802808900053e732881795d0d748d8fdc2a54e13 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 8 Sep 2014 15:18:07 +0200 Subject: tests: Rework interrupt critical tests This avoids test durations of more than one hour on fast targets, since fast targets can count a lot during one clock tick period, so the minor loop iteration count was quite high. Estimate now the test body duration to iterate only through the interesting time window. Add and use interrupt_critical_section_test(). --- testsuites/sptests/spintrcritical09/init.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'testsuites/sptests/spintrcritical09') diff --git a/testsuites/sptests/spintrcritical09/init.c b/testsuites/sptests/spintrcritical09/init.c index 90948eccc6..bc942d5f77 100644 --- a/testsuites/sptests/spintrcritical09/init.c +++ b/testsuites/sptests/spintrcritical09/init.c @@ -20,7 +20,7 @@ const char rtems_test_name[] = "SPINTRCRITICAL 9"; static rtems_id Semaphore; -static bool case_hit; +static bool case_hit = false; static Thread_blocking_operation_States getState(void) { @@ -64,12 +64,20 @@ static rtems_timer_service_routine test_release_from_isr( } } +static bool test_body( void *arg ) +{ + (void) arg; + + rtems_semaphore_obtain( Semaphore, RTEMS_DEFAULT_OPTIONS, 1 ); + + return case_hit; +} + static rtems_task Init( rtems_task_argument ignored ) { rtems_status_code sc; - int resets; TEST_BEGIN(); @@ -84,16 +92,7 @@ static rtems_task Init( ); directive_failed( sc, "rtems_semaphore_create of SM1" ); - interrupt_critical_section_test_support_initialize( test_release_from_isr ); - - case_hit = false; - - for (resets=0 ; resets< 2 ;) { - if ( interrupt_critical_section_test_support_delay() ) - resets++; - - (void) rtems_semaphore_obtain( Semaphore, RTEMS_DEFAULT_OPTIONS, 1 ); - } + interrupt_critical_section_test( test_body, NULL, test_release_from_isr ); if ( case_hit ) { puts( "Init - It appears the case has been hit" ); @@ -112,6 +111,7 @@ static rtems_task Init( #define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_MAXIMUM_TIMERS 1 #define CONFIGURE_MAXIMUM_SEMAPHORES 1 +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -- cgit v1.2.3