[PATCH] SMP06: add extra check to avoid silent error
Daniel Hellstrom
daniel at gaisler.com
Sun Nov 10 16:20:55 UTC 2013
By adding an extra check which CPU the tasks are actually run at
and a printout if wrong we can avoid a silent error.
---
testsuites/smptests/smp06/init.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/testsuites/smptests/smp06/init.c b/testsuites/smptests/smp06/init.c
index ce0541e..ee9e519 100644
--- a/testsuites/smptests/smp06/init.c
+++ b/testsuites/smptests/smp06/init.c
@@ -16,8 +16,18 @@
volatile bool Ran;
+#define INIT_TASK_IDX 0
+#define TA01_TASK_IDX 1
+#define TA02_TASK_IDX 2
+volatile uint32_t Ran_cpu[3];
+
static void success(void)
{
+ /* Check that TA2 replacced the oldest task - the Init task */
+ if ((Ran_cpu[INIT_TASK_IDX] != Ran_cpu[TA02_TASK_IDX]) ||
+ (Ran_cpu[TA01_TASK_IDX] == Ran_cpu[TA02_TASK_IDX])) {
+ locked_printf( "TA2 DID NOT REPLACE INIT TASK: TEST FAILED\n" );
+ }
locked_printf( "*** END OF TEST SMP06 ***\n" );
rtems_test_exit( 0 );
}
@@ -39,8 +49,10 @@ rtems_task Test_task(
Ran = true;
if ( do_exit ) {
+ Ran_cpu[TA02_TASK_IDX] = cpu_num;
success();
}
+ Ran_cpu[TA01_TASK_IDX] = cpu_num;
while(1)
;
}
@@ -65,6 +77,8 @@ rtems_task Init(
directive_failed( status, "clock tick" );
cpu_num = rtems_smp_get_current_processor();
+
+ Ran_cpu[INIT_TASK_IDX] = cpu_num;
/*
* Create a task at equal priority.
--
1.7.0.4
More information about the devel
mailing list