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/spintrcritical11/init.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'testsuites/sptests/spintrcritical11') diff --git a/testsuites/sptests/spintrcritical11/init.c b/testsuites/sptests/spintrcritical11/init.c index 0d8987537c..2a3f83a315 100644 --- a/testsuites/sptests/spintrcritical11/init.c +++ b/testsuites/sptests/spintrcritical11/init.c @@ -47,13 +47,21 @@ rtems_timer_service_routine test_release_from_isr( (void) rtems_event_send( Main_task, EVENTS_TO_SEND ); } +static bool test_body( void *arg ) +{ + rtems_event_set out; + + (void) arg; + + rtems_event_receive( EVENTS_TO_RECEIVE, RTEMS_EVENT_ANY, 1, &out ); + + return false; +} + rtems_task Init( rtems_task_argument ignored ) { - rtems_event_set out; - int resets; - TEST_BEGIN(); puts( "Init - Test may not be able to detect case is hit reliably" ); @@ -62,14 +70,7 @@ rtems_task Init( Main_task = rtems_task_self(); - interrupt_critical_section_test_support_initialize( test_release_from_isr ); - - for (resets=0 ; resets< 2 ;) { - if ( interrupt_critical_section_test_support_delay() ) - resets++; - - (void) rtems_event_receive( EVENTS_TO_RECEIVE, RTEMS_EVENT_ANY, 1, &out ); - } + interrupt_critical_section_test( test_body, NULL, test_release_from_isr ); TEST_END(); rtems_test_exit(0); @@ -83,6 +84,7 @@ rtems_task Init( #define CONFIGURE_MAXIMUM_TASKS 2 #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