summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/spintrcritical15
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-09-08 15:18:07 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-09-10 07:12:55 +0200
commit802808900053e732881795d0d748d8fdc2a54e13 (patch)
tree7e9c96202fc39ce59cbd1c7d19806348631f2d14 /testsuites/sptests/spintrcritical15
parentscore: More strict RTEMS_DEQUALIFY implementation. (diff)
downloadrtems-802808900053e732881795d0d748d8fdc2a54e13.tar.bz2
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().
Diffstat (limited to 'testsuites/sptests/spintrcritical15')
-rw-r--r--testsuites/sptests/spintrcritical15/init.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/testsuites/sptests/spintrcritical15/init.c b/testsuites/sptests/spintrcritical15/init.c
index ec84165bf8..b68098778a 100644
--- a/testsuites/sptests/spintrcritical15/init.c
+++ b/testsuites/sptests/spintrcritical15/init.c
@@ -23,7 +23,6 @@ rtems_task Secondary_task(rtems_task_argument ignored);
#define INIT_PRIORITY 2
#define BLOCKER_PRIORITY 1
-rtems_id Main_task;
rtems_id Secondary_task_id;
rtems_id Semaphore;
@@ -39,12 +38,26 @@ rtems_task Secondary_task(
}
}
+static bool test_body( void *arg )
+{
+ rtems_status_code sc;
+
+ (void) arg;
+
+ sc = rtems_task_restart( Secondary_task_id, 1 );
+ rtems_test_assert( sc == RTEMS_SUCCESSFUL );
+
+ sc = rtems_semaphore_obtain( Semaphore, RTEMS_DEFAULT_OPTIONS, 1 );
+ rtems_test_assert( sc == RTEMS_TIMEOUT );
+
+ return false;
+}
+
rtems_task Init(
rtems_task_argument ignored
)
{
rtems_status_code sc;
- int resets;
TEST_BEGIN();
puts(
@@ -77,20 +90,7 @@ rtems_task Init(
sc = rtems_task_start( Secondary_task_id, Secondary_task, 0 );
directive_failed( sc, "rtems_task_start" );
- Main_task = rtems_task_self();
-
- interrupt_critical_section_test_support_initialize( NULL );
-
- for (resets=0 ; resets<10 ;) {
- if ( interrupt_critical_section_test_support_delay() )
- resets++;
-
- sc = rtems_task_restart( Secondary_task_id, 1 );
- directive_failed( sc, "rtems_task_restart" );
-
- sc = rtems_semaphore_obtain( Semaphore, RTEMS_DEFAULT_OPTIONS, 1 );
- fatal_directive_status( sc, RTEMS_TIMEOUT, "rtems_semaphore_obtain" );
- }
+ interrupt_critical_section_test( test_body, NULL, NULL );
TEST_END();
rtems_test_exit(0);
@@ -103,6 +103,7 @@ rtems_task Init(
#define CONFIGURE_MAXIMUM_TASKS 2
#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
#define CONFIGURE_MICROSECONDS_PER_TICK 1000
#define CONFIGURE_INIT_TASK_PRIORITY INIT_PRIORITY
#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_PREEMPT