summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psxmsgq02
diff options
context:
space:
mode:
authorJennifer Averett <Jennifer.Averett@OARcorp.com>2008-02-04 19:39:43 +0000
committerJennifer Averett <Jennifer.Averett@OARcorp.com>2008-02-04 19:39:43 +0000
commitf8d39b8dcd3cec1893ff9edd216eddff08f9b752 (patch)
tree32a540afb484b4bb471a60ea2a52be3ad76282f6 /testsuites/psxtests/psxmsgq02
parent2008-02-04 Jennifer Averett <jennifer.averett@OARcorp.com> (diff)
downloadrtems-f8d39b8dcd3cec1893ff9edd216eddff08f9b752.tar.bz2
2008-02-04 Jennifer Averett <jennifer.averett@OARcorp.com>
* Makefile.am, configure.ac, psxmsgq01/Makefile.am, psxmsgq01/init.c: Added tests for failure path coverages. Consolidated methods used in multiple places into support routines. * psxkey01/Makefile.am, psxkey01/init.c, psxkey01/psxkey01.scn, psxkey01/system.h, psxkey01/task.c, psxmsgq02/Makefile.am, psxmsgq02/init.c, psxmsgq02/psxmsgq02.scn, psxmsgq02/system.h: New files.
Diffstat (limited to 'testsuites/psxtests/psxmsgq02')
-rw-r--r--testsuites/psxtests/psxmsgq02/Makefile.am29
-rw-r--r--testsuites/psxtests/psxmsgq02/init.c65
-rw-r--r--testsuites/psxtests/psxmsgq02/psxmsgq02.scn5
-rw-r--r--testsuites/psxtests/psxmsgq02/system.h52
4 files changed, 151 insertions, 0 deletions
diff --git a/testsuites/psxtests/psxmsgq02/Makefile.am b/testsuites/psxtests/psxmsgq02/Makefile.am
new file mode 100644
index 0000000000..61afdb8418
--- /dev/null
+++ b/testsuites/psxtests/psxmsgq02/Makefile.am
@@ -0,0 +1,29 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = psxmsgq02.exe
+psxmsgq02_exe_SOURCES = init.c system.h ../include/pmacros.h \
+ ../../support/src/test_support.c
+
+dist_rtems_tests_DATA = psxmsgq02.scn
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+psxmsgq02_exe_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
+
+AM_CPPFLAGS += -I$(top_srcdir)/include
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(psxmsgq02_exe_OBJECTS) $(psxmsgq02_exe_LDADD)
+LINK_LIBS = $(psxmsgq02_exe_LDLIBS)
+
+psxmsgq02.exe$(EXEEXT): $(psxmsgq02_exe_OBJECTS) $(psxmsgq02_exe_DEPENDENCIES)
+ @rm -f psxmsgq02.exe$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/psxtests/psxmsgq02/init.c b/testsuites/psxtests/psxmsgq02/init.c
new file mode 100644
index 0000000000..b82b81aa05
--- /dev/null
+++ b/testsuites/psxtests/psxmsgq02/init.c
@@ -0,0 +1,65 @@
+/*
+ * 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 <errno.h>
+#include "tmacros.h"
+#include <rtems/score/wkspace.h>
+#include <rtems/score/heap.h>
+#include <mqueue.h>
+#include <sched.h>
+#include <fcntl.h>
+#include <time.h>
+#include <tmacros.h>
+#include <signal.h> /* signal facilities */
+#include "test_support.h"
+
+pthread_t Init_id;
+
+void *POSIX_Init(
+ void *argument
+)
+{
+ int status;
+ unsigned int remaining;
+ struct mq_attr attr;
+ int que;
+ Heap_Information_block info;
+ void *temp;
+ mqd_t mq;
+ int i;
+
+ puts( "\n\n*** POSIX MESSAGE QUEUE 02 TEST ***" );
+
+
+ /* set the time of day, and print our buffer in multiple ways */
+
+ set_time( TM_FRIDAY, TM_MAY, 24, 96, 11, 5, 0 );
+
+ /* get id of this thread */
+
+ Init_id = pthread_self();
+ printf( "Init's ID is 0x%08x\n", Init_id );
+
+ Allocate_majority_of_workspace(NAME_MAX);
+
+ attr.mq_maxmsg = MAXMSG;
+ attr.mq_msgsize = MSGSIZE;
+ puts("Init: ENOMEM (Workspace not available)");
+ mq = mq_open( Get_Longest_Name(), O_WRONLY, 0x777, &attr );
+ fatal_posix_service_status_errno( mq, ENOMEM, "no workspace available" );
+
+ puts( "*** END POSIX MESSAGE QUEUE 02 TEST ***" );
+ rtems_test_exit( 0 );
+
+ return NULL; /* just so the compiler thinks we returned something */
+}
diff --git a/testsuites/psxtests/psxmsgq02/psxmsgq02.scn b/testsuites/psxtests/psxmsgq02/psxmsgq02.scn
new file mode 100644
index 0000000000..a7874927b6
--- /dev/null
+++ b/testsuites/psxtests/psxmsgq02/psxmsgq02.scn
@@ -0,0 +1,5 @@
+*** POSIX MESSAGE QUEUE 02 TEST ***
+Init's ID is 0x0b010001
+Allocate_majority_of_workspace:
+Init: ENOMEM (Workspace not available)
+*** END POSIX MESSAGE QUEUE 02 TEST ***
diff --git a/testsuites/psxtests/psxmsgq02/system.h b/testsuites/psxtests/psxmsgq02/system.h
new file mode 100644
index 0000000000..0dea2afae3
--- /dev/null
+++ b/testsuites/psxtests/psxmsgq02/system.h
@@ -0,0 +1,52 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * 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$
+ */
+
+/* functions */
+
+#include <pmacros.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sched.h>
+#include <tmacros.h>
+
+void *POSIX_Init(
+ 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_POSIX_INIT_THREAD_TABLE
+#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
+ (RTEMS_MINIMUM_STACK_SIZE * 10)
+
+#include <rtems/confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN pthread_t Init_id;
+TEST_EXTERN pthread_t Task_id;
+
+#define MSGSIZE 9
+#define MAXMSG 4
+
+/* end of include file */