summaryrefslogtreecommitdiffstats
path: root/testsuites
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
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')
-rw-r--r--testsuites/psxtests/ChangeLog9
-rw-r--r--testsuites/psxtests/Makefile.am7
-rw-r--r--testsuites/psxtests/configure.ac2
-rw-r--r--testsuites/psxtests/psxkey01/Makefile.am30
-rw-r--r--testsuites/psxtests/psxkey01/init.c60
-rw-r--r--testsuites/psxtests/psxkey01/psxkey01.scn5
-rw-r--r--testsuites/psxtests/psxkey01/system.h55
-rw-r--r--testsuites/psxtests/psxkey01/task.c52
-rw-r--r--testsuites/psxtests/psxmsgq01/Makefile.am4
-rw-r--r--testsuites/psxtests/psxmsgq01/init.c15
-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
14 files changed, 374 insertions, 16 deletions
diff --git a/testsuites/psxtests/ChangeLog b/testsuites/psxtests/ChangeLog
index 3895579f4f..7a0e676760 100644
--- a/testsuites/psxtests/ChangeLog
+++ b/testsuites/psxtests/ChangeLog
@@ -1,3 +1,12 @@
+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.
+
2008-01-31 Joel Sherrill <joel.sherrill@OARcorp.com>
* include/pmacros.h, psx01/init.c, psx01/system.h, psx13/main.c,
diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index a93214a231..bfcc089328 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -5,9 +5,10 @@
ACLOCAL_AMFLAGS = -I ../aclocal
SUBDIRS = psxhdrs psx01 psx02 psx03 psx04 psx05 psx06 psx07 psx08 psx09 \
- psx10 psx11 psx12 psx13 psx14 psxcleanup psxtime psxtimer01 psxtimer02 \
- psxcancel psxbarrier01 psxmsgq01 psxrwlock01 psxsem01 psxspin01 \
- psxenosys psxsignal01 psxsysconf psxualarm psxfatal01 psxfatal02
+ psx10 psx11 psx12 psx13 psx14 psxcleanup psxtime psxtimer01 psxtimer02 \
+ psxcancel psxbarrier01 psxmsgq01 psxmsgq02 psxrwlock01 psxsem01 \
+ psxspin01 psxenosys psxsignal01 psxsysconf psxualarm psxkey01 \
+ psxfatal01 psxfatal02
## File IO tests
SUBDIRS += psxfile01 psxreaddir psxstat psxmount psx13 psxchroot01
diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/configure.ac
index aa3cc8c45e..35dc04e7bb 100644
--- a/testsuites/psxtests/configure.ac
+++ b/testsuites/psxtests/configure.ac
@@ -50,8 +50,10 @@ psxfatal01/Makefile
psxfatal02/Makefile
psxfile01/Makefile
psxhdrs/Makefile
+psxkey01/Makefile
psxmount/Makefile
psxmsgq01/Makefile
+psxmsgq02/Makefile
psxreaddir/Makefile
psxrdwrv/Makefile
psxrwlock01/Makefile
diff --git a/testsuites/psxtests/psxkey01/Makefile.am b/testsuites/psxtests/psxkey01/Makefile.am
new file mode 100644
index 0000000000..6abd282e29
--- /dev/null
+++ b/testsuites/psxtests/psxkey01/Makefile.am
@@ -0,0 +1,30 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = psxkey01.exe
+psxkey01_exe_SOURCES = init.c task.c system.h ../include/pmacros.h \
+ ../../support/src/test_support.c
+
+
+dist_rtems_tests_DATA = psxkey01.scn
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+psxkey01_exe_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
+
+AM_CPPFLAGS += -I$(top_srcdir)/include
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(psxkey01_exe_OBJECTS) $(psxkey01_exe_LDADD)
+LINK_LIBS = $(psxkey01_exe_LDLIBS)
+
+psxkey01.exe$(EXEEXT): $(psxkey01_exe_OBJECTS) $(psxkey01_exe_DEPENDENCIES)
+ @rm -f psxkey01.exe$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/psxtests/psxkey01/init.c b/testsuites/psxtests/psxkey01/init.c
new file mode 100644
index 0000000000..278e4b6029
--- /dev/null
+++ b/testsuites/psxtests/psxkey01/init.c
@@ -0,0 +1,60 @@
+/*
+ * 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>
+
+
+void Key_destructor(
+ void *key_data
+)
+{
+}
+
+
+void *POSIX_Init(
+ void *argument
+)
+{
+ int status;
+ unsigned int remaining;
+ uint32_t *key_data;
+ Heap_Information_block info;
+ void *temp;
+ int i;
+
+ puts( "\n\n*** POSIX KEY 01 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(84);
+
+ puts("Init: pthread_key_create - ENOMEM (Workspace not available)");
+ empty_line();
+ status = pthread_key_create( &Key_id[0], Key_destructor );
+ fatal_directive_check_status_only( status, ENOMEM, "no workspace available" );
+
+ puts( "*** END OF POSIX KEY 01 TEST ***" );
+ rtems_test_exit( 0 );
+
+ return NULL; /* just so the compiler thinks we returned something */
+}
diff --git a/testsuites/psxtests/psxkey01/psxkey01.scn b/testsuites/psxtests/psxkey01/psxkey01.scn
new file mode 100644
index 0000000000..597b0f8e23
--- /dev/null
+++ b/testsuites/psxtests/psxkey01/psxkey01.scn
@@ -0,0 +1,5 @@
+*** POSIX KEY 01 TEST ***
+Init's ID is 0x0b010001
+Allocate_majority_of_workspace:
+Init: pthread_key_create - ENOMEM (Workspace not available)
+*** END OF POSIX KEY 01 TEST ***
diff --git a/testsuites/psxtests/psxkey01/system.h b/testsuites/psxtests/psxkey01/system.h
new file mode 100644
index 0000000000..280e4a71a0
--- /dev/null
+++ b/testsuites/psxtests/psxkey01/system.h
@@ -0,0 +1,55 @@
+/* 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>
+
+void *POSIX_Init(
+ void *argument
+);
+
+void *Task_1(
+ void *argument
+);
+
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 21
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 21
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#include <rtems/confdefs.h>
+
+/* global variables */
+
+#ifdef CONFIGURE_INIT
+#define TEST_EXTERN
+#else
+#define TEST_EXTERN extern
+#endif
+
+TEST_EXTERN pthread_t Init_id;
+TEST_EXTERN pthread_t Task_id[CONFIGURE_MAXIMUM_POSIX_THREADS-1];
+TEST_EXTERN pthread_key_t Key_id[CONFIGURE_MAXIMUM_POSIX_KEYS-1];
+TEST_EXTERN uint32_t Data_array[ CONFIGURE_MAXIMUM_POSIX_THREADS ];
+
+#undef TEST_EXTERN
+/* end of include file */
diff --git a/testsuites/psxtests/psxkey01/task.c b/testsuites/psxtests/psxkey01/task.c
new file mode 100644
index 0000000000..13ac9b2f85
--- /dev/null
+++ b/testsuites/psxtests/psxkey01/task.c
@@ -0,0 +1,52 @@
+/* Task_1
+ *
+ * This routine serves as a test task. It verifies the basic task
+ * switching capabilities of the executive.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * 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$
+ */
+
+#include "system.h"
+#include <errno.h>
+
+void *Task_1(
+ void *arg
+)
+{
+ pthread_t id = *(pthread_t *) arg;
+ int status;
+ uint32_t *key_data;
+
+ printf( "Thread 0x%08x\n", id );
+ printf( "Task_1: Setting the key to %d\n", 1 );
+ status = pthread_setspecific( Key_id, &Data_array[ 1 ] );
+ if ( status )
+ printf( "status = %d\n", status );
+ assert( !status );
+
+ key_data = pthread_getspecific( Key_id );
+ printf( "Task_1: Got the key value of %ld\n",
+ (unsigned long) ((uint32_t *)key_data - Data_array) );
+ if ( status )
+ printf( "status = %d\n", status );
+ assert( !status );
+
+ puts( "Task_1: exitting" );
+ pthread_exit( NULL );
+
+ /* switch to task 2 */
+
+ return NULL; /* just so the compiler thinks we returned something */
+}
diff --git a/testsuites/psxtests/psxmsgq01/Makefile.am b/testsuites/psxtests/psxmsgq01/Makefile.am
index ed0a004974..384c56a469 100644
--- a/testsuites/psxtests/psxmsgq01/Makefile.am
+++ b/testsuites/psxtests/psxmsgq01/Makefile.am
@@ -5,7 +5,9 @@
MANAGERS = all
rtems_tests_PROGRAMS = psxmsgq01.exe
-psxmsgq01_exe_SOURCES = init.c system.h ../include/pmacros.h
+psxmsgq01_exe_SOURCES = init.c system.h ../include/pmacros.h \
+ ../../support/src/test_support.c
+
dist_rtems_tests_DATA = psxmsgq01.scn
diff --git a/testsuites/psxtests/psxmsgq01/init.c b/testsuites/psxtests/psxmsgq01/init.c
index 8922173018..f96494f588 100644
--- a/testsuites/psxtests/psxmsgq01/init.c
+++ b/testsuites/psxtests/psxmsgq01/init.c
@@ -16,6 +16,7 @@
#include <time.h>
#include <tmacros.h>
#include <signal.h> /* signal facilities */
+#include "test_support.h"
typedef struct {
char msg[ 50 ];
@@ -100,25 +101,15 @@ void Validate_attributes(
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;
+ static char Queue_Name[PATH_MAX + 2];
- for ( i=0; i< PATH_MAX+1; i++ )
- Queue_Name[i] = 'N';
- Queue_Name[i] = '\0';
+ sprintf(Queue_Name,"mq%d", i+1 );
return Queue_Name;
}
-
void open_test_queues()
{
struct mq_attr attr;
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 */