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.
This commit is contained in:
Jennifer Averett
2008-02-04 19:39:43 +00:00
parent 6d4940d508
commit f8d39b8dcd
14 changed files with 375 additions and 17 deletions

View File

@@ -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,

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 */
}

View File

@@ -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 ***

View File

@@ -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 */

View File

@@ -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 */
}

View File

@@ -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

View File

@@ -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 ) {
static char Queue_Name[PATH_MAX + 2];
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;

View File

@@ -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

View File

@@ -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 */
}

View File

@@ -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 ***

View File

@@ -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 */