summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psxkey02/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/psxtests/psxkey02/init.c')
-rw-r--r--testsuites/psxtests/psxkey02/init.c41
1 files changed, 10 insertions, 31 deletions
diff --git a/testsuites/psxtests/psxkey02/init.c b/testsuites/psxtests/psxkey02/init.c
index 684eb4af55..5734db76a5 100644
--- a/testsuites/psxtests/psxkey02/init.c
+++ b/testsuites/psxtests/psxkey02/init.c
@@ -24,49 +24,28 @@ rtems_task Init(rtems_task_argument ignored);
rtems_task Init(rtems_task_argument ignored)
{
- pthread_key_t key;
+ pthread_key_t key1;
+ pthread_key_t key2;
int eno;
bool ok;
- uintptr_t to_alloc;
- void *alloced;
rtems_resource_snapshot snapshot;
void *greedy;
TEST_BEGIN();
- greedy = rtems_workspace_greedy_allocate_all_except_largest( &to_alloc );
+ greedy = rtems_workspace_greedy_allocate( NULL, 0 );
rtems_resource_snapshot_take( &snapshot );
- puts( "Init - pthread_key_create - ENOMEM" );
- while ( to_alloc > 8 ) {
- ok = rtems_workspace_allocate( to_alloc, &alloced );
- rtems_test_assert( ok );
-
- eno = pthread_key_create( &key, NULL );
-
- rtems_workspace_free( alloced );
-
- if ( eno == 0 )
- break;
-
- rtems_test_assert( eno == ENOMEM );
-
- /*
- * Verify heap is still in same shape if we couldn't allocate a task
- */
- ok = rtems_resource_snapshot_check( &snapshot );
- rtems_test_assert( ok );
-
- to_alloc -= 8;
- }
-
+ puts( "Init - pthread_key_create - OK" );
+ eno = pthread_key_create( &key1, NULL );
rtems_test_assert( eno == 0 );
- /*
- * Verify heap is still in same shape after we free the task
- */
+ puts( "Init - pthread_key_create - EAGAIN" );
+ eno = pthread_key_create( &key2, NULL );
+ rtems_test_assert( eno == EAGAIN );
+
puts( "Init - pthread_key_delete - OK" );
- eno = pthread_key_delete( key );
+ eno = pthread_key_delete( key1 );
rtems_test_assert( eno == 0 );
puts( "Init - verify workspace has same memory" );