summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-11-09 14:49:27 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-11-09 14:49:27 +0000
commit96bdacd57d85f374df7f559b812f813d54a2381e (patch)
treefedb7f376e6e897ec33e732e5f50fffebd9473b0 /testsuites/psxtests
parent23938252ade69f44ada5f35f183644e3e6c56549 (diff)
downloadrtems-96bdacd57d85f374df7f559b812f813d54a2381e.tar.bz2
2009-11-09 Joel Sherrill <joel.sherrill@oarcorp.com>
* psxmsgq01/init.c, psxsem01/init.c: Add service to check status returned by POSIX methods which return a pointer which is -1 on error. This eliminated some casts.
Diffstat (limited to 'testsuites/psxtests')
-rw-r--r--testsuites/psxtests/ChangeLog6
-rw-r--r--testsuites/psxtests/psxmsgq01/init.c29
-rw-r--r--testsuites/psxtests/psxsem01/init.c16
3 files changed, 27 insertions, 24 deletions
diff --git a/testsuites/psxtests/ChangeLog b/testsuites/psxtests/ChangeLog
index b905b6cc45..8c8851c1d9 100644
--- a/testsuites/psxtests/ChangeLog
+++ b/testsuites/psxtests/ChangeLog
@@ -1,5 +1,11 @@
2009-11-09 Joel Sherrill <joel.sherrill@oarcorp.com>
+ * psxmsgq01/init.c, psxsem01/init.c: Add service to check status
+ returned by POSIX methods which return a pointer which is -1 on
+ error. This eliminated some casts.
+
+2009-11-09 Joel Sherrill <joel.sherrill@oarcorp.com>
+
* psxenosys/Makefile.am: Add documentation file.
* psxenosys/psxenosys.doc: New file.
diff --git a/testsuites/psxtests/psxmsgq01/init.c b/testsuites/psxtests/psxmsgq01/init.c
index 4009033ac2..69c3c918c0 100644
--- a/testsuites/psxtests/psxmsgq01/init.c
+++ b/testsuites/psxtests/psxmsgq01/init.c
@@ -1,5 +1,5 @@
/*
- * COPYRIGHT (c) 1989-2008.
+ * COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -170,8 +170,8 @@ void validate_mq_open_error_codes(void)
attr.mq_maxmsg = -1;
puts( "Init: mq_open - Create with maxmsg (-1) (EINVAL)" );
n_mq2 = mq_open( "mq2", O_CREAT | O_RDONLY, 0x777, &attr);
- fatal_posix_service_status(
- (int) n_mq2, (int ) (-1), "mq_open error return status" );
+ fatal_posix_service_pointer_minus_one(
+ (void *)n_mq2, "mq_open error return status" );
fatal_posix_service_status( errno, EINVAL, "mq_open errno EINVAL");
attr.mq_maxmsg = MAXMSG;
@@ -182,8 +182,8 @@ void validate_mq_open_error_codes(void)
attr.mq_msgsize = -1;
puts( "Init: mq_open - Create with msgsize (-1) (EINVAL)" );
n_mq2 = mq_open( "mq2", O_CREAT | O_RDONLY, 0x777, &attr);
- fatal_posix_service_status(
- (int) n_mq2, (int ) (-1), "mq_open error return status" );
+ fatal_posix_service_pointer_minus_one(
+ (void *) n_mq2, "mq_open error return status" );
fatal_posix_service_status( errno, EINVAL, "mq_open errno EINVAL");
attr.mq_msgsize = MSGSIZE;
@@ -193,8 +193,8 @@ void validate_mq_open_error_codes(void)
puts( "Init: mq_open - Open new mq without create flag (ENOENT)" );
n_mq2 = mq_open( "mq3", O_EXCL | O_RDONLY, 0x777, NULL);
- fatal_posix_service_status(
- (int) n_mq2, (int ) (-1), "mq_open error return status" );
+ fatal_posix_service_pointer_minus_one(
+ (void *) n_mq2, "mq_open error return status" );
fatal_posix_service_status( errno, ENOENT, "mq_open errno ENOENT");
/*
@@ -207,8 +207,8 @@ void validate_mq_open_error_codes(void)
puts( "Init: mq_open - Open with too long of a name (ENAMETOOLONG)" );
n_mq2 = mq_open( Get_Too_Long_Name(), O_CREAT | O_RDONLY, 0x777, NULL );
- fatal_posix_service_status(
- (int) n_mq2, (int ) (-1), "mq_open error return status" );
+ fatal_posix_service_pointer_minus_one(
+ (void *) n_mq2, "mq_open error return status" );
fatal_posix_service_status( errno, ENAMETOOLONG, "mq_open errno ENAMETOOLONG");
/*
@@ -227,8 +227,8 @@ void validate_mq_open_error_codes(void)
n_mq2 = mq_open(
Build_Queue_Name(0), O_CREAT | O_EXCL | O_RDONLY, 0x777, NULL);
- fatal_posix_service_status(
- (int) n_mq2, (int ) (-1), "mq_open error return status" );
+ fatal_posix_service_pointer_minus_one(
+ (void *) n_mq2, "mq_open error return status" );
fatal_posix_service_status( errno, EEXIST, "mq_open errno EEXIST");
status = mq_unlink( Build_Queue_Name(0) );
@@ -269,8 +269,8 @@ void validate_mq_open_error_codes(void)
puts( "Init: mq_open - system is out of resources (ENFILE)" );
n_mq2 = mq_open( Build_Queue_Name(i), O_CREAT | O_RDONLY, 0x777, NULL );
- fatal_posix_service_status(
- (int) n_mq2, (int ) (-1), "mq_open error return status" );
+ fatal_posix_service_pointer_minus_one(
+ (void *) n_mq2, "mq_open error return status" );
fatal_posix_service_status( errno, ENFILE, "mq_open errno ENFILE");
/*
@@ -683,7 +683,7 @@ void verify_open_functionality(void)
puts( "Init: mq_open - Open an existing mq ( same id )" );
n_mq = mq_open( RD_NAME, 0 );
fatal_posix_service_status(
- (int) n_mq, (int ) Test_q[RD_QUEUE].mq, "mq_open error return status" );
+ assert( n_mq == Test_q[RD_QUEUE].mq );
#endif
}
@@ -958,7 +958,6 @@ void verify_notify(void)
wait_for_signal( &set, 3, 0 );
Read_msg_from_que( RW_QUEUE, 0 );
-
/*
* EBUSY - Already Registered
*/
diff --git a/testsuites/psxtests/psxsem01/init.c b/testsuites/psxtests/psxsem01/init.c
index 5f067bb16f..247fdebea3 100644
--- a/testsuites/psxtests/psxsem01/init.c
+++ b/testsuites/psxtests/psxsem01/init.c
@@ -171,8 +171,8 @@ void *POSIX_Init(
puts( "Init: sem_open - UNSUCCESSFUL (ENAMETOOLONG)" );
n_sem1 = sem_open(Get_Too_Long_Name(), O_CREAT, 0777, 1 );
- fatal_posix_service_status(
- (int) n_sem1, (int) SEM_FAILED, "sem_open error return status");
+ fatal_posix_service_pointer_minus_one(
+ n_sem1, "sem_open error return status");
fatal_posix_service_status(
errno, ENAMETOOLONG, "sem_open errorno ENAMETOOLONG" );
@@ -187,14 +187,14 @@ void *POSIX_Init(
puts( "Init: sem_open - Create an Existing sem (EEXIST)" );
n_sem2 = sem_open("sem1", O_CREAT | O_EXCL, 0777, 1);
- fatal_posix_service_status(
- (int) n_sem2, (int) SEM_FAILED, "sem_open error return status" );
+ fatal_posix_service_pointer_minus_one(
+ n_sem2, "sem_open error return status" );
fatal_posix_service_status( errno, EEXIST, "sem_open errno EEXIST");
puts( "Init: sem_open - Open new sem without create flag (ENOENT)" );
n_sem2 = sem_open("sem3", O_EXCL, 0777, 1);
- fatal_posix_service_status(
- (int) n_sem2, (int) SEM_FAILED, "sem_open error return status" );
+ fatal_posix_service_pointer_minus_one(
+ n_sem2, "sem_open error return status" );
fatal_posix_service_status( errno, ENOENT, "sem_open errno EEXIST");
/*
@@ -218,8 +218,7 @@ void *POSIX_Init(
puts( "Init: sem_open - Open an existing sem ( same id )" );
n_sem2 = sem_open("sem1", 0 );
- fatal_posix_service_status(
- (int) n_sem2, (int) n_sem1, "sem_open error return status" );
+ assert( n_sem2 == n_sem1 );
/*
* Unlink the semaphore, then verify an open of the same name produces a
@@ -243,7 +242,6 @@ void *POSIX_Init(
status = sem_close( n_sem1 );
fatal_posix_service_status( status, 0, "sem_close semaphore");
-
/*
* Validate it n_sem2 (the last open for sem1 name can be
* correctly closed and unlinked.