summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/sp41
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-10-31 13:37:59 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-02 08:46:47 +0100
commitd271c3bb78f86dd9417a964b019b8e38911064fa (patch)
tree3c36b87c580464cc7f1e5aec89e1137a68759da3 /testsuites/sptests/sp41
parentposix: Fix timer interval (diff)
downloadrtems-d271c3bb78f86dd9417a964b019b8e38911064fa.tar.bz2
rtems: Add rtems_task_iterate()
Update #2423.
Diffstat (limited to 'testsuites/sptests/sp41')
-rw-r--r--testsuites/sptests/sp41/init.c35
-rw-r--r--testsuites/sptests/sp41/sp41.scn9
2 files changed, 32 insertions, 12 deletions
diff --git a/testsuites/sptests/sp41/init.c b/testsuites/sptests/sp41/init.c
index c4846086b6..04b855b352 100644
--- a/testsuites/sptests/sp41/init.c
+++ b/testsuites/sptests/sp41/init.c
@@ -11,27 +11,31 @@
#include "config.h"
#endif
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
#include <tmacros.h>
#include <rtems/score/objectimpl.h>
const char rtems_test_name[] = "SP 41";
-/* forward declarations to avoid warnings */
-rtems_task Init(rtems_task_argument argument);
-void iterator(Thread_Control *thread);
+static bool visitor( Thread_Control *thread, void *arg )
+{
+ int *counter = arg;
+ ++( *counter );
+ return false;
+}
-void iterator(
- Thread_Control *thread
-)
+static void iterator( Thread_Control *thread )
{
}
-rtems_task Init(
+static rtems_task Init(
rtems_task_argument ignored
)
{
void *tmp;
+ int counter;
TEST_BEGIN();
@@ -39,9 +43,22 @@ rtems_task Init(
tmp = _Objects_Information_table[ OBJECTS_CLASSIC_API ][ 1 ];
_Objects_Information_table[ OBJECTS_CLASSIC_API ][ 1 ] = NULL;
- puts( "Init - rtems_iterate_over_all_threads" );
- rtems_iterate_over_all_threads(iterator);
+ puts( "Init - rtems_task_iterate - NULL table" );
+ counter = 0;
+ rtems_task_iterate( visitor, &counter );
_Objects_Information_table[ OBJECTS_CLASSIC_API ][ 1 ] = tmp;
+ rtems_test_assert( counter == 1 );
+
+ puts( "Init - rtems_task_iterate - normal" );
+ counter = 0;
+ rtems_task_iterate( visitor, &counter );
+ rtems_test_assert( counter == 2 );
+
+ puts( "Init - rtems_iterate_over_all_threads - NULL" );
+ rtems_iterate_over_all_threads( NULL );
+
+ puts( "Init - rtems_iterate_over_all_threads - iterator" );
+ rtems_iterate_over_all_threads( iterator );
TEST_END();
rtems_test_exit(0);
diff --git a/testsuites/sptests/sp41/sp41.scn b/testsuites/sptests/sp41/sp41.scn
index 02933ae252..9a43b0ad92 100644
--- a/testsuites/sptests/sp41/sp41.scn
+++ b/testsuites/sptests/sp41/sp41.scn
@@ -1,4 +1,7 @@
-*** TEST 41 ***
+*** BEGIN OF TEST SP 41 ***
Init - overwrite internal value to trip case
-Init - rtems_iterate_over_all_threads
-*** END OF TEST 41 ***
+Init - rtems_task_iterate - NULL table
+Init - rtems_task_iterate - normal
+Init - rtems_iterate_over_all_threads - NULL
+Init - rtems_iterate_over_all_threads - iterator
+*** END OF TEST SP 41 ***