[PATCH 2/2] psxtests/psxkey07: Limit workspace size

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Mar 11 13:03:54 UTC 2014


This avoids large test execution times on targets with a big RAM.
---
 testsuites/psxtests/psxkey07/init.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/testsuites/psxtests/psxkey07/init.c b/testsuites/psxtests/psxkey07/init.c
index 4f96dea..090fc95 100644
--- a/testsuites/psxtests/psxkey07/init.c
+++ b/testsuites/psxtests/psxkey07/init.c
@@ -64,6 +64,8 @@ rtems_task Init(rtems_task_argument argument)
   rtems_status_code  rc;
   int                sc;
   struct timespec    delay_request;
+  uintptr_t          max_free_size = 13 * RTEMS_MINIMUM_STACK_SIZE;
+  void              *greedy;
 
   all_thread_created = 0;
 
@@ -89,6 +91,9 @@ rtems_task Init(rtems_task_argument argument)
   sc = pthread_key_create( &Key, NULL );
   rtems_test_assert( !sc );
 
+  /* Reduce workspace size if necessary to shorten test time */
+  greedy = rtems_workspace_greedy_allocate( &max_free_size, 1 );
+
   for ( ; ; ) {
     thread_p = malloc( sizeof( rtems_id ) );
     rtems_test_assert( thread_p );
@@ -130,6 +135,9 @@ rtems_task Init(rtems_task_argument argument)
       pthread_cond_wait( &set_condition_var, &mutex1 );
     pthread_mutex_unlock( &mutex1 );
   }
+
+  rtems_workspace_greedy_free( greedy );
+
   printf(
     "Init - %d pthreads have been created - OK\n"
     "Init - %d pthreads have been setted key data - OK\n",
-- 
1.7.7




More information about the devel mailing list