diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-06-20 19:48:03 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-06-20 19:48:03 +0000 |
commit | aff1ea5a3a2202c5395c53623bcb32040cb749f5 (patch) | |
tree | 1e693f4084e72e32d87fa7af6627134dd27baba7 /testsuites/sptests | |
parent | 2010-06-20 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-aff1ea5a3a2202c5395c53623bcb32040cb749f5.tar.bz2 |
2010-06-20 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac: New test for error cases in FIFO creation.
* spfifo08/.cvsignore, spfifo08/Makefile.am, spfifo08/init.c,
spfifo08/spfifo08.doc, spfifo08/spfifo08.scn: New files.
Diffstat (limited to 'testsuites/sptests')
-rw-r--r-- | testsuites/sptests/ChangeLog | 6 | ||||
-rw-r--r-- | testsuites/sptests/Makefile.am | 2 | ||||
-rw-r--r-- | testsuites/sptests/configure.ac | 1 | ||||
-rw-r--r-- | testsuites/sptests/spfifo08/.cvsignore | 2 | ||||
-rw-r--r-- | testsuites/sptests/spfifo08/Makefile.am | 26 | ||||
-rw-r--r-- | testsuites/sptests/spfifo08/init.c | 165 | ||||
-rw-r--r-- | testsuites/sptests/spfifo08/spfifo08.doc | 24 | ||||
-rw-r--r-- | testsuites/sptests/spfifo08/spfifo08.scn | 1 |
8 files changed, 226 insertions, 1 deletions
diff --git a/testsuites/sptests/ChangeLog b/testsuites/sptests/ChangeLog index 0f5c412d6c..27aa14bfc2 100644 --- a/testsuites/sptests/ChangeLog +++ b/testsuites/sptests/ChangeLog @@ -1,3 +1,9 @@ +2010-06-20 Joel Sherrill <joel.sherrill@oarcorp.com> + + * Makefile.am, configure.ac: New test for error cases in FIFO creation. + * spfifo08/.cvsignore, spfifo08/Makefile.am, spfifo08/init.c, + spfifo08/spfifo08.doc, spfifo08/spfifo08.scn: New files. + 2010-06-19 Joel Sherrill <joel.sherrill@oarcorp.com> * sp09/screen01.c, sp09/sp09.scn, sp43/init.c, sp43/sp43.scn, diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am index 6bdc001258..91a4c8b8a7 100644 --- a/testsuites/sptests/Makefile.am +++ b/testsuites/sptests/Makefile.am @@ -19,7 +19,7 @@ SUBDIRS = \ spstkalloc spthreadq01 spwatchdog spwkspace \ spfatal01 spfatal02 spfatal03 spfatal04 spfatal05 spfatal06 spfatal07 \ spfatal08 spfatal09 spfatal10 spfatal11 spfatal12 spfatal13 \ - spfifo01 spfifo02 spfifo03 spfifo04 \ + spfifo01 spfifo02 spfifo03 spfifo04 spfifo08 \ spintrcritical01 spintrcritical02 spintrcritical03 spintrcritical04 \ spintrcritical05 spintrcritical06 spintrcritical07 spintrcritical08 \ spintrcritical09 spintrcritical10 spintrcritical11 spintrcritical12 \ diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac index f64ddb5f30..3164868edd 100644 --- a/testsuites/sptests/configure.ac +++ b/testsuites/sptests/configure.ac @@ -116,6 +116,7 @@ spfifo01/Makefile spfifo02/Makefile spfifo03/Makefile spfifo04/Makefile +spfifo08/Makefile spintrcritical01/Makefile spintrcritical02/Makefile spintrcritical03/Makefile diff --git a/testsuites/sptests/spfifo08/.cvsignore b/testsuites/sptests/spfifo08/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/sptests/spfifo08/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/sptests/spfifo08/Makefile.am b/testsuites/sptests/spfifo08/Makefile.am new file mode 100644 index 0000000000..e1d03bb7eb --- /dev/null +++ b/testsuites/sptests/spfifo08/Makefile.am @@ -0,0 +1,26 @@ +## +## $Id$ +## + +MANAGERS = all + +rtems_tests_PROGRAMS = spfifo08 +spfifo08_SOURCES = init.c ../../support/src/spin.c + +dist_rtems_tests_DATA = spfifo08.scn +dist_rtems_tests_DATA += spfifo08.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(spfifo08_OBJECTS) $(spfifo08_LDADD) +LINK_LIBS = $(spfifo08_LDLIBS) + +spfifo08$(EXEEXT): $(spfifo08_OBJECTS) $(spfifo08_DEPENDENCIES) + @rm -f spfifo08$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/spfifo08/init.c b/testsuites/sptests/spfifo08/init.c new file mode 100644 index 0000000000..a30cb8ca5d --- /dev/null +++ b/testsuites/sptests/spfifo08/init.c @@ -0,0 +1,165 @@ +/* + * COPYRIGHT (c) 1989-2010. + * 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 <tmacros.h> +#include "test_support.h" + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <errno.h> + +#define MAXIMUM 10 +rtems_id Barriers[MAXIMUM]; +int BarrierCount; + +rtems_id Semaphores[MAXIMUM]; +int SemaphoreCount; + +void create_all_barriers(void) +{ + rtems_status_code status; + int i; + + BarrierCount = 0; + + for ( i=0 ; i<MAXIMUM ; i++ ) { + status = rtems_barrier_create( + rtems_build_name( 'B', 'A', 'R', 0x30+i ), + RTEMS_BARRIER_MANUAL_RELEASE, + 0, + &Barriers[i] + ); + if ( status == RTEMS_TOO_MANY ) { + printf( "%d Barriers created\n", BarrierCount ); + return; + } + + directive_failed( status, "barrier create" ); + BarrierCount++; + } +} + +void create_all_semaphores(void) +{ + rtems_status_code status; + int i; + + SemaphoreCount = 0; + + for ( i=0 ; i<MAXIMUM ; i++ ) { + status = rtems_semaphore_create( + rtems_build_name( 'S', 'E', 'M', 0x30+i ), + 0, + RTEMS_DEFAULT_ATTRIBUTES, + 0, + &Semaphores[i] + ); + if ( status == RTEMS_TOO_MANY ) { + printf( "%d Semaphores created\n", SemaphoreCount ); + return; + } + + directive_failed( status, "semaphore create" ); + SemaphoreCount++; + } +} + +void delete_barrier(void) +{ + rtems_status_code status; + + puts( "Deleting a barrier" ); + status = rtems_barrier_delete( Barriers[BarrierCount] ); + directive_failed( status, "barrier delete" ); +} + +void delete_semaphore(void) +{ + rtems_status_code status; + + puts( "Deleting a semaphore" ); + status = rtems_semaphore_delete( Semaphores[SemaphoreCount] ); + directive_failed( status, "semaphore delete" ); +} + +void create_fifo(void) +{ + int status; + + status = mkfifo("/fifo01", 0777); + rtems_test_assert(status == 0); +} + +void open_fifo(int expected) +{ + int fd; + + fd = open("/fifo01", O_RDONLY); + printf( "status=%d errno=%d/(%s)\n", fd, errno, strerror(errno) ); + if ( expected ) { + rtems_test_assert(fd == -1); + rtems_test_assert(errno == expected); + } else { + rtems_test_assert(fd != -1); + close( fd ); + } +} + +rtems_task Init( + rtems_task_argument argument +) +{ + puts( "\n\n*** TEST FIFO 08 ***" ); + + puts( "Creating all barriers" ); + create_all_barriers(); + + puts( "Creating all semaphores" ); + create_all_semaphores(); + + puts( "Creating FIFO" ); + create_fifo(); + + puts( "Opening FIFO.. expect ENOMEM (barrier - case 1)" ); + open_fifo(ENOMEM); + + delete_barrier(); + puts( "Opening FIFO.. expect ENOMEM (barrier - case 2)" ); + open_fifo(ENOMEM); + + delete_barrier(); + puts( "Opening FIFO.. expect ENOMEM (semaphore - case 1)" ); + + open_fifo(0); + + puts( "*** END OF TEST FIFO 08 ***" ); + + rtems_test_exit(0); +} + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM +#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 5 +#define CONFIGURE_FIFOS_ENABLED +#define CONFIGURE_MAXIMUM_FIFOS 1 + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> +/* end of file */ diff --git a/testsuites/sptests/spfifo08/spfifo08.doc b/testsuites/sptests/spfifo08/spfifo08.doc new file mode 100644 index 0000000000..06ae9b9d43 --- /dev/null +++ b/testsuites/sptests/spfifo08/spfifo08.doc @@ -0,0 +1,24 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989-2010. +# 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. +# + +This file describes the directives and concepts tested by this test set. + +test set name: spfifo08 + +directives: + + mkfifo() + open() - on FIFOs + +concepts: + ++ memory allocation error cases ++ resource allocation error cases diff --git a/testsuites/sptests/spfifo08/spfifo08.scn b/testsuites/sptests/spfifo08/spfifo08.scn new file mode 100644 index 0000000000..a63612096b --- /dev/null +++ b/testsuites/sptests/spfifo08/spfifo08.scn @@ -0,0 +1 @@ +XXX fill in with test output |