summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-09-16 15:43:15 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-09-16 15:43:15 +0200
commit7f8a978e6b078492bbc657a3731d324011274f2b (patch)
treec7710934a073c908f1d4fe3dee7ee4d898246129 /testsuites
parentsmptests/smpcache01: Remove invalidation of data cache lines from test (diff)
downloadrtems-7f8a978e6b078492bbc657a3731d324011274f2b.tar.bz2
sptests/sp07: Minimize thread dispatch latency
Do not use sprintf() in thread dispatch critical sections to avoid corruption of profiling samples. Update test to reflect thread the life cycle changes.
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/sptests/sp07/Makefile.am2
-rw-r--r--testsuites/sptests/sp07/buffered_io.c47
-rw-r--r--testsuites/sptests/sp07/init.c15
-rw-r--r--testsuites/sptests/sp07/sp07.scn17
-rw-r--r--testsuites/sptests/sp07/system.h29
-rw-r--r--testsuites/sptests/sp07/task2.c2
-rw-r--r--testsuites/sptests/sp07/task4.c21
-rw-r--r--testsuites/sptests/sp07/tcreate.c23
-rw-r--r--testsuites/sptests/sp07/tdelete.c32
-rw-r--r--testsuites/sptests/sp07/trestart.c20
-rw-r--r--testsuites/sptests/sp07/tstart.c20
11 files changed, 71 insertions, 157 deletions
diff --git a/testsuites/sptests/sp07/Makefile.am b/testsuites/sptests/sp07/Makefile.am
index d49ffa2728..b845e4a348 100644
--- a/testsuites/sptests/sp07/Makefile.am
+++ b/testsuites/sptests/sp07/Makefile.am
@@ -1,6 +1,6 @@
rtems_tests_PROGRAMS = sp07
-sp07_SOURCES = init.c buffered_io.c task1.c task2.c task3.c task4.c \
+sp07_SOURCES = init.c task1.c task2.c task3.c task4.c \
taskexit.c tcreate.c tdelete.c trestart.c tstart.c system.h
dist_rtems_tests_DATA = sp07.scn
diff --git a/testsuites/sptests/sp07/buffered_io.c b/testsuites/sptests/sp07/buffered_io.c
deleted file mode 100644
index bd0f1f5da7..0000000000
--- a/testsuites/sptests/sp07/buffered_io.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * COPYRIGHT (c) 2003-2012.
- * 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.org/license/LICENSE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <rtems.h>
-
-#include "system.h"
-
-#define RINGBUF_QUEUE_LENGTH 512
-
-#include <rtems/ringbuf.h>
-
-Ring_buffer_t Buffer;
-
-void buffered_io_initialize( void )
-{
- Ring_buffer_Initialize( &Buffer );
-}
-
-void buffered_io_flush(void)
-{
- char ch;
-
- while ( !Ring_buffer_Is_empty(&Buffer) ) {
- Ring_buffer_Remove_character( &Buffer, ch );
- fprintf( stderr, "%c", ch );
- }
- FLUSH_OUTPUT();
-}
-
-void buffered_io_add_string( char *s )
-{
- char *p = s;
-
- while ( *p ) {
- Ring_buffer_Add_character( &Buffer, *p++ );
- }
-}
diff --git a/testsuites/sptests/sp07/init.c b/testsuites/sptests/sp07/init.c
index 8622b4c02f..c08c5c4c18 100644
--- a/testsuites/sptests/sp07/init.c
+++ b/testsuites/sptests/sp07/init.c
@@ -70,8 +70,6 @@ rtems_task Init(
TEST_BEGIN();
- buffered_io_initialize();
-
Extension_name[ 1 ] = rtems_build_name( 'E', 'X', 'T', '1' );
Extension_name[ 2 ] = rtems_build_name( 'E', 'X', 'T', '2' );
@@ -155,6 +153,7 @@ rtems_task Init(
&Task_id[ 1 ]
);
directive_failed( status, "rtems_task_create of TA1" );
+ assert_extension_counts( &Task_created[ 0 ], 0x2 );
status = rtems_task_create(
Task_name[ 2 ],
@@ -165,6 +164,7 @@ rtems_task Init(
&Task_id[ 2 ]
);
directive_failed( status, "rtems_task_create of TA2" );
+ assert_extension_counts( &Task_created[ 0 ], 0x2 | 0x4 );
#define TA3_PRIORITY (RTEMS_MAXIMUM_PRIORITY - 4u)
status = rtems_task_create(
@@ -176,6 +176,7 @@ rtems_task Init(
&Task_id[ 3 ]
);
directive_failed( status, "rtems_task_create of TA3" );
+ assert_extension_counts( &Task_created[ 0 ], 0x2 | 0x4 | 0x8 );
#define TA4_PRIORITY (RTEMS_MAXIMUM_PRIORITY - 1u)
status = rtems_task_create(
@@ -187,23 +188,27 @@ rtems_task Init(
&Task_id[ 4 ]
);
directive_failed( status, "rtems_task_create of TA4" );
+ assert_extension_counts( &Task_created[ 0 ], 0x2 | 0x4 | 0x8 | 0x10 );
status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
directive_failed( status, "rtems_task_start of TA1" );
+ assert_extension_counts( &Task_started[ 0 ], 0x2 );
status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
directive_failed( status, "rtems_task_start of TA2" );
+ assert_extension_counts( &Task_started[ 0 ], 0x2 | 0x4 );
status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
directive_failed( status, "rtems_task_start of TA3" );
+ assert_extension_counts( &Task_started[ 0 ], 0x2 | 0x4 | 0x8 );
status = rtems_task_start( Task_id[ 4 ], Task_4, 0 );
directive_failed( status, "rtems_task_start of TA4" );
+ assert_extension_counts( &Task_started[ 0 ], 0x2 | 0x4 | 0x8 | 0x10 );
- status = rtems_task_restart( Task_id[ 3 ], 0 );
+ status = rtems_task_restart( Task_id[ 2 ], 0 );
directive_failed( status, "rtems_task_restart of TA3" );
-
- buffered_io_flush();
+ assert_extension_counts( &Task_restarted[ 0 ], 0x0 );
status = rtems_task_set_note( rtems_task_self(), RTEMS_NOTEPAD_4, 32 );
directive_failed( status, "task_set_node of Self id" );
diff --git a/testsuites/sptests/sp07/sp07.scn b/testsuites/sptests/sp07/sp07.scn
index e75bdd0095..0fe6f296c4 100644
--- a/testsuites/sptests/sp07/sp07.scn
+++ b/testsuites/sptests/sp07/sp07.scn
@@ -1,4 +1,4 @@
-*** TEST 7 ***
+*** BEGIN OF TEST SP 7 ***
rtems_extension_create - bad id pointer -- RTEMS_INVALID_ADDRESS
rtems_extension_create - bad name -- RTEMS_INVALID_NAME
rtems_extension_create - first one -- OK
@@ -9,15 +9,7 @@ rtems_extension_delete - second one again -- RTEMS_INVALID_ID
rtems_extension_ident -- OK
rtems_extension_ident - bad name -- RTEMS_INVALID_NAME
rtems_extension_ident - bad name -- RTEMS_INVALID_ADDRESS
-TASK_CREATE - TA1 - created
-TASK_CREATE - TA2 - created
-TASK_CREATE - TA3 - created
-TASK_CREATE - TA4 - created
-TASK_START - TA1 - started
-TASK_START - TA2 - started
-TASK_START - TA3 - started
-TASK_START - TA4 - started
-TASK_RESTART - TA3 - restarted
+rtems_extension_create - harmless -- OK
INIT - rtems_task_set_note - set my (id) RTEMS_NOTEPAD_4 to TA1's priority: 04
INIT - rtems_task_set_note - set my (SELF) RTEMS_NOTEPAD_4 to TA1's priority: 04
INIT - rtems_task_set_note - set TA1's RTEMS_NOTEPAD_8 to TA1's priority: 04
@@ -36,9 +28,6 @@ TA1 - rtems_task_set_priority - set TA2's priority: 01
TA2 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: 01
TA2 - rtems_task_suspend - suspend TA1
TA2 - rtems_task_set_priority - set priority of TA1 ( blocked )
-TASK_DELETE - TA2 TASK_DELETE deleting - TA1
-TASK_DELETE - TA2 TASK_DELETE deleting - TA3
-TASK_DELETE - TA2 TASK_DELETE deleting - TA2
TA4 - exitting task
RTEMS_TASK_EXITTED - extension invoked for TA4
-*** END OF TEST 7 ***
+*** END OF TEST SP 7 ***
diff --git a/testsuites/sptests/sp07/system.h b/testsuites/sptests/sp07/system.h
index b09912f8de..8bea0fb7f5 100644
--- a/testsuites/sptests/sp07/system.h
+++ b/testsuites/sptests/sp07/system.h
@@ -13,16 +13,6 @@
#include <tmacros.h>
-/* buffered IO */
-
-void buffered_io_initialize( void );
-
-void buffered_io_flush(void);
-
-void buffered_io_add_string( char *s );
-
-/* end of buffered IO */
-
/* functions */
rtems_task Init(
@@ -94,4 +84,23 @@ TEST_EXTERN rtems_name Task_name[ 5 ]; /* array of task names */
TEST_EXTERN rtems_id Extension_id[ 4 ];
TEST_EXTERN rtems_name Extension_name[ 4 ]; /* array of task names */
+TEST_EXTERN int Task_created[ RTEMS_ARRAY_SIZE( Task_id ) ];
+
+TEST_EXTERN int Task_started[ RTEMS_ARRAY_SIZE( Task_id ) ];
+
+TEST_EXTERN int Task_restarted[ RTEMS_ARRAY_SIZE( Task_id ) ];
+
+TEST_EXTERN int Task_deleted[ RTEMS_ARRAY_SIZE( Task_id ) ];
+
+RTEMS_INLINE_ROUTINE void assert_extension_counts( const int *table, int tasks )
+{
+ size_t i;
+
+ for ( i = 0; i < RTEMS_ARRAY_SIZE( Task_id ); ++i ) {
+ rtems_test_assert(
+ ( tasks & ( 1 << i ) ) != 0 ? table[ i ] == 1 : table[ i ] == 0
+ );
+ }
+}
+
/* end of include file */
diff --git a/testsuites/sptests/sp07/task2.c b/testsuites/sptests/sp07/task2.c
index 584c0e59c3..6451fffb07 100644
--- a/testsuites/sptests/sp07/task2.c
+++ b/testsuites/sptests/sp07/task2.c
@@ -42,9 +42,11 @@ rtems_task Task_2(
status = rtems_task_delete( Task_id[ 1 ] ); /* TA1 is blocked */
directive_failed( status, "rtems_task_delete of TA1" );
+ assert_extension_counts( &Task_deleted[ 0 ], 0x0 );
status = rtems_task_delete( Task_id[ 3 ] ); /* TA3 is ready */
directive_failed( status, "rtems_task_delete of TA3" );
+ assert_extension_counts( &Task_deleted[ 0 ], 0x0 );
status = rtems_task_delete( RTEMS_SELF );
directive_failed( status, "rtems_task_delete of SELD" );
diff --git a/testsuites/sptests/sp07/task4.c b/testsuites/sptests/sp07/task4.c
index 10832925e2..365b595d81 100644
--- a/testsuites/sptests/sp07/task4.c
+++ b/testsuites/sptests/sp07/task4.c
@@ -27,7 +27,26 @@ rtems_task Task_4(
rtems_task_argument argument
)
{
- buffered_io_flush();
+ rtems_status_code status;
+ rtems_id id;
+
+ assert_extension_counts( &Task_created[ 0 ], 0x2 | 0x4 | 0x8 | 0x10 );
+ assert_extension_counts( &Task_started[ 0 ], 0x2 | 0x4 | 0x8 | 0x10 );
+ assert_extension_counts( &Task_restarted[ 0 ], 0x4 );
+ assert_extension_counts( &Task_deleted[ 0 ], 0x0 );
+
+ /* Kill the zombies */
+ status = rtems_task_create(
+ rtems_build_name( 'L', 'A', 'Z', 'Y' ),
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ rtems_test_assert( status == RTEMS_SUCCESSFUL );
+
+ assert_extension_counts( &Task_deleted[ 0 ], 0x2 | 0x4 | 0x8 );
puts( "TA4 - exitting task" );
}
diff --git a/testsuites/sptests/sp07/tcreate.c b/testsuites/sptests/sp07/tcreate.c
index fd6027f3cc..351aacd715 100644
--- a/testsuites/sptests/sp07/tcreate.c
+++ b/testsuites/sptests/sp07/tcreate.c
@@ -27,24 +27,11 @@ bool Task_create_extension(
rtems_tcb *created_task
)
{
- char line[80];
- rtems_name name;
+ ssize_t task = task_number( created_task->Object.id );
- if ( task_number( created_task->Object.id ) > 0 ) {
- name = Task_name[ task_number( created_task->Object.id ) ];
-/*
- * FIXME: There should be a public function to
- * convert numeric rtems_names into char arrays
- * c.f. rtems_name_to_characters() in rtems/rtems/support.inl
- * but it's private.
- */
- sprintf( line, "TASK_CREATE - %c%c%c%c - created\n",
- (char)((name >> 24) & 0xff),
- (char)((name >> 16) & 0xff),
- (char)((name >> 8) & 0xff),
- (char)(name & 0xff)
- );
- buffered_io_add_string( line );
+ if (task > 0) {
+ ++Task_created[ task ];
}
- return TRUE;
+
+ return true;
}
diff --git a/testsuites/sptests/sp07/tdelete.c b/testsuites/sptests/sp07/tdelete.c
index 152db71dc4..a7136e2551 100644
--- a/testsuites/sptests/sp07/tdelete.c
+++ b/testsuites/sptests/sp07/tdelete.c
@@ -27,33 +27,11 @@ void Task_delete_extension(
rtems_tcb *deleted_task
)
{
- char line[80];
- rtems_name name;
+ ssize_t task = task_number( deleted_task->Object.id );
- if ( task_number( running_task->Object.id ) > 0 ) {
- name = Task_name[ task_number( running_task->Object.id ) ];
- sprintf( line, "TASK_DELETE - %c%c%c%c TASK_DELETE ",
- (char)((name >> 24) & 0xff),
- (char)((name >> 16) & 0xff),
- (char)((name >> 8) & 0xff),
- (char)(name & 0xff)
- );
- buffered_io_add_string( line );
- }
- if ( task_number( deleted_task->Object.id ) > 0 ) {
- name = Task_name[ task_number( deleted_task->Object.id ) ];
-/*
- * FIXME: There should be a public function to
- * convert numeric rtems_names into char arrays
- * c.f. rtems_name_to_characters() in rtems/rtems/support.inl
- * but it's private.
- */
- sprintf( line, "deleting - %c%c%c%c\n",
- (char)((name >> 24) & 0xff),
- (char)((name >> 16) & 0xff),
- (char)((name >> 8) & 0xff),
- (char)(name & 0xff)
- );
- buffered_io_add_string( line );
+ if (task > 0) {
+ ++Task_deleted[ task ];
}
+
+ rtems_test_assert( running_task != deleted_task );
}
diff --git a/testsuites/sptests/sp07/trestart.c b/testsuites/sptests/sp07/trestart.c
index 7a3fecf385..d821562f2b 100644
--- a/testsuites/sptests/sp07/trestart.c
+++ b/testsuites/sptests/sp07/trestart.c
@@ -27,23 +27,9 @@ void Task_restart_extension(
rtems_tcb *restarted_task
)
{
- char line[80];
- rtems_name name;
+ ssize_t task = task_number( restarted_task->Object.id );
- if ( task_number( restarted_task->Object.id ) > 0 ) {
- name = Task_name[ task_number( restarted_task->Object.id ) ];
-/*
- * FIXME: There should be a public function to
- * convert numeric rtems_names into char arrays
- * c.f. rtems_name_to_characters() in rtems/rtems/support.inl
- * but it's private.
- */
- sprintf( line, "TASK_RESTART - %c%c%c%c - restarted\n",
- (char)((name >> 24) & 0xff),
- (char)((name >> 16) & 0xff),
- (char)((name >> 8) & 0xff),
- (char)(name & 0xff)
- );
- buffered_io_add_string( line );
+ if (task > 0) {
+ ++Task_restarted[ task ];
}
}
diff --git a/testsuites/sptests/sp07/tstart.c b/testsuites/sptests/sp07/tstart.c
index b6e8db8af8..c2f29cb2dd 100644
--- a/testsuites/sptests/sp07/tstart.c
+++ b/testsuites/sptests/sp07/tstart.c
@@ -27,23 +27,9 @@ void Task_start_extension(
rtems_tcb *started_task
)
{
- char line[80];
- rtems_name name;
+ ssize_t task = task_number( started_task->Object.id );
- if ( task_number( started_task->Object.id ) > 0 ) {
- name = Task_name[ task_number( started_task->Object.id ) ];
-/*
- * FIXME: There should be a public function to
- * convert numeric rtems_names into char arrays
- * c.f. rtems_name_to_characters() in rtems/rtems/support.inl
- * but it's private.
- */
- sprintf( line, "TASK_START - %c%c%c%c - started\n",
- (char)((name >> 24) & 0xff),
- (char)((name >> 16) & 0xff),
- (char)((name >> 8) & 0xff),
- (char)(name & 0xff)
- );
- buffered_io_add_string( line );
+ if (task > 0) {
+ ++Task_started[ task ];
}
}