summaryrefslogtreecommitdiffstats
path: root/c/src/tests/sptests
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1998-06-12 20:55:21 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1998-06-12 20:55:21 +0000
commit9b413eaef683ad383f9fbae5ea6b1f55b8acbe35 (patch)
treee4c4277b52edf92025de2ba05f60a720868e59e9 /c/src/tests/sptests
parentFixed comment block at the beginning of the file for a copyright date (diff)
downloadrtems-9b413eaef683ad383f9fbae5ea6b1f55b8acbe35.tar.bz2
Patch from Eric Norum to avoid printing from context switch user extension.
The array is too long and needs to be shortened.
Diffstat (limited to 'c/src/tests/sptests')
-rw-r--r--c/src/tests/sptests/sp04/system.h11
-rw-r--r--c/src/tests/sptests/sp04/task1.c17
-rw-r--r--c/src/tests/sptests/sp04/tswitch.c16
3 files changed, 37 insertions, 7 deletions
diff --git a/c/src/tests/sptests/sp04/system.h b/c/src/tests/sptests/sp04/system.h
index 191de5a2dc..cef8f5546b 100644
--- a/c/src/tests/sptests/sp04/system.h
+++ b/c/src/tests/sptests/sp04/system.h
@@ -66,4 +66,15 @@ TEST_EXTERN rtems_name Extension_name[ 4 ]; /* array of task names */
/* array of task run counts */
TEST_EXTERN volatile rtems_unsigned32 Run_count[ 4 ];
+/*
+ * Keep track of task switches
+ */
+struct taskSwitchLog {
+ int taskIndex;
+ rtems_time_of_day when;
+};
+extern struct taskSwitchLog taskSwitchLog[];
+extern int taskSwitchLogIndex;
+volatile extern int testsFinished;
+
/* end of include file */
diff --git a/c/src/tests/sptests/sp04/task1.c b/c/src/tests/sptests/sp04/task1.c
index 53f0188ca0..40b7c175f4 100644
--- a/c/src/tests/sptests/sp04/task1.c
+++ b/c/src/tests/sptests/sp04/task1.c
@@ -21,6 +21,18 @@
#include "system.h"
+static void
+showTaskSwitches (void)
+{
+ int i;
+ int switches = taskSwitchLogIndex;
+
+ for (i = 0 ; i < switches ; i++) {
+ put_name( Task_name[taskSwitchLog[i].taskIndex], FALSE );
+ print_time( "- ", &taskSwitchLog[i].when, "\n" );
+ }
+}
+
rtems_task Task_1(
rtems_task_argument argument
)
@@ -97,7 +109,10 @@ rtems_task Task_1(
);
directive_failed( status, "rtems_task_mode" );
- while ( FOREVER );
+ while ( !testsFinished );
+ showTaskSwitches ();
+ puts( "*** END OF TEST 4 ***" );
+ exit (0);
}
}
}
diff --git a/c/src/tests/sptests/sp04/tswitch.c b/c/src/tests/sptests/sp04/tswitch.c
index 3d4d553431..1301507782 100644
--- a/c/src/tests/sptests/sp04/tswitch.c
+++ b/c/src/tests/sptests/sp04/tswitch.c
@@ -23,6 +23,10 @@
#include "system.h"
+struct taskSwitchLog taskSwitchLog[1000];
+int taskSwitchLogIndex;
+volatile int testsFinished;;
+
rtems_extension Task_switch(
rtems_tcb *unused,
rtems_tcb *heir
@@ -43,13 +47,13 @@ rtems_extension Task_switch(
status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
directive_failed( status, "rtems_clock_get" );
- put_name( Task_name[ index ], FALSE );
- print_time( "- ", &time, "\n" );
-
- if ( time.second >= 16 ) {
- puts( "*** END OF TEST 4 ***" );
- exit( 0 );
+ if (taskSwitchLogIndex < (sizeof taskSwitchLog / sizeof taskSwitchLog[0])) {
+ taskSwitchLog[taskSwitchLogIndex].taskIndex = index;
+ taskSwitchLog[taskSwitchLogIndex].when = time;
+ taskSwitchLogIndex++;
}
+ if ( time.second >= 16 )
+ testsFinished = 1;
break;
case 0: