Changeset fef4293 in rtems


Ignore:
Timestamp:
Apr 7, 2014, 1:59:09 PM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
d61c315
Parents:
b2700c35
git-author:
Sebastian Huber <sebastian.huber@…> (04/07/14 13:59:09)
git-committer:
Sebastian Huber <sebastian.huber@…> (04/07/14 14:48:02)
Message:

psxtests/psxkey02: Test for proper error case

Location:
testsuites/psxtests/psxkey02
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • testsuites/psxtests/psxkey02/init.c

    rb2700c35 rfef4293  
    2525rtems_task Init(rtems_task_argument ignored)
    2626{
    27   pthread_key_t           key;
     27  pthread_key_t           key1;
     28  pthread_key_t           key2;
    2829  int                     eno;
    2930  bool                    ok;
    30   uintptr_t               to_alloc;
    31   void                   *alloced;
    3231  rtems_resource_snapshot snapshot;
    3332  void                   *greedy;
     
    3534  TEST_BEGIN();
    3635
    37   greedy = rtems_workspace_greedy_allocate_all_except_largest( &to_alloc );
     36  greedy = rtems_workspace_greedy_allocate( NULL, 0 );
    3837  rtems_resource_snapshot_take( &snapshot );
    3938
    40   puts( "Init - pthread_key_create - ENOMEM" );
    41   while ( to_alloc > 8 ) {
    42     ok = rtems_workspace_allocate( to_alloc, &alloced );
    43     rtems_test_assert( ok );
    44 
    45     eno = pthread_key_create( &key, NULL );
    46 
    47     rtems_workspace_free( alloced );
    48 
    49     if ( eno == 0 )
    50       break;
    51 
    52     rtems_test_assert( eno == ENOMEM );
    53 
    54     /*
    55      * Verify heap is still in same shape if we couldn't allocate a task
    56      */
    57     ok = rtems_resource_snapshot_check( &snapshot );
    58     rtems_test_assert( ok );
    59 
    60     to_alloc -= 8;
    61   }
    62 
     39  puts( "Init - pthread_key_create - OK" );
     40  eno = pthread_key_create( &key1, NULL );
    6341  rtems_test_assert( eno == 0 );
    6442
    65   /*
    66    * Verify heap is still in same shape after we free the task
    67    */
     43  puts( "Init - pthread_key_create - EAGAIN" );
     44  eno = pthread_key_create( &key2, NULL );
     45  rtems_test_assert( eno == EAGAIN );
     46
    6847  puts( "Init - pthread_key_delete - OK" );
    69   eno = pthread_key_delete( key );
     48  eno = pthread_key_delete( key1 );
    7049  rtems_test_assert( eno == 0 );
    7150
  • testsuites/psxtests/psxkey02/psxkey02.scn

    rb2700c35 rfef4293  
    1 sparc-rtems4.11-run is /home/joel/rtems-4.11-work/tools/bin/sparc-rtems4.11-run
    2 
    3 
    4 *** TEST KEY 02 ***
    5 Init - pthread_key_create - ENOMEM
     1*** BEGIN OF TEST PSXKEY 2 ***
     2Init - pthread_key_create - OK
     3Init - pthread_key_create - EAGAIN
    64Init - pthread_key_delete - OK
    75Init - verify workspace has same memory
    8 *** END OF TEST KEY 02 ***
     6*** END OF TEST PSXKEY 2 ***
Note: See TracChangeset for help on using the changeset viewer.