summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1996-08-09 19:55:04 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1996-08-09 19:55:04 +0000
commit13adea03e0766f2c659ecf2cb3a6eb252ad551d6 (patch)
treecee6fffe5f7485955f03cac5828fe28705fcd640 /testsuites
parentadded test case for pthread_mutexattr_init being passed a null pointer. (diff)
downloadrtems-13adea03e0766f2c659ecf2cb3a6eb252ad551d6.tar.bz2
added test cases for EINVAL cases in pthread_mutexattr_destroy
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/psxtests/psx05/init.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/testsuites/psxtests/psx05/init.c b/testsuites/psxtests/psx05/init.c
index a6f25fd42b..0171ed9f46 100644
--- a/testsuites/psxtests/psx05/init.c
+++ b/testsuites/psxtests/psx05/init.c
@@ -77,6 +77,7 @@ void *POSIX_Init(
{
int status;
pthread_mutexattr_t attr;
+ pthread_mutexattr_t destroyed_attr;
struct timespec times;
struct sched_param param;
int policy;
@@ -94,7 +95,7 @@ void *POSIX_Init(
Init_id = pthread_self();
printf( "Init's ID is 0x%08x\n", Init_id );
- /* basic checkout of mutex attributes */
+ /* tes pthread_mutex_attr_init */
puts( "Init: pthread_mutexattr_init - EINVAL (NULL attr)" );
status = pthread_mutexattr_init( NULL );
@@ -106,6 +107,25 @@ void *POSIX_Init(
Print_mutexattr( "Init: ", &attr );
+ /* create an "uninitialized" attribute structure */
+
+ status = pthread_mutexattr_init( &destroyed_attr );
+ assert( !status );
+
+ puts( "Init: pthread_mutexattr_destroy - SUCCESSFUL" );
+ status = pthread_mutexattr_destroy( &destroyed_attr );
+ assert( !status );
+
+ puts( "Init: pthread_mutexattr_destroy - EINVAL (NULL attr)" );
+ status = pthread_mutexattr_destroy( NULL );
+ assert( status == EINVAL );
+
+ puts( "Init: pthread_mutexattr_destroy - EINVAL (not initialized)" );
+ status = pthread_mutexattr_destroy( &destroyed_attr );
+ assert( status == EINVAL );
+
+ /* change the attributes structure */
+
puts( "Init: Changing mutex attributes" );
status = pthread_mutexattr_setprotocol( &attr, PTHREAD_PRIO_INHERIT );
assert( !status );