From 236839e208c89cb6686e9e18517606651bbfdec3 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 5 Aug 2009 16:33:36 +0000 Subject: 2009-08-05 Joel Sherrill * psxmsgq04/init.c, psxmsgq04/psxmsgq04.doc, psxmsgq04/psxmsgq04.scn: Update to handle ENFILE case now that POSIX message queues and message queue file descriptors are configured separately and this error is possible. --- testsuites/psxtests/psxmsgq04/init.c | 18 +++++++++++++----- testsuites/psxtests/psxmsgq04/psxmsgq04.doc | 5 ++++- testsuites/psxtests/psxmsgq04/psxmsgq04.scn | 1 + 3 files changed, 18 insertions(+), 6 deletions(-) (limited to 'testsuites/psxtests/psxmsgq04') diff --git a/testsuites/psxtests/psxmsgq04/init.c b/testsuites/psxtests/psxmsgq04/init.c index 958bd52daa..3f524233cd 100644 --- a/testsuites/psxtests/psxmsgq04/init.c +++ b/testsuites/psxtests/psxmsgq04/init.c @@ -35,19 +35,26 @@ void *POSIX_Init( attr.mq_maxmsg = 1; attr.mq_msgsize = sizeof(int); - puts( "Init - Open message queue" ); + puts( "Init - Open message queue instance 1" ); Queue = mq_open( "Queue", O_CREAT | O_RDWR, 0x777, &attr ); if ( Queue == (-1) ) perror( "mq_open failed" ); assert( Queue != (-1) ); - puts( "Init - Unlink message queue" ); + puts( "Init - Open message queue instance 2 - FAIL - ENFILE " ); + second_Queue = mq_open( "Queue2", O_CREAT | O_RDWR, 0x777, &attr ); + if ( second_Queue != (-1) ) + puts( "mq_open did not failed" ); + assert( second_Queue == (-1) ); + assert( errno == ENFILE ); + + puts( "Init - Unlink message queue instance 1" ); sc = mq_unlink( "Queue" ); if ( sc != 0 ) perror( "mq_unlink failed" ); assert( sc == 0 ); - puts( "Init - Close message queue" ); + puts( "Init - Close message queue instance 1" ); sc = mq_close( Queue ); if ( sc != 0 ) perror( "mq_close failed" ); @@ -96,8 +103,9 @@ void *POSIX_Init( #define CONFIGURE_POSIX_INIT_THREAD_TABLE -#define CONFIGURE_MAXIMUM_POSIX_THREADS 1 -#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 1 +#define CONFIGURE_MAXIMUM_POSIX_THREADS 1 +#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 1 +#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_FILE_DESCRIPTORS 2 #define CONFIGURE_POSIX_INIT_THREAD_TABLE diff --git a/testsuites/psxtests/psxmsgq04/psxmsgq04.doc b/testsuites/psxtests/psxmsgq04/psxmsgq04.doc index c913a5b3d2..41fffac8aa 100644 --- a/testsuites/psxtests/psxmsgq04/psxmsgq04.doc +++ b/testsuites/psxtests/psxmsgq04/psxmsgq04.doc @@ -21,5 +21,8 @@ directives: concepts: -+ Ensure that the situation where we do not have enough Workspace memory ++ Ensure the case where there are more file descriptors than message queues + configured is properly handled. + ++ Ensure that the case where we do not have enough Workspace memory left to allocate the message buffers is properly handled. diff --git a/testsuites/psxtests/psxmsgq04/psxmsgq04.scn b/testsuites/psxtests/psxmsgq04/psxmsgq04.scn index 7992f4403d..17310552af 100644 --- a/testsuites/psxtests/psxmsgq04/psxmsgq04.scn +++ b/testsuites/psxtests/psxmsgq04/psxmsgq04.scn @@ -1,5 +1,6 @@ *** POSIX MESSAGE QUEUE TEST 4 *** Init - Open message queue +Init - Open message queue instance 2 - FAIL - ENFILE Init - Unlink message queue Init - Close message queue Init - Memory allocation error test -- cgit v1.2.3