summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/smptests/ChangeLog8
-rw-r--r--testsuites/smptests/smp03/init.c33
-rw-r--r--testsuites/smptests/smp03/system.h6
-rw-r--r--testsuites/smptests/smp03/tasks.c7
4 files changed, 38 insertions, 16 deletions
diff --git a/testsuites/smptests/ChangeLog b/testsuites/smptests/ChangeLog
index 03be0e4c1a..0dc8526b21 100644
--- a/testsuites/smptests/ChangeLog
+++ b/testsuites/smptests/ChangeLog
@@ -1,5 +1,13 @@
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.
+
+2011-07-29 Jennifer Averett <Jennifer.Averett@OARcorp.com>
+
* smp01/init.c, smp02/init.c, smp02/tasks.c, smp03/init.c,
smp03/tasks.c, smp04/Makefile.am, smp04/init.c, smp05/init.c,
smp06/init.c, smp07/init.c, smp08/init.c: Cleaned up tests and fixed
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 );
}
diff --git a/testsuites/smptests/smp03/system.h b/testsuites/smptests/smp03/system.h
index 1161d74b8d..ea38614365 100644
--- a/testsuites/smptests/smp03/system.h
+++ b/testsuites/smptests/smp03/system.h
@@ -50,6 +50,12 @@ rtems_task Test_task(
/*
* Keep the names and IDs in global variables so another task can use them.
*/
+
+TEST_EXTERN volatile bool TaskRan[ CONFIGURE_SMP_MAXIMUM_PROCESSORS + 1 ];
+
+/*
+ * Keep the names and IDs in global variables so another task can use them.
+ */
void Loop(void);
void PrintTaskInfo(
const char *task_name
diff --git a/testsuites/smptests/smp03/tasks.c b/testsuites/smptests/smp03/tasks.c
index 16660a0b23..50ba5dabe4 100644
--- a/testsuites/smptests/smp03/tasks.c
+++ b/testsuites/smptests/smp03/tasks.c
@@ -25,12 +25,7 @@ rtems_task Test_task(
sprintf( task_name, "TA%" PRIu32, task_index );
PrintTaskInfo( task_name );
- /* If this is the last task created set a flag for the
- * test to end.
- */
- if ( task_index == rtems_smp_get_number_of_processors() ) {
- TestFinished = true;
- }
+ TaskRan[task_index] = true;
/* Wait for the test to end without giving up this processor */
while(1)