summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psxintrcritical01/init.c
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/psxtests/psxintrcritical01/init.c
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/psxtests/psxintrcritical01/init.c')
-rw-r--r--testsuites/psxtests/psxintrcritical01/init.c42
1 files changed, 19 insertions, 23 deletions
diff --git a/testsuites/psxtests/psxintrcritical01/init.c b/testsuites/psxtests/psxintrcritical01/init.c
index 2c4620969f..a6a64bad60 100644
--- a/testsuites/psxtests/psxintrcritical01/init.c
+++ b/testsuites/psxtests/psxintrcritical01/init.c
@@ -19,31 +19,40 @@ const char rtems_test_name[] = "PSXINTRCRITICAL 1";
/* forward declarations to avoid warnings */
rtems_task Init(rtems_task_argument ignored);
-rtems_timer_service_routine test_release_from_isr(rtems_id timer, void *arg);
#define TEST_NAME "01"
#define TEST_STRING "POSIX Timer"
-rtems_id Main_task;
-timer_t Timer;
-struct itimerspec TimerParams;
+static timer_t Timer;
+static struct itimerspec TimerParams;
#define POSIX_TIMER_RELATIVE 0
-rtems_timer_service_routine test_release_from_isr(
+static bool test_body( void *arg )
+{
+ int rv;
+
+ (void) arg;
+
+ rv = timer_settime(Timer, POSIX_TIMER_RELATIVE, &TimerParams, NULL);
+ rtems_test_assert( rv == 0 );
+
+ return false;
+}
+
+static rtems_timer_service_routine test_release_from_isr(
rtems_id timer,
void *arg
)
{
- (void) timer_settime(Timer, POSIX_TIMER_RELATIVE, &TimerParams, NULL);
+ test_body( NULL );
}
rtems_task Init(
rtems_task_argument ignored
)
{
- int sc;
- int resets;
+ int sc;
TEST_BEGIN();
@@ -59,27 +68,13 @@ rtems_task Init(
rtems_test_exit(0);
}
- Main_task = rtems_task_self();
-
/* we don't care if it ever fires */
TimerParams.it_interval.tv_sec = 10;
TimerParams.it_interval.tv_nsec = 0;
TimerParams.it_value.tv_sec = 10;
TimerParams.it_value.tv_nsec = 0;
- interrupt_critical_section_test_support_initialize( test_release_from_isr );
-
- for (resets=0 ; resets<10 ;) {
- if ( interrupt_critical_section_test_support_delay() )
- resets++;
-
- sc = timer_settime(Timer, POSIX_TIMER_RELATIVE, &TimerParams, NULL);
- if ( sc == -1 ) {
- perror ("Error in timer setting\n");
- rtems_test_exit(0);
- }
-
- }
+ interrupt_critical_section_test( test_body, NULL, test_release_from_isr );
TEST_END();
rtems_test_exit(0);
@@ -93,6 +88,7 @@ rtems_task Init(
#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_MAXIMUM_TIMERS 1
#define CONFIGURE_MAXIMUM_POSIX_TIMERS 1
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
#define CONFIGURE_MICROSECONDS_PER_TICK 1000
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION