[PATCH 1/2] psxtests/psxkey08: Do not allocate task IDs

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Mar 11 12:59:49 UTC 2014


We have a unified work area.  So depending on the memory layout the

    task_id_p = malloc( sizeof( rtems_id ) );
    rtems_test_assert( task_id_p );

or the

    sc = rtems_task_create(
      rtems_build_name('T','A',created_task_count, ' '),
      1,
      RTEMS_MINIMUM_STACK_SIZE,
      RTEMS_DEFAULT_MODES,
      RTEMS_DEFAULT_ATTRIBUTES,
      task_id_p
    );
    rtems_test_assert(
      (sc == RTEMS_UNSATISFIED) ||
      (sc == RTEMS_TOO_MANY) ||
      (sc == RTEMS_SUCCESSFUL)
    );

may fail.  If we are unlucky then we hit the first case and the test
fails.
---
 testsuites/psxtests/psxkey08/init.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/testsuites/psxtests/psxkey08/init.c b/testsuites/psxtests/psxkey08/init.c
index 077a7a4..6c4e2d0 100644
--- a/testsuites/psxtests/psxkey08/init.c
+++ b/testsuites/psxtests/psxkey08/init.c
@@ -90,8 +90,7 @@ rtems_task Init(rtems_task_argument arg)
   rtems_test_assert( !sc );
 
   for ( ; ; ) {
-    task_id_p = malloc( sizeof( rtems_id ) );
-    rtems_test_assert( task_id_p );
+    rtems_id task_id;
 
     sc = rtems_task_create(
       rtems_build_name('T','A',created_task_count, ' '),
@@ -99,7 +98,7 @@ rtems_task Init(rtems_task_argument arg)
       RTEMS_MINIMUM_STACK_SIZE,
       RTEMS_DEFAULT_MODES,
       RTEMS_DEFAULT_ATTRIBUTES,
-      task_id_p
+      &task_id
     );
     rtems_test_assert(
       (sc == RTEMS_UNSATISFIED) ||
-- 
1.7.7




More information about the devel mailing list