Changeset 6ec7f21 in rtems


Ignore:
Timestamp:
Jul 16, 2018, 6:31:05 AM (5 weeks ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
da0cbef2
Parents:
00a19d6
git-author:
Sebastian Huber <sebastian.huber@…> (07/16/18 06:31:05)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/16/18 06:58:11)
Message:

posix: Fix rwlock auto initialization

Add more test cases.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/posix/src/prwlockunlock.c

    r00a19d6 r6ec7f21  
    3636  }
    3737
    38   the_rwlock->flags = POSIX_RWLOCK_MAGIC;
     38  the_rwlock->flags = (uintptr_t) the_rwlock ^ POSIX_RWLOCK_MAGIC;
    3939  return true;
    4040}
  • testsuites/psxtests/psx05/init.c

    r00a19d6 r6ec7f21  
    375375    eno = pthread_mutex_lock( &mutex );
    376376    rtems_test_assert( eno == 0 );
     377
     378    eno = pthread_mutex_unlock( &mutex );
     379    rtems_test_assert( eno == 0 );
     380
     381    eno = pthread_mutex_destroy( &mutex );
     382    rtems_test_assert( eno == 0 );
    377383  }
    378384
  • testsuites/psxtests/psxcond01/init.c

    r00a19d6 r6ec7f21  
    5252}
    5353
     54static void test_cond_auto_initialization( void )
     55{
     56  int eno;
     57
     58  {
     59    pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
     60
     61    eno = pthread_cond_destroy( &cond );
     62    rtems_test_assert( eno == 0 );
     63
     64    eno = pthread_cond_destroy( &cond );
     65    rtems_test_assert( eno == EINVAL );
     66  }
     67
     68  {
     69    pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
     70
     71    eno = pthread_cond_signal( &cond );
     72    rtems_test_assert( eno == 0 );
     73
     74    eno = pthread_cond_destroy( &cond );
     75    rtems_test_assert( eno == 0 );
     76  }
     77
     78  {
     79    pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
     80
     81    eno = pthread_cond_broadcast( &cond );
     82    rtems_test_assert( eno == 0 );
     83
     84    eno = pthread_cond_destroy( &cond );
     85    rtems_test_assert( eno == 0 );
     86  }
     87}
     88
    5489void *POSIX_Init(
    5590  void *argument
     
    6095
    6196  TEST_BEGIN();
     97
     98  test_cond_auto_initialization();
    6299
    63100  puts( "Init - pthread_mutex_init - Mutex1 - OK" );
  • testsuites/psxtests/psxrwlock01/test.c

    r00a19d6 r6ec7f21  
    259259
    260260    eno = pthread_rwlock_rdlock( &rw );
     261    rtems_test_assert( eno == 0 );
     262
     263    eno = pthread_rwlock_unlock( &rw );
     264    rtems_test_assert( eno == 0 );
     265
     266    eno = pthread_rwlock_destroy( &rw );
    261267    rtems_test_assert( eno == 0 );
    262268  }
Note: See TracChangeset for help on using the changeset viewer.