[rtems commit] psxtests/psxkey08: Do not allocate task IDs

Sebastian Huber sebh at rtems.org
Wed Mar 12 06:48:16 UTC 2014


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Mar 11 13:57:22 2014 +0100

psxtests/psxkey08: Do not allocate task IDs

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 |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/testsuites/psxtests/psxkey08/init.c b/testsuites/psxtests/psxkey08/init.c
index 2c74d23..fe2e47b 100644
--- a/testsuites/psxtests/psxkey08/init.c
+++ b/testsuites/psxtests/psxkey08/init.c
@@ -89,8 +89,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, ' '),
@@ -98,7 +97,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) ||
@@ -115,7 +114,7 @@ rtems_task Init(rtems_task_argument arg)
     }
     ++created_task_count;
 
-    sc = rtems_task_start( *task_id_p,  test_task, 0 );
+    sc = rtems_task_start( task_id,  test_task, 0 );
     rtems_test_assert( sc == RTEMS_SUCCESSFUL );
 
     sc = rtems_semaphore_obtain( sema1, RTEMS_WAIT, 0 );




More information about the vc mailing list