summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-04-07 15:59:09 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-04-07 16:48:02 +0200
commitfef429383413d467f3c3d617705986c383b8c767 (patch)
tree7b0dae61477a65e84fb9693b21c611845aeeff6e
parentscore: Use proper protection (diff)
downloadrtems-fef429383413d467f3c3d617705986c383b8c767.tar.bz2
psxtests/psxkey02: Test for proper error case
-rw-r--r--testsuites/psxtests/psxkey02/init.c41
-rw-r--r--testsuites/psxtests/psxkey02/psxkey02.scn10
2 files changed, 14 insertions, 37 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" );
diff --git a/testsuites/psxtests/psxkey02/psxkey02.scn b/testsuites/psxtests/psxkey02/psxkey02.scn
index f5a5f71f60..9f6fa4fea0 100644
--- a/testsuites/psxtests/psxkey02/psxkey02.scn
+++ b/testsuites/psxtests/psxkey02/psxkey02.scn
@@ -1,8 +1,6 @@
-sparc-rtems4.11-run is /home/joel/rtems-4.11-work/tools/bin/sparc-rtems4.11-run
-
-
-*** TEST KEY 02 ***
-Init - pthread_key_create - ENOMEM
+*** BEGIN OF TEST PSXKEY 2 ***
+Init - pthread_key_create - OK
+Init - pthread_key_create - EAGAIN
Init - pthread_key_delete - OK
Init - verify workspace has same memory
-*** END OF TEST KEY 02 ***
+*** END OF TEST PSXKEY 2 ***