summaryrefslogtreecommitdiffstats
path: root/testsuites/smptests
diff options
context:
space:
mode:
authorJennifer Averett <Jennifer.Averett@OARcorp.com>2011-07-29 12:29:34 +0000
committerJennifer Averett <Jennifer.Averett@OARcorp.com>2011-07-29 12:29:34 +0000
commitcf288c3898a5d7db53af312a67da4dca9f2e6045 (patch)
tree31eee4135aa35e8c0512a3f6fe79bf22b4c8c4b6 /testsuites/smptests
parent2011-07-28 Ricardo Aguirre <el.mastin@ymail.com> (diff)
downloadrtems-cf288c3898a5d7db53af312a67da4dca9f2e6045.tar.bz2
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 some print statement problems. * smp04/tasks.c: Removed.
Diffstat (limited to 'testsuites/smptests')
-rw-r--r--testsuites/smptests/ChangeLog8
-rw-r--r--testsuites/smptests/smp01/init.c5
-rw-r--r--testsuites/smptests/smp02/init.c3
-rw-r--r--testsuites/smptests/smp02/tasks.c8
-rw-r--r--testsuites/smptests/smp03/init.c13
-rw-r--r--testsuites/smptests/smp03/tasks.c2
-rw-r--r--testsuites/smptests/smp04/Makefile.am2
-rw-r--r--testsuites/smptests/smp04/init.c52
-rw-r--r--testsuites/smptests/smp04/tasks.c31
-rw-r--r--testsuites/smptests/smp05/init.c2
-rw-r--r--testsuites/smptests/smp06/init.c6
-rw-r--r--testsuites/smptests/smp07/init.c6
-rw-r--r--testsuites/smptests/smp08/init.c7
13 files changed, 75 insertions, 70 deletions
diff --git a/testsuites/smptests/ChangeLog b/testsuites/smptests/ChangeLog
index f21a0d7373..03be0e4c1a 100644
--- a/testsuites/smptests/ChangeLog
+++ b/testsuites/smptests/ChangeLog
@@ -1,3 +1,11 @@
+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
+ some print statement problems.
+ * smp04/tasks.c: Removed.
+
2011-06-29 Joel Sherrill <joel.sherrill@oarcorp.com>
* smp01/smp01.doc, smp02/smp02.doc, smp03/smp03.doc, smp04/smp04.doc,
diff --git a/testsuites/smptests/smp01/init.c b/testsuites/smptests/smp01/init.c
index 098a980828..6bca7563fd 100644
--- a/testsuites/smptests/smp01/init.c
+++ b/testsuites/smptests/smp01/init.c
@@ -63,7 +63,7 @@ rtems_task Init(
directive_failed( status, "task create" );
cpu_num = bsp_smp_processor_id();
- (" CPU %d start task TA%c\n", cpu_num, ch);
+ locked_printf(" CPU %d start task TA%c\n", cpu_num, ch);
status = rtems_task_start( id, Test_task, i+1 );
directive_failed( status, "task start" );
@@ -78,8 +78,7 @@ rtems_task Init(
allDone = false;
}
if (allDone) {
- Loop();
- locked_printf( "*** END OF TEST SMP01 ***" );
+ locked_printf( "*** END OF TEST SMP01 ***\n" );
rtems_test_exit( 0 );
}
}
diff --git a/testsuites/smptests/smp02/init.c b/testsuites/smptests/smp02/init.c
index ad9974a0a7..0da90924cd 100644
--- a/testsuites/smptests/smp02/init.c
+++ b/testsuites/smptests/smp02/init.c
@@ -47,7 +47,7 @@ rtems_task Init(
status = rtems_semaphore_obtain( Semaphore, RTEMS_WAIT, 0);
directive_failed( status,"rtems_semaphore_obtain of SEM1\n");
- for ( i=1; i < CONFIGURE_SMP_MAXIMUM_PROCESSORS; i++ ){
+ for ( i=1; i < rtems_smp_get_number_of_processors(); i++ ){
/* Create and start tasks for each CPU */
ch = '0' + i;
@@ -64,7 +64,6 @@ rtems_task Init(
cpu_num = bsp_smp_processor_id();
locked_printf(" CPU %d start task TA%c\n", cpu_num, ch);
status = rtems_task_start( id, Test_task, i+1 );
- locked_printf(str, "rtems_task_start TA%d", i+1);
directive_failed( status, str );
}
diff --git a/testsuites/smptests/smp02/tasks.c b/testsuites/smptests/smp02/tasks.c
index 01b24c472e..e972f1f5d2 100644
--- a/testsuites/smptests/smp02/tasks.c
+++ b/testsuites/smptests/smp02/tasks.c
@@ -15,7 +15,7 @@
#include "system.h"
-void Loop() {
+void Loop(void) {
volatile int i;
for (i=0; i<300000; i++);
@@ -26,8 +26,6 @@ void LogSemaphore(
int cpu_num,
uint32_t task_index
){
- int i;
-
if (Log_index < LOG_SIZE) {
/* Log the information */
Log[ Log_index ].IsLocked = obtained;
@@ -57,7 +55,5 @@ rtems_task Test_task(
LogSemaphore(false, cpu_num, task_index);
rtems_semaphore_release( Semaphore );
- }
-
- while(1);
+ } while(1);
}
diff --git a/testsuites/smptests/smp03/init.c b/testsuites/smptests/smp03/init.c
index 060371b9d5..3ea0330a06 100644
--- a/testsuites/smptests/smp03/init.c
+++ b/testsuites/smptests/smp03/init.c
@@ -29,7 +29,6 @@ void PrintTaskInfo(
)
{
int cpu_num;
- rtems_status_code sc;
cpu_num = bsp_smp_processor_id();
@@ -41,21 +40,21 @@ rtems_task Init(
)
{
int i;
- char ch;
+ char ch = '0';
rtems_id id;
rtems_status_code status;
Loop();
locked_print_initialize();
- locked_printf( "\n\n*** SMP03 TEST ***" );
+ locked_printf( "\n\n*** SMP03 TEST ***\n" );
/* Show that the init task is running on this cpu */
PrintTaskInfo( "Init" );
/* for each remaining cpu create and start a task */
- for ( i=1; i < CONFIGURE_SMP_MAXIMUM_PROCESSORS; i++ ){
+ for ( i=1; i < rtems_smp_get_number_of_processors(); i++ ){
ch = '0' + i;
@@ -82,13 +81,15 @@ rtems_task Init(
&id
);
TestFinished = false;
- status = rtems_task_start( id, Test_task, CONFIGURE_SMP_MAXIMUM_PROCESSORS );
+ status = rtems_task_start(id,Test_task,rtems_smp_get_number_of_processors());
/* Wait on the last task to run */
while(!TestFinished)
;
/* End the test */
- locked_printf( "*** END OF TEST SMP03 ***" );
+ Loop();
+ locked_printf( "*** END OF TEST SMP03 ***\n" );
+ Loop();
rtems_test_exit( 0 );
}
diff --git a/testsuites/smptests/smp03/tasks.c b/testsuites/smptests/smp03/tasks.c
index d609596d3f..16660a0b23 100644
--- a/testsuites/smptests/smp03/tasks.c
+++ b/testsuites/smptests/smp03/tasks.c
@@ -28,7 +28,7 @@ rtems_task Test_task(
/* If this is the last task created set a flag for the
* test to end.
*/
- if ( task_index == CONFIGURE_SMP_MAXIMUM_PROCESSORS ) {
+ if ( task_index == rtems_smp_get_number_of_processors() ) {
TestFinished = true;
}
diff --git a/testsuites/smptests/smp04/Makefile.am b/testsuites/smptests/smp04/Makefile.am
index 80f2968dc5..232f515334 100644
--- a/testsuites/smptests/smp04/Makefile.am
+++ b/testsuites/smptests/smp04/Makefile.am
@@ -5,7 +5,7 @@
MANAGERS = all
rtems_tests_PROGRAMS = smp04
-smp04_SOURCES = init.c tasks.c system.h ../../support/src/locked_print.c
+smp04_SOURCES = init.c system.h ../../support/src/locked_print.c
dist_rtems_tests_DATA = smp04.scn
dist_rtems_tests_DATA += smp04.doc
diff --git a/testsuites/smptests/smp04/init.c b/testsuites/smptests/smp04/init.c
index 3bbe28cb38..88528e3d4f 100644
--- a/testsuites/smptests/smp04/init.c
+++ b/testsuites/smptests/smp04/init.c
@@ -25,15 +25,18 @@ void Loop() {
for (i=0; i<500000; i++);
}
-void PrintTaskInfo(
- const char *task_name
+rtems_task Test_task(
+ rtems_task_argument task_index
)
{
int cpu_num;
cpu_num = bsp_smp_processor_id();
+ locked_printf(" CPU %d running task TA%" PRIu32 "\n", cpu_num, task_index );
+ Loop();
+ TaskRan[task_index] = true;
- locked_printf(" CPU %d running task %s\n", cpu_num, task_name );
+ while(1);
}
rtems_task Init(
@@ -45,17 +48,26 @@ rtems_task Init(
rtems_id id;
rtems_status_code status;
bool allDone;
+ int cpu_num;
Loop();
locked_print_initialize();
locked_printf( "\n\n*** SMP04 TEST ***\n" );
- PrintTaskInfo( "Init" );
+ /* Display which cpu is running this init thread. */
+ cpu_num = bsp_smp_processor_id();
+ locked_printf(" CPU %d running task Init\n", cpu_num );
+ /* Set all Tasks to not ran except for the init task */
TaskRan[0] = true;
for ( i=1; i <= rtems_smp_get_number_of_processors() ; i++ )
TaskRan[i] = false;
+
+ /*
+ * For each processor create and start a task alternating
+ * between RTEMS_PREEMPT and RTEMS_NO_PREEMPT.
+ */
for ( i=1; i < rtems_smp_get_number_of_processors() ; i++ ){
/* Create and start tasks for each CPU */
@@ -75,20 +87,33 @@ rtems_task Init(
RTEMS_DEFAULT_ATTRIBUTES,
&id
);
- }
- for ( i=1; i < rtems_smp_get_number_of_processors() ; i++ ){
+ locked_printf(
+ "Start TA%c a %s task\n",
+ ch,
+ ((i%2) ? "RTEMS_PREEMPT" : "RTEMS_NO_PREEMPT" )
+ );
status = rtems_task_start( id, Test_task, i );
- /* Force a wait on the task to run in order to synchronize on
+ /*
+ * Force a wait on the task to run in order to synchronize on
* simulated systems.
*/
while (TaskRan[i] == false)
;
}
+ /*
+ * Create and start one more task. This task
+ * should preempt the longest running PREEMPTABLE
+ * task and run on that cpu.
+ */
ch = '0' + rtems_smp_get_number_of_processors() ;
-
+ locked_printf(
+ "Create a TA%c a %s task\n",
+ ch,
+ "RTEMS_PREEMPT"
+ );
status = rtems_task_create(
rtems_build_name( 'T', 'A', ch, ' ' ),
3,
@@ -97,13 +122,20 @@ rtems_task Init(
RTEMS_DEFAULT_ATTRIBUTES,
&id
);
+ locked_printf(
+ "Start TA%c a %s task\n",
+ ch,
+ "RTEMS_PREEMPT"
+ );
status = rtems_task_start(
id,
Test_task,
rtems_smp_get_number_of_processors()
);
- /* Wait on the all tasks to run */
+ /*
+ * Wait on the all tasks to run
+ */
while (1) {
allDone = true;
for ( i=1; i<=rtems_smp_get_number_of_processors() ; i++ ) {
@@ -112,7 +144,7 @@ rtems_task Init(
}
if (allDone) {
Loop();
- locked_printf( "*** END OF TEST SMP04 ***" );
+ locked_printf( "*** END OF TEST SMP04 ***\n" );
rtems_test_exit( 0 );
}
}
diff --git a/testsuites/smptests/smp04/tasks.c b/testsuites/smptests/smp04/tasks.c
deleted file mode 100644
index a8b96cf688..0000000000
--- a/testsuites/smptests/smp04/tasks.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * COPYRIGHT (c) 1989-2011.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.com/license/LICENSE.
- *
- * $Id$
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "system.h"
-
-rtems_task Test_task(
- rtems_task_argument task_index
-)
-{
- char task_name[5];
-
- sprintf(task_name, "TA%" PRIu32, task_index );
- PrintTaskInfo( task_name );
-
- Loop();
- TaskRan[task_index] = true;
-
- while(1);
-}
diff --git a/testsuites/smptests/smp05/init.c b/testsuites/smptests/smp05/init.c
index f2307246a1..901827e6bf 100644
--- a/testsuites/smptests/smp05/init.c
+++ b/testsuites/smptests/smp05/init.c
@@ -17,7 +17,7 @@ rtems_task Test_task(
)
{
locked_printf( "Shut down from CPU %d\n", bsp_smp_processor_id() );
- locked_printf( "*** END OF TEST SMP05 ***" );
+ locked_printf( "*** END OF TEST SMP05 ***\n" );
rtems_test_exit(0);
}
diff --git a/testsuites/smptests/smp06/init.c b/testsuites/smptests/smp06/init.c
index 0514385e61..0aea5732f3 100644
--- a/testsuites/smptests/smp06/init.c
+++ b/testsuites/smptests/smp06/init.c
@@ -31,7 +31,7 @@ rtems_task Test_task(
Ran = true;
if ( do_exit ) {
- locked_printf( "*** END OF TEST SMP06 ***" );
+ locked_printf( "*** END OF TEST SMP06 ***\n" );
rtems_test_exit(0);
}
while(1)
@@ -42,8 +42,6 @@ rtems_task Init(
rtems_task_argument argument
)
{
- int i;
- char ch;
int cpu_num;
rtems_id id;
rtems_status_code status;
@@ -115,7 +113,7 @@ rtems_task Init(
#define CONFIGURE_MAXIMUM_TASKS 4
#define CONFIGURE_INIT_TASK_PRIORITY 2
-#define CONFIGURE_INIT_TASK_MODES RTEMS_PREEMPT
+#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_PREEMPT
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
diff --git a/testsuites/smptests/smp07/init.c b/testsuites/smptests/smp07/init.c
index 727bc15536..24d6712f36 100644
--- a/testsuites/smptests/smp07/init.c
+++ b/testsuites/smptests/smp07/init.c
@@ -44,7 +44,11 @@ rtems_task Test_task(
TaskRan = true;
/* Print that the task is up and running. */
- locked_printf(" CPU %d running Task %s after semaphore release\n", cpu_num, name);
+ locked_printf(
+ " CPU %d running Task %s after semaphore release\n",
+ cpu_num,
+ name
+ );
(void) rtems_task_delete( RTEMS_SELF );
}
diff --git a/testsuites/smptests/smp08/init.c b/testsuites/smptests/smp08/init.c
index 70055be022..85775a0209 100644
--- a/testsuites/smptests/smp08/init.c
+++ b/testsuites/smptests/smp08/init.c
@@ -22,7 +22,6 @@ void PrintTaskInfo(
)
{
int cpu_num;
- rtems_status_code sc;
cpu_num = bsp_smp_processor_id();
@@ -45,7 +44,7 @@ rtems_task Init(
rtems_status_code status;
rtems_time_of_day time;
int i;
- char ch;
+ char ch[4];
rtems_id id;
locked_print_initialize();
@@ -77,10 +76,10 @@ rtems_task Init(
PrintTaskInfo( "Init", &time );
for ( i=1; i <= rtems_smp_get_number_of_processors() *3; i++ ) {
- ch = '0' + i;
+ sprintf(ch, "%02" PRId32, i );
status = rtems_task_create(
- rtems_build_name( 'T', 'A', ch, ' ' ),
+ rtems_build_name( 'T', 'A', ch[0], ch[1] ),
1,
RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_MODES,