From ff6ab1b594d9f073ece9b7fedf1f6977f52aeee5 Mon Sep 17 00:00:00 2001 From: Ralf Corsepius Date: Tue, 11 Nov 2003 00:59:49 +0000 Subject: 2003-11-10 Ralf Corsepius * .cvsignore: Remove. * ChangeLog: Remove. * Makefile.am: Remove. * configure.ac: Remove. * psxtests.am: Remove. * include/.cvsignore: Remove. * include/Makefile.am: Remove. * include/pmacros.h: Remove. * psx01/.cvsignore: Remove. * psx01/Makefile.am: Remove. * psx01/init.c: Remove. * psx01/psx01.scn: Remove. * psx01/system.h: Remove. * psx01/task.c: Remove. * psx02/.cvsignore: Remove. * psx02/Makefile.am: Remove. * psx02/init.c: Remove. * psx02/psx02.scn: Remove. * psx02/system.h: Remove. * psx02/task.c: Remove. * psx03/.cvsignore: Remove. * psx03/Makefile.am: Remove. * psx03/init.c: Remove. * psx03/psx03.scn: Remove. * psx03/system.h: Remove. * psx03/task.c: Remove. * psx04/.cvsignore: Remove. * psx04/Makefile.am: Remove. * psx04/init.c: Remove. * psx04/psx04.scn: Remove. * psx04/system.h: Remove. * psx04/task1.c: Remove. * psx04/task2.c: Remove. * psx04/task3.c: Remove. * psx05/.cvsignore: Remove. * psx05/Makefile.am: Remove. * psx05/init.c: Remove. * psx05/psx05.scn: Remove. * psx05/system.h: Remove. * psx05/task.c: Remove. * psx05/task2.c: Remove. * psx05/task3.c: Remove. * psx06/.cvsignore: Remove. * psx06/Makefile.am: Remove. * psx06/init.c: Remove. * psx06/psx06.scn: Remove. * psx06/system.h: Remove. * psx06/task.c: Remove. * psx06/task2.c: Remove. * psx07/.cvsignore: Remove. * psx07/Makefile.am: Remove. * psx07/init.c: Remove. * psx07/psx07.scn: Remove. * psx07/system.h: Remove. * psx07/task.c: Remove. * psx08/.cvsignore: Remove. * psx08/Makefile.am: Remove. * psx08/init.c: Remove. * psx08/psx08.scn: Remove. * psx08/system.h: Remove. * psx08/task1.c: Remove. * psx08/task2.c: Remove. * psx08/task3.c: Remove. * psx09/.cvsignore: Remove. * psx09/Makefile.am: Remove. * psx09/init.c: Remove. * psx09/psx09.scn: Remove. * psx09/system.h: Remove. * psx10/.cvsignore: Remove. * psx10/Makefile.am: Remove. * psx10/init.c: Remove. * psx10/psx10.scn: Remove. * psx10/system.h: Remove. * psx10/task.c: Remove. * psx10/task2.c: Remove. * psx10/task3.c: Remove. * psx11/.cvsignore: Remove. * psx11/Makefile.am: Remove. * psx11/init.c: Remove. * psx11/psx11.scn: Remove. * psx11/system.h: Remove. * psx11/task.c: Remove. * psx12/.cvsignore: Remove. * psx12/Makefile.am: Remove. * psx12/init.c: Remove. * psx12/psx12.scn: Remove. * psx12/system.h: Remove. * psx12/task.c: Remove. * psx13/.cvsignore: Remove. * psx13/Makefile.am: Remove. * psx13/main.c: Remove. * psx13/psx13.scn: Remove. * psx13/test.c: Remove. * psxcancel/.cvsignore: Remove. * psxcancel/Makefile.am: Remove. * psxcancel/init.c: Remove. * psxcancel/psxcancel.scn: Remove. * psxchroot01/.cvsignore: Remove. * psxchroot01/Makefile.am: Remove. * psxchroot01/main.c: Remove. * psxchroot01/psxchroot01.scn: Remove. * psxchroot01/test.c: Remove. * psxfile01/.cvsignore: Remove. * psxfile01/Makefile.am: Remove. * psxfile01/main.c: Remove. * psxfile01/psxfile01.scn: Remove. * psxfile01/test.c: Remove. * psxfile01/test_cat.c: Remove. * psxfile01/test_extend.c: Remove. * psxfile01/test_write.c: Remove. * psxhdrs/.cvsignore: Remove. * psxhdrs/Makefile.am: Remove. * psxhdrs/clock01.c: Remove. * psxhdrs/clock02.c: Remove. * psxhdrs/clock03.c: Remove. * psxhdrs/clock04.c: Remove. * psxhdrs/clock05.c: Remove. * psxhdrs/clock06.c: Remove. * psxhdrs/cond01.c: Remove. * psxhdrs/cond02.c: Remove. * psxhdrs/cond03.c: Remove. * psxhdrs/cond04.c: Remove. * psxhdrs/cond05.c: Remove. * psxhdrs/cond06.c: Remove. * psxhdrs/cond07.c: Remove. * psxhdrs/cond08.c: Remove. * psxhdrs/cond09.c: Remove. * psxhdrs/cond10.c: Remove. * psxhdrs/key01.c: Remove. * psxhdrs/key02.c: Remove. * psxhdrs/key03.c: Remove. * psxhdrs/key04.c: Remove. * psxhdrs/mutex01.c: Remove. * psxhdrs/mutex02.c: Remove. * psxhdrs/mutex03.c: Remove. * psxhdrs/mutex04.c: Remove. * psxhdrs/mutex05.c: Remove. * psxhdrs/mutex06.c: Remove. * psxhdrs/mutex07.c: Remove. * psxhdrs/mutex08.c: Remove. * psxhdrs/mutex09.c: Remove. * psxhdrs/mutex10.c: Remove. * psxhdrs/mutex11.c: Remove. * psxhdrs/mutex12.c: Remove. * psxhdrs/mutex13.c: Remove. * psxhdrs/mutex14.c: Remove. * psxhdrs/mutex15.c: Remove. * psxhdrs/mutex16.c: Remove. * psxhdrs/proc01.c: Remove. * psxhdrs/proc02.c: Remove. * psxhdrs/proc03.c: Remove. * psxhdrs/proc04.c: Remove. * psxhdrs/proc05.c: Remove. * psxhdrs/proc06.c: Remove. * psxhdrs/proc07.c: Remove. * psxhdrs/proc08.c: Remove. * psxhdrs/proc09.c: Remove. * psxhdrs/proc10.c: Remove. * psxhdrs/proc11.c: Remove. * psxhdrs/proc12.c: Remove. * psxhdrs/proc13.c: Remove. * psxhdrs/proc14.c: Remove. * psxhdrs/pthread01.c: Remove. * psxhdrs/pthread02.c: Remove. * psxhdrs/pthread03.c: Remove. * psxhdrs/pthread04.c: Remove. * psxhdrs/pthread05.c: Remove. * psxhdrs/pthread06.c: Remove. * psxhdrs/pthread07.c: Remove. * psxhdrs/pthread08.c: Remove. * psxhdrs/pthread09.c: Remove. * psxhdrs/pthread10.c: Remove. * psxhdrs/pthread11.c: Remove. * psxhdrs/pthread12.c: Remove. * psxhdrs/pthread13.c: Remove. * psxhdrs/pthread14.c: Remove. * psxhdrs/pthread15.c: Remove. * psxhdrs/pthread16.c: Remove. * psxhdrs/pthread17.c: Remove. * psxhdrs/pthread18.c: Remove. * psxhdrs/pthread19.c: Remove. * psxhdrs/pthread20.c: Remove. * psxhdrs/pthread21.c: Remove. * psxhdrs/pthread22.c: Remove. * psxhdrs/pthread23.c: Remove. * psxhdrs/pthread24.c: Remove. * psxhdrs/pthread25.c: Remove. * psxhdrs/pthread26.c: Remove. * psxhdrs/pthread27.c: Remove. * psxhdrs/pthread28.c: Remove. * psxhdrs/pthread29.c: Remove. * psxhdrs/pthread30.c: Remove. * psxhdrs/pthread31.c: Remove. * psxhdrs/pthread32.c: Remove. * psxhdrs/pthread33.c: Remove. * psxhdrs/pthread34.c: Remove. * psxhdrs/pthread35.c: Remove. * psxhdrs/pthread36.c: Remove. * psxhdrs/sched01.c: Remove. * psxhdrs/sched02.c: Remove. * psxhdrs/sched03.c: Remove. * psxhdrs/sched04.c: Remove. * psxhdrs/sched05.c: Remove. * psxhdrs/sched06.c: Remove. * psxhdrs/sched07.c: Remove. * psxhdrs/sched08.c: Remove. * psxhdrs/signal01.c: Remove. * psxhdrs/signal02.c: Remove. * psxhdrs/signal03.c: Remove. * psxhdrs/signal04.c: Remove. * psxhdrs/signal05.c: Remove. * psxhdrs/signal06.c: Remove. * psxhdrs/signal07.c: Remove. * psxhdrs/signal08.c: Remove. * psxhdrs/signal09.c: Remove. * psxhdrs/signal10.c: Remove. * psxhdrs/signal11.c: Remove. * psxhdrs/signal12.c: Remove. * psxhdrs/signal13.c: Remove. * psxhdrs/signal14.c: Remove. * psxhdrs/signal15.c: Remove. * psxhdrs/signal16.c: Remove. * psxhdrs/signal17.c: Remove. * psxhdrs/signal18.c: Remove. * psxhdrs/signal19.c: Remove. * psxhdrs/signal20.c: Remove. * psxhdrs/signal21.c: Remove. * psxhdrs/signal22.c: Remove. * psxhdrs/signal23.c: Remove. * psxhdrs/sync01.c: Remove. * psxhdrs/sync02.c: Remove. * psxhdrs/sync03.c: Remove. * psxhdrs/time01.c: Remove. * psxhdrs/time02.c: Remove. * psxhdrs/time03.c: Remove. * psxhdrs/time04.c: Remove. * psxhdrs/time05.c: Remove. * psxhdrs/time06.c: Remove. * psxhdrs/time07.c: Remove. * psxhdrs/time08.c: Remove. * psxhdrs/time09.c: Remove. * psxhdrs/time10.c: Remove. * psxhdrs/time11.c: Remove. * psxhdrs/time12.c: Remove. * psxhdrs/time13.c: Remove. * psxhdrs/timer01.c: Remove. * psxhdrs/timer02.c: Remove. * psxhdrs/timer03.c: Remove. * psxhdrs/timer04.c: Remove. * psxhdrs/timer05.c: Remove. * psxhdrs/timer06.c: Remove. * psxhdrs/timer07.c: Remove. * psxmount/.cvsignore: Remove. * psxmount/Makefile.am: Remove. * psxmount/main.c: Remove. * psxmount/psxmount.scn: Remove. * psxmount/test.c: Remove. * psxmsgq01/.cvsignore: Remove. * psxmsgq01/Makefile.am: Remove. * psxmsgq01/init.c: Remove. * psxmsgq01/psxmsgq01.scn: Remove. * psxmsgq01/system.h: Remove. * psxreaddir/.cvsignore: Remove. * psxreaddir/Makefile.am: Remove. * psxreaddir/main.c: Remove. * psxreaddir/psxreaddir.scn: Remove. * psxreaddir/test.c: Remove. * psxsem01/.cvsignore: Remove. * psxsem01/Makefile.am: Remove. * psxsem01/init.c: Remove. * psxsem01/psxsem01.scn: Remove. * psxsem01/system.h: Remove. * psxstat/.cvsignore: Remove. * psxstat/Makefile.am: Remove. * psxstat/main.c: Remove. * psxstat/psxstat.scn: Remove. * psxstat/test.c: Remove. * psxtime/.cvsignore: Remove. * psxtime/Makefile.am: Remove. * psxtime/main.c: Remove. * psxtime/psxtime.scn: Remove. * psxtime/test.c: Remove. * psxtimer/.cvsignore: Remove. * psxtimer/Makefile.am: Remove. * psxtimer/psxtimer.c: Remove. * psxtimer/psxtimer.scn: Remove. * psxtimer/system.h: Remove. --- c/src/tests/psxtests/psxmsgq01/.cvsignore | 2 - c/src/tests/psxtests/psxmsgq01/Makefile.am | 44 - c/src/tests/psxtests/psxmsgq01/init.c | 1315 -------------------------- c/src/tests/psxtests/psxmsgq01/psxmsgq01.scn | 116 --- c/src/tests/psxtests/psxmsgq01/system.h | 75 -- 5 files changed, 1552 deletions(-) delete mode 100644 c/src/tests/psxtests/psxmsgq01/.cvsignore delete mode 100644 c/src/tests/psxtests/psxmsgq01/Makefile.am delete mode 100644 c/src/tests/psxtests/psxmsgq01/init.c delete mode 100644 c/src/tests/psxtests/psxmsgq01/psxmsgq01.scn delete mode 100644 c/src/tests/psxtests/psxmsgq01/system.h (limited to 'c/src/tests/psxtests/psxmsgq01') diff --git a/c/src/tests/psxtests/psxmsgq01/.cvsignore b/c/src/tests/psxtests/psxmsgq01/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/tests/psxtests/psxmsgq01/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/tests/psxtests/psxmsgq01/Makefile.am b/c/src/tests/psxtests/psxmsgq01/Makefile.am deleted file mode 100644 index ae8e8e247a..0000000000 --- a/c/src/tests/psxtests/psxmsgq01/Makefile.am +++ /dev/null @@ -1,44 +0,0 @@ -## -## $Id$ -## - - -TEST = psxmsgq01 - -MANAGERS = all - -C_FILES = init.c -C_O_FILES = $(C_FILES:%.c=${ARCH}/%.$(OBJEXT)) - -H_FILES = system.h -noinst_HEADERS = $(H_FILES) - -DOCTYPES = scn -DOCS = $(DOCTYPES:%=$(TEST).%) - -SRCS = $(DOCS) $(C_FILES) $(H_FILES) -OBJS = $(C_O_FILES) - -PRINT_SRCS = $(DOCS) - -PGM = ${ARCH}/$(TEST).exe - -include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg -include $(top_srcdir)/../automake/compile.am -include $(top_srcdir)/../automake/leaf.am -include $(top_srcdir)/psxtests.am - -# -# (OPTIONAL) Add local stuff here using += -# - -AM_CPPFLAGS += -I$(top_srcdir)/include - -${PGM}: $(OBJS) $(LINK_FILES) - $(make-exe) - -all-local: $(ARCH) $(TMPINSTALL_FILES) - -EXTRA_DIST = $(C_FILES) $(DOCS) - -include $(top_srcdir)/../automake/local.am diff --git a/c/src/tests/psxtests/psxmsgq01/init.c b/c/src/tests/psxtests/psxmsgq01/init.c deleted file mode 100644 index 26fca6c738..0000000000 --- a/c/src/tests/psxtests/psxmsgq01/init.c +++ /dev/null @@ -1,1315 +0,0 @@ -/* - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - * - * $Id$ - */ - -#define CONFIGURE_INIT -#include "system.h" -#include -#include -#include -#include -#include /* signal facilities */ - -typedef struct { - char msg[ 50 ]; - int size; - unsigned int priority; -}Test_Message_t; -Test_Message_t Predefined_Msgs[MAXMSG+1]; -Test_Message_t Predefined_Msgs[MAXMSG+1] = { - { "12345678", 9, MQ_PRIO_MAX-1 }, /* Max Length Message med */ - { "", 1, 1 }, /* NULL Message low */ - { "Last", 5, MQ_PRIO_MAX }, /* Queue Full Message hi */ - { "No Message", 0, MQ_PRIO_MAX-1 }, /* 0 length Message med */ - { "1", 2, 0 }, /* Cause Overflow Behavior */ -}; -int Priority_Order[MAXMSG+1] = { 2, 0, 3, 1, MAXMSG }; - - -typedef struct { - mqd_t mq; - Test_Queue_Types index; - char *name; - int oflag; - int maxmsg; - int msgsize; - int count; -} Test_queue_type; - -Test_queue_type Test_q[ NUMBER_OF_TEST_QUEUES ] = -{ - { 0, 0, "Qread", ( O_CREAT | O_RDONLY | O_NONBLOCK ), MAXMSG, MSGSIZE, 0 }, - { 0, 1, "Qwrite", ( O_CREAT | O_WRONLY | O_NONBLOCK ), MAXMSG, MSGSIZE, 0 }, - { 0, 2, "Qnoblock", ( O_CREAT | O_RDWR | O_NONBLOCK ), MAXMSG, MSGSIZE, 0 }, - { 0, 3, "Qblock", ( O_CREAT | O_RDWR ) , MAXMSG, MSGSIZE, 0 }, - { 0, 4, "Qdefault", ( O_CREAT | O_RDWR ) , 10, 16, 0 }, - { 0, 5, "mq6", ( O_CREAT | O_WRONLY | O_NONBLOCK ), MAXMSG, MSGSIZE, 0 }, -}; - -#define RW_NAME Test_q[ RW_QUEUE ].name -#define DEFAULT_NAME Test_q[ DEFAULT_RW ].name -#define RD_NAME Test_q[ RD_QUEUE ].name -#define WR_NAME Test_q[ WR_QUEUE ].name -#define BLOCKING_NAME Test_q[ BLOCKING ].name -#define CLOSED_NAME Test_q[ CLOSED ].name - -#define RW_ATTR Test_q[ RW_QUEUE ].oflag -#define DEFAULT_ATTR Test_q[ DEFAULT_RW ].oflag -#define RD_ATTR Test_q[ RD_QUEUE ].oflag -#define WR_ATTR Test_q[ WR_QUEUE ].oflag -#define BLOCK_ATTR Test_q[ BLOCKING ].oflag -#define CLOSED_ATTR Test_q[ CLOSED ].oflag - -/* - * Outputs a header at each test section. - */ -void Start_Test( - char *description -) -{ - printf( "_______________%s\n", description ); -} - - -void Validate_attributes( - mqd_t mq, - int oflag, - int msg_count -) -{ - int status; - struct mq_attr attr; - - status = mq_getattr( mq, &attr ); - fatal_posix_service_status( status, 0, "mq_getattr valid return status"); - - if ( mq != Test_q[ DEFAULT_RW ].mq ){ - fatal_int_service_status((int)attr.mq_maxmsg, MAXMSG, "maxmsg attribute" ); - fatal_int_service_status((int)attr.mq_msgsize,MSGSIZE,"msgsize attribute"); - } - - fatal_int_service_status((int)attr.mq_curmsgs, msg_count, "count attribute" ); - fatal_int_service_status((int)attr.mq_flags, oflag, "flag attribute" ); -} - -char Queue_Name[PATH_MAX + 2]; -#define Get_Queue_Name( i ) Test_q[i].name - -char *Build_Queue_Name( int i ) { - sprintf(Queue_Name,"mq%d", i+1 ); - return Queue_Name; -} - -char *Get_Too_Long_Name() -{ - int i; - - for ( i=0; i< PATH_MAX+1; i++ ) - Queue_Name[i] = 'N'; - Queue_Name[i] = '\0'; - return Queue_Name; -} - - -void open_test_queues() -{ - struct mq_attr attr; - int status; - Test_queue_type *tq; - int que; - - attr.mq_maxmsg = MAXMSG; - attr.mq_msgsize = MSGSIZE; - - puts( "Init: Open Test Queues" ); - - for( que = 0; que < NUMBER_OF_TEST_QUEUES; que++ ) { - - tq = &Test_q[ que ]; - if ( que == DEFAULT_RW) - Test_q[que].mq = mq_open( tq->name, tq->oflag, 0x777, NULL ); - else - Test_q[que].mq = mq_open( tq->name, tq->oflag, 0x777, &attr ); - - assert( Test_q[que].mq != (-1) ); - } - - status = mq_close( Test_q[CLOSED].mq ); - fatal_posix_service_status( status, 0, "mq_close message queue"); - status = mq_unlink( CLOSED_NAME ); - fatal_posix_service_status( status, 0, "mq_unlink message queue"); -} - -/* - * Opens CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES then leaves size queues - * opened but closes the rest. - */ - -void validate_mq_open_error_codes() -{ - int i; - mqd_t n_mq2; - struct mq_attr attr; - int status; - mqd_t open_mq[CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES + 1]; - - attr.mq_maxmsg = MAXMSG; - attr.mq_msgsize = MSGSIZE; - - Start_Test( "mq_open errors" ); - - /* - * XXX EINVAL - inappropriate name was given for the message queue - */ - - /* - * EINVAL - Create with negative maxmsg. - */ - - 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_status( errno, EINVAL, "mq_open errno EINVAL"); - attr.mq_maxmsg = MAXMSG; - - /* - * EINVAL - Create withnegative msgsize. - */ - - 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_status( errno, EINVAL, "mq_open errno EINVAL"); - attr.mq_msgsize = MSGSIZE; - - /* - * ENOENT - Open a non-created file. - */ - - 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_status( errno, ENOENT, "mq_open errno ENOENT"); - - /* - * XXX EINTR - call was interrupted by a signal - */ - - /* - * ENAMETOOLONG - Give a name greater than PATH_MAX. - */ - - 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_status( errno, ENAMETOOLONG, "mq_open errno ENAMETOOLONG"); - - /* - * XXX - ENAMETOOLONG - Give a name greater than NAME_MAX - * Per implementation not possible. - */ - - /* - * EEXIST - Create an existing queue. - */ - - puts( "Init: mq_open - Create an Existing mq (EEXIST)" ); - open_mq[0] = mq_open( - Build_Queue_Name(0), O_CREAT | O_RDWR | O_NONBLOCK, 0x777, NULL ); - assert( open_mq[0] != (-1) ); - - 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_status( errno, EEXIST, "mq_open errno EEXIST"); - - status = mq_unlink( Build_Queue_Name(0) ); - fatal_posix_service_status( status, 0, "mq_unlink message queue"); - - status = mq_close( open_mq[0]); - fatal_posix_service_status( status, 0, "mq_close message queue"); - - /* - * Open maximum number of message queues - */ - - puts( "Init: mq_open - SUCCESSFUL" ); - for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES; i++) { - open_mq[i] = mq_open( - Build_Queue_Name(i), O_CREAT | O_RDWR | O_NONBLOCK, 0x777, NULL ); - assert( open_mq[i] != (-1) ); - assert( open_mq[i] ); - /*XXX - Isn't there a more general check */ -/* JRS printf( "mq_open 0x%x %s\n", open_mq[i], Build_Queue_Name(i) ); */ - } - - /* - * XXX EACCES - permission to create is denied. - */ - - /* - * XXX EACCES - queue exists permissions specified by o_flag are denied. - */ - - /* - * XXX EMFILE - Too many message queues in use by the process - */ - - /* - * ENFILE - Too many message queues open in the system - */ - - 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_status( errno, ENFILE, "mq_open errno ENFILE"); - - /* - * Unlink and Close all queues. - */ - - puts( "Init: mq_close and mq_unlink (mq3...mqn) - SUCCESSFUL" ); - for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES; i++) { - - status = mq_close( open_mq[i]); - fatal_posix_service_status( status, 0, "mq_close message queue"); - - status = mq_unlink( Build_Queue_Name(i) ); - if ( status == -1 ) - perror( "mq_unlink" ); - fatal_posix_service_status( status, 0, "mq_unlink message queue"); - /* JRS printf( "mq_close/mq_unlink 0x%x %s\n", open_mq[i], Build_Queue_Name(i) ); */ - } -} - -void validate_mq_unlink_error_codes() -{ - int status; - - Start_Test( "mq_unlink errors" ); - - /* - * XXX - EACCES Permission Denied - */ - - /* - * ENAMETOOLONG - Give a name greater than PATH_MAX. - */ - - puts( "Init: mq_unlink - mq_unlink with too long of a name (ENAMETOOLONG)" ); - status = mq_unlink( Get_Too_Long_Name() ); - fatal_posix_service_status( status, -1, "mq_unlink error return status"); - fatal_posix_service_status( errno, ENAMETOOLONG, "mq_unlink errno ENAMETOOLONG"); - - /* - * XXX - ENAMETOOLONG - Give a name greater than NAME_MAX - * Per implementation not possible. - */ - - /* - * ENOENT - Unlink an unopened queue - */ - - puts( "Init: mq_unlink - A Queue not opened (ENOENT)" ); - status = mq_unlink( CLOSED_NAME ); - fatal_posix_service_status( status, -1, "mq_unlink error return status"); - fatal_posix_service_status( errno, ENOENT, "mq_unlink errno ENOENT"); - - /* - * XXX - The following were not listed in the POSIX document as - * possible errors. Under other commands the EINVAL is - * given for these conditions. - */ - - /* - * EINVAL - Unlink a queue with no name - */ - - puts( "Init: mq_unlink (NULL) - EINVAL" ); - status = mq_unlink( NULL ); - fatal_posix_service_status( status, -1, "mq_unlink error return status"); - fatal_posix_service_status( errno, EINVAL, "mq_unlink errno value"); - - /* - * EINVAL - Unlink a queue with a null name - */ - - puts( "Init: mq_unlink (\"\") - EINVAL" ); - status = mq_unlink( "" ); - fatal_posix_service_status( status, -1, "mq_unlink error return status"); - fatal_posix_service_status( errno, EINVAL, "mq_unlink errno value"); -} - -void validate_mq_close_error_codes() -{ - int status; - - Start_Test( "mq_close errors" ); - - /* - * EBADF - Close a queue that is not open. - */ - - puts( "Init: mq_close - unopened queue (EBADF)" ); - status = mq_close( Test_q[CLOSED].mq ); - fatal_posix_service_status( status, -1, "mq_close error return status"); - fatal_posix_service_status( errno, EBADF, "mq_close errno EBADF"); -} - - -void validate_mq_getattr_error_codes() -{ - struct mq_attr attr; - int status; - - Start_Test( "mq_getattr errors" ); - - /* - * EBADF - Get the attributes from a closed queue. - */ - - puts( "Init: mq_getattr - unopened queue (EBADF)" ); - status = mq_getattr( Test_q[CLOSED].mq, &attr ); - fatal_posix_service_status( status, -1, "mq_close error return status"); - fatal_posix_service_status( errno, EBADF, "mq_close errno EBADF"); - - /* - * XXX - The following are not listed in the POSIX manual but - * may occur. - */ - - /* - * EINVAL - NULL attributes - */ - - puts( "Init: mq_getattr - NULL attributes (EINVAL)" ); - status = mq_getattr( Test_q[RW_QUEUE].mq, NULL ); - fatal_posix_service_status( status, -1, "mq_close error return status"); - fatal_posix_service_status( errno, EINVAL, "mq_close errno EINVAL"); - -} - - -void Send_msg_to_que( - int que, - int msg -) -{ - Test_Message_t *ptr = &Predefined_Msgs[msg]; - int status; - - status = mq_send( Test_q[que].mq, ptr->msg, ptr->size , ptr->priority ); - fatal_posix_service_status( status, 0, "mq_send valid return status"); - Test_q[que].count++; -} - -void Show_send_msg_to_que( - char *task_name, - int que, - int msg -) -{ - Test_Message_t *ptr = &Predefined_Msgs[msg]; - printf( "%s mq_send - to %s msg: %s priority %d\n", - task_name, Test_q[que].name, ptr->msg, ptr->priority); - Send_msg_to_que( que, msg ); -} - -void verify_queues_full( - char *task_name -) -{ - int que; - - /* - * Validate that the queues are full. - */ - - printf( "%s Verify Queues are full\n", task_name ); - for( que = RW_QUEUE; que < CLOSED; que++ ) - Validate_attributes( Test_q[que].mq, Test_q[que].oflag, Test_q[que].count ); - -} -void verify_queues_empty( - char *task_name -) -{ - int que; - - printf( "%s Verify Queues are empty\n", task_name ); - for( que = RW_QUEUE; que < CLOSED; que++ ) - Validate_attributes( Test_q[que].mq, Test_q[que].oflag, 0 ); -} - -int fill_message_queues( - char *task_name -) -{ - int msg; - int que; - - - verify_queues_empty( task_name ); - - /* - * Fill Queue with predefined messages. - */ - - printf( "%s Fill Queues with messages\n", task_name ); - for(msg=0; msgmsg ); - fatal_int_service_status( status, ptr->size, err_msg ); - - assert( !strcmp( message, ptr->msg ) ); - strcpy( message, "No Message" ); - - sprintf( err_msg,"%s msg %s size failure", Test_q[ que ].name, ptr->msg ); - fatal_int_service_status(priority, ptr->priority, err_msg ); -} - -int empty_message_queues( - char *task_name -) -{ - int que; - int i; - - printf( "%s Empty all Queues\n", task_name ); - for( que = RW_QUEUE; que < CLOSED; que++ ) { - for(i=0; Test_q[que].count != 0; i++ ) - Read_msg_from_que( que, Priority_Order[i] ); - - Validate_attributes( Test_q[ que].mq, Test_q[ que ].oflag, 0 ); - } - return 0; -} - -/* - * Returns the number of messages queued after the test on the - * first queue. - */ - -int validate_mq_send_error_codes( ) -{ - int status; - int i; - char *str; - - Start_Test( "mq_send errors" ); - - /* - * EBADF - Write to a closed queue. - */ - - puts( "Init: mq_send - Closed message queue (EBADF)" ); - status = mq_send( Test_q[CLOSED].mq, "", 1, 0 ); - fatal_posix_service_status( status, -1, "mq_send error return status"); - fatal_posix_service_status( errno, EBADF, "mq_send errno EBADF"); - - /* - * EBADF - Write to a read only queue. - */ - - puts( "Init: mq_send - Read only message queue (EBADF)" ); - status = mq_send( Test_q[ RD_QUEUE ].mq, "", 1, 0 ); - fatal_posix_service_status( status, -1, "mq_send error return status"); - fatal_posix_service_status( errno, EBADF, "mq_send errno EBADF"); - - /* - * XXX - EINTR Signal interrupted the call. - * - puts( "Init: mq_send - UNSUCCESSFUL (EINTR)" ); - status = mq_send( Test_q, "", 0xffff, 0 ); - fatal_posix_service_status( status, -1, "mq_send error return status"); - fatal_posix_service_status( errno, E, "mq_send errno E"); - */ - - /* - * EINVAL priority is out of range. - */ - - puts( "Init: mq_send - Priority out of range (EINVAL)" ); - status = mq_send( Test_q[ RW_QUEUE ].mq, "", 1, MQ_PRIO_MAX + 1 ); - fatal_posix_service_status( status, -1, "mq_send error return status"); - fatal_posix_service_status( errno, EINVAL, "mq_send errno EINVAL"); - - /* - * EMSGSIZE - Message size larger than msg_len - * Validates that msgsize is stored correctly. - */ - - puts( "Init: mq_send - Message longer than msg_len (EMSGSIZE)" ); - status = mq_send( Test_q[ RW_QUEUE ].mq, "", MSGSIZE+1, 0 ); - fatal_posix_service_status( status, -1, "mq_send error return status"); - fatal_posix_service_status( errno, EMSGSIZE, "mq_send errno EMSGSIZE"); - - i = fill_message_queues( "Init:" ); - - /* - * ENOSYS - send not supported - puts( "Init: mq_send - Blocking Queue overflow (ENOSYS)" ); - status = mq_send( n_mq1, Predefined_Msgs[i], 0, 0 ); - fatal_posix_service_status( status, -1, "mq_send error return status"); - fatal_posix_service_status( errno, EBADF, "mq_send errno EBADF"); - - status = mq_close( n_mq1 ); - fatal_posix_service_status( status, 0, "mq_close message queue"); - - status = mq_unlink( "read_only" ); - fatal_posix_service_status( status, 0, "mq_unlink message queue"); - */ - - /* - * EAGAIN - O_NONBLOCK and message queue is full. - */ - - puts( "Init: mq_send - on a FULL non-blocking queue with (EAGAIN)" ); - str = Predefined_Msgs[i].msg; - status = mq_send(Test_q[RW_QUEUE].mq, str, 0, 0 ); - fatal_posix_service_status( status, -1, "mq_send error return status"); - fatal_posix_service_status( errno, EAGAIN, "mq_send errno EAGAIN"); - - return i-1; -} - -void validate_mq_receive_error_codes( ) -{ - int status; - char message[100]; - unsigned int priority; - - Start_Test( "mq_receive errors" ); - - /* - * EBADF - Not A Valid Message Queue - */ - - puts( "Init: mq_receive - Unopened message queue (EBADF)" ); - status = mq_receive( Test_q[CLOSED].mq, message, 100, &priority ); - fatal_posix_service_status( status, -1, "mq_ error return status"); - fatal_posix_service_status( errno, EBADF, "mq_receive errno EBADF"); - - /* - * EBADF - Queue not opened to read - */ - - puts( "Init: mq_receive - Write only queue (EBADF)" ); - status = mq_receive( Test_q[WR_QUEUE].mq, message, 100, &priority ); - fatal_posix_service_status( status, -1, "mq_ error return status"); - fatal_posix_service_status( errno, EBADF, "mq_receive errno EBADF"); - - /* - * EMSGSIZE - Size is less than the message size attribute - */ - - puts( "Init: mq_receive - Size is less than the message (EMSGSIZE)" ); - status = mq_receive( - Test_q[RW_QUEUE].mq, message, Predefined_Msgs[0].size-1, &priority ); - fatal_posix_service_status( status, -1, "mq_ error return status"); - fatal_posix_service_status( errno, EMSGSIZE, "mq_receive errno EMSGSIZE"); - - - /* - * EAGAIN - O_NONBLOCK and Queue is empty - */ - verify_queues_full( "Init:" ); - empty_message_queues( "Init:" ); - - puts( "Init: mq_receive - Queue is empty (EAGAIN)" ); - status = mq_receive( Test_q[RW_QUEUE].mq, message, 100, &priority ); - fatal_posix_service_status( status, -1, "mq_ error return status"); - fatal_posix_service_status( errno, EAGAIN, "mq_receive errno EAGAIN"); - - /* - * XXX - EINTR - Interrupted by a signal - */ - - /* - * XXX - EBADMSG - a data corruption problem. - */ - - /* - * XXX - ENOSYS - mq_receive not supported - */ -} - -void verify_open_functionality() -{ -#if 0 - mqd_t n_mq; -#endif - - Start_Test( "mq_open functionality" ); - - /* - * Validate a second open returns the same message queue. - */ - -#if 0 - 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" ); -#endif -} - -void verify_unlink_functionality() -{ - mqd_t n_mq; - int status; - - Start_Test( "mq_unlink functionality" ); - - /* - * Unlink the message queue, then verify an open of the same name produces a - * different message queue. - */ - - puts( "Init: Unlink and Open without closing SUCCESSFUL" ); - status = mq_unlink( DEFAULT_NAME ); - fatal_posix_service_status( status, 0, "mq_unlink locked message queue"); - - n_mq = mq_open( DEFAULT_NAME, DEFAULT_ATTR, 0x777, NULL ); - assert( n_mq != (-1) ); - assert( n_mq != Test_q[ DEFAULT_RW ].mq ); - - - status = mq_unlink( DEFAULT_NAME ); - fatal_posix_service_status( status, 0, "mq_unlink locked message queue"); - status = mq_close( Test_q[ DEFAULT_RW ].mq ); - fatal_posix_service_status( status, 0, "mq_close message queue"); - - Test_q[ DEFAULT_RW ].mq = n_mq; -} - -void verify_close_functionality() -{ - int i; - int status; - Start_Test( "Unlink and Close All Files" ); - for (i=0; imsg, ptr->size , ptr->priority ); - fatal_posix_service_status( status, -1, "mq_send error return status"); - fatal_posix_service_status( errno, EBADF, "mq_send errno EBADF"); - -} - -void validate_mq_setattr() -{ - struct mq_attr attr; - struct mq_attr save_attr[ NUMBER_OF_TEST_QUEUES ]; - int status; - int i; - - /* - * EBADF - Get the attributes from a closed queue. - */ - - puts( "Task1:mq_setattr - unopened queue (EBADF)" ); - status = mq_setattr( Test_q[CLOSED].mq, &attr, NULL ); - fatal_posix_service_status( status, -1, "mq_setattr error return status"); - fatal_posix_service_status( errno, EBADF, "mq_setattr errno EBADF"); - - /* - * XXX - The following are not listed in the POSIX manual but - * may occur. - */ - - /* - * EINVAL - NULL attributes - */ - - puts( "Task1:mq_setattr - NULL attributes (EINVAL)" ); - status = mq_setattr( Test_q[RW_QUEUE].mq, NULL, NULL ); - fatal_posix_service_status( status, -1, "mq_setattr error return status"); - fatal_posix_service_status( errno, EINVAL, "mq_setattr errno EINVAL"); - - /* - * Verify change queues to blocking, by verifying all queues block - * for a timed receive. - */ - - puts( "Init: set_attr all queues to blocking" ); - for(i=0; i -#include -#include -#include -#include - -void *POSIX_Init( - void *argument -); - -void *Task_1_through_3( - void *argument -); - -/* configuration information */ - -#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER -#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER - -#define CONFIGURE_POSIX_INIT_THREAD_TABLE - -#define CONFIGURE_MAXIMUM_POSIX_THREADS 5 -#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 10 -#define CONFIGURE_MAXIMUM_POSIX_TIMERS 4 -#define CONFIGURE_MAXIMUM_TIMERS 4 - -#define CONFIGURE_POSIX_INIT_THREAD_TABLE -#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \ - (RTEMS_MINIMUM_STACK_SIZE * 10) - -#include - -/* global variables */ - -TEST_EXTERN pthread_t Init_id; -TEST_EXTERN pthread_t Task_id; - -#define MSGSIZE 9 -#define MAXMSG 4 - -typedef enum { - RD_QUEUE, /* Read only queue */ - WR_QUEUE, /* Write only queue */ - RW_QUEUE, /* Read Write non-blocking queue */ - BLOCKING, /* Read Write blocking queue */ - DEFAULT_RW, /* default must be last */ - CLOSED, /* Created and closed queue */ - NUMBER_OF_TEST_QUEUES -} Test_Queue_Types; -extern int Priority_Order[MAXMSG+1]; -void *Task_1 ( void *argument ); -void *Task_2( void *argument ); -void *Task_3( void *argument ); -void *Task_4( void *argument ); - -/* end of include file */ - - -- cgit v1.2.3