summaryrefslogtreecommitdiffstats
path: root/testsuites/smptests/smp03/init.c
diff options
context:
space:
mode:
authorJennifer Averett <Jennifer.Averett@OARcorp.com>2011-07-29 18:14:49 +0000
committerJennifer Averett <Jennifer.Averett@OARcorp.com>2011-07-29 18:14:49 +0000
commit5c28345815a4039eb5a2ba933573e761a8ff03ee (patch)
tree3befc7bf2904d0dbcc9f3694cfeb413f49a2fd42 /testsuites/smptests/smp03/init.c
parent2011-07-29 Ricardo Aguirre <el.mastin@ymail.com> (diff)
downloadrtems-5c28345815a4039eb5a2ba933573e761a8ff03ee.tar.bz2
2011-07-29 Jennifer Averett <Jennifer.Averett@OARcorp.com>
* smp03/init.c, smp03/system.h, smp03/tasks.c: Modified test to force a task to run prior to starting the next task. This allows the last task to always preempt, where if the tasks started in an odd order the last task could run prior the the task it was supposed to preempt.
Diffstat (limited to 'testsuites/smptests/smp03/init.c')
-rw-r--r--testsuites/smptests/smp03/init.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/testsuites/smptests/smp03/init.c b/testsuites/smptests/smp03/init.c
index 3ea0330a06..55a2cc7945 100644
--- a/testsuites/smptests/smp03/init.c
+++ b/testsuites/smptests/smp03/init.c
@@ -49,6 +49,11 @@ rtems_task Init(
locked_printf( "\n\n*** SMP03 TEST ***\n" );
+ /* Initialize the TaskRan array */
+ TaskRan[0] = true;
+ for ( i=1; i<rtems_smp_get_number_of_processors() ; i++ ) {
+ TaskRan[i] = false;
+ }
/* Show that the init task is running on this cpu */
PrintTaskInfo( "Init" );
@@ -67,8 +72,12 @@ rtems_task Init(
&id
);
status = rtems_task_start( id, Test_task, i );
-
- Loop();
+
+ /* Allow task to start before starting next task.
+ * This is necessary on some simulators.
+ */
+ while (TaskRan[i] == false)
+ ;
}
/* Create/Start an aditional task with the highest priority */
@@ -80,16 +89,20 @@ rtems_task Init(
RTEMS_DEFAULT_ATTRIBUTES,
&id
);
- TestFinished = false;
status = rtems_task_start(id,Test_task,rtems_smp_get_number_of_processors());
- /* Wait on the last task to run */
- while(!TestFinished)
- ;
+ /* Wait on all tasks to run */
+ while (1) {
+ TestFinished = true;
+ for ( i=1; i < (rtems_smp_get_number_of_processors()+1) ; i++ ) {
+ if (TaskRan[i] == false)
+ TestFinished = false;
+ }
+ if (TestFinished) {
+ locked_printf( "*** END OF TEST SMP03 ***\n" );
+ rtems_test_exit( 0 );
+ }
+ }
- /* End the test */
- Loop();
- locked_printf( "*** END OF TEST SMP03 ***\n" );
- Loop();
rtems_test_exit( 0 );
}