[rtems commit] testsupport: Generate unique worker names

Sebastian Huber sebh at rtems.org
Wed Mar 25 10:47:16 UTC 2015


Module:    rtems
Branch:    master
Commit:    10a699d3fc79fa92b7df2289009098ebfee5a4f3
Changeset: http://git.rtems.org/rtems/commit/?id=10a699d3fc79fa92b7df2289009098ebfee5a4f3

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Mar 25 11:33:34 2015 +0100

testsupport: Generate unique worker names

---

 cpukit/libmisc/testsupport/testparallel.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/cpukit/libmisc/testsupport/testparallel.c b/cpukit/libmisc/testsupport/testparallel.c
index 86c685b..dabd564 100644
--- a/cpukit/libmisc/testsupport/testparallel.c
+++ b/cpukit/libmisc/testsupport/testparallel.c
@@ -111,6 +111,11 @@ static void worker_task(rtems_task_argument arg)
   }
 }
 
+static char digit(size_t i, size_t pos)
+{
+  return '0' + (i / pos) % 10;
+}
+
 void rtems_test_parallel(
   rtems_test_parallel_context *ctx,
   rtems_test_parallel_worker_setup worker_setup,
@@ -158,7 +163,12 @@ void rtems_test_parallel(
     rtems_id worker_id;
 
     sc = rtems_task_create(
-      rtems_build_name('W', 'O', 'R', 'K'),
+      rtems_build_name(
+        'W',
+        digit(worker_index, 100),
+        digit(worker_index, 10),
+        digit(worker_index, 1)
+      ),
       worker_priority,
       RTEMS_MINIMUM_STACK_SIZE,
       RTEMS_DEFAULT_MODES,



More information about the vc mailing list