From 287febb50397f321d5a38f8d7df668833c192125 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 24 Jun 2010 19:46:40 +0000 Subject: 2010-06-24 Bharath Suri * Makefile.am, configure.ac: Removed some fifo tests. * spfifo01/Makefile.am, spfifo01/init.c: Minor changes to avoid excessive new lines in the output. spfifo02/Makefile.am, spfifo02/init.c, spfifo02/spfifo02.doc, spfifo02/spfifo02.scn, spfifo03/Makefile.am: Merge from spfifo08. Also added a few more cases, mostly from spfifo04/init.c. * spfifo03/init.c, spfifo03/spfifo03.doc, spfifo03/spfifo03.scn: Previously was spfifo06. Configure parameter for pipes is used now. * spfifo04/.cvsignore, spfifo04/Makefile.am, spfifo04/init.c, spfifo04/spfifo04.doc, spfifo04/spfifo04.scn, spfifo08/.cvsignore, spfifo08/Makefile.am, spfifo08/init.c, spfifo08/spfifo08.doc, spfifo08/spfifo08.scn: Removed. --- testsuites/sptests/ChangeLog | 16 +++ testsuites/sptests/Makefile.am | 2 +- testsuites/sptests/configure.ac | 2 - testsuites/sptests/spfifo01/Makefile.am | 1 - testsuites/sptests/spfifo01/init.c | 2 +- testsuites/sptests/spfifo02/Makefile.am | 5 +- testsuites/sptests/spfifo02/init.c | 222 ++++++++++++++++++++++++------- testsuites/sptests/spfifo02/spfifo02.doc | 18 +-- testsuites/sptests/spfifo02/spfifo02.scn | 32 +---- testsuites/sptests/spfifo03/Makefile.am | 1 - testsuites/sptests/spfifo03/init.c | 196 ++++++++++++++++++++++----- testsuites/sptests/spfifo03/spfifo03.doc | 18 ++- testsuites/sptests/spfifo03/spfifo03.scn | 35 +++-- testsuites/sptests/spfifo04/.cvsignore | 2 - testsuites/sptests/spfifo04/Makefile.am | 26 ---- testsuites/sptests/spfifo04/init.c | 133 ------------------ testsuites/sptests/spfifo04/spfifo04.doc | 51 ------- testsuites/sptests/spfifo04/spfifo04.scn | 50 ------- testsuites/sptests/spfifo08/.cvsignore | 2 - testsuites/sptests/spfifo08/Makefile.am | 26 ---- testsuites/sptests/spfifo08/init.c | 182 ------------------------- testsuites/sptests/spfifo08/spfifo08.doc | 24 ---- testsuites/sptests/spfifo08/spfifo08.scn | 1 - 23 files changed, 403 insertions(+), 644 deletions(-) delete mode 100644 testsuites/sptests/spfifo04/.cvsignore delete mode 100644 testsuites/sptests/spfifo04/Makefile.am delete mode 100644 testsuites/sptests/spfifo04/init.c delete mode 100644 testsuites/sptests/spfifo04/spfifo04.doc delete mode 100644 testsuites/sptests/spfifo04/spfifo04.scn delete mode 100644 testsuites/sptests/spfifo08/.cvsignore delete mode 100644 testsuites/sptests/spfifo08/Makefile.am delete mode 100644 testsuites/sptests/spfifo08/init.c delete mode 100644 testsuites/sptests/spfifo08/spfifo08.doc delete mode 100644 testsuites/sptests/spfifo08/spfifo08.scn (limited to 'testsuites') diff --git a/testsuites/sptests/ChangeLog b/testsuites/sptests/ChangeLog index 756d303c51..ff494c48a2 100644 --- a/testsuites/sptests/ChangeLog +++ b/testsuites/sptests/ChangeLog @@ -1,3 +1,19 @@ +2010-06-24 Bharath Suri + + * Makefile.am, configure.ac: Removed some fifo tests. + * spfifo01/Makefile.am, spfifo01/init.c: Minor changes to avoid + excessive new lines in the output. + + spfifo02/Makefile.am, spfifo02/init.c, spfifo02/spfifo02.doc, + spfifo02/spfifo02.scn, spfifo03/Makefile.am: Merge from spfifo08. + Also added a few more cases, mostly from spfifo04/init.c. + * spfifo03/init.c, spfifo03/spfifo03.doc, spfifo03/spfifo03.scn: + Previously was spfifo06. Configure parameter for pipes is used now. + * spfifo04/.cvsignore, spfifo04/Makefile.am, spfifo04/init.c, + spfifo04/spfifo04.doc, spfifo04/spfifo04.scn, spfifo08/.cvsignore, + spfifo08/Makefile.am, spfifo08/init.c, spfifo08/spfifo08.doc, + spfifo08/spfifo08.scn: Removed. + 2010-06-22 Joel Sherrill * Makefile.am, configure.ac: Add new test to exercise path where using diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am index d25457e41a..c082086547 100644 --- a/testsuites/sptests/Makefile.am +++ b/testsuites/sptests/Makefile.am @@ -20,7 +20,7 @@ SUBDIRS = \ spfatal01 spfatal02 spfatal03 spfatal04 spfatal05 spfatal06 spfatal07 \ spfatal08 spfatal09 spfatal10 spfatal11 spfatal12 spfatal13 spfatal14 \ spfatal15 spfatal16 spfatal17 spfatal18 spfatal19 \ - spfifo01 spfifo02 spfifo03 spfifo04 spfifo08 \ + spfifo01 spfifo02 spfifo03 \ 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 2b04c497f2..3bb0dcf939 100644 --- a/testsuites/sptests/configure.ac +++ b/testsuites/sptests/configure.ac @@ -122,8 +122,6 @@ spfatal19/Makefile spfifo01/Makefile spfifo02/Makefile spfifo03/Makefile -spfifo04/Makefile -spfifo08/Makefile spintrcritical01/Makefile spintrcritical02/Makefile spintrcritical03/Makefile diff --git a/testsuites/sptests/spfifo01/Makefile.am b/testsuites/sptests/spfifo01/Makefile.am index ec31bf5d80..2e9bb3d1a7 100644 --- a/testsuites/sptests/spfifo01/Makefile.am +++ b/testsuites/sptests/spfifo01/Makefile.am @@ -14,7 +14,6 @@ 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 = $(spfifo01_OBJECTS) $(spfifo01_LDADD) diff --git a/testsuites/sptests/spfifo01/init.c b/testsuites/sptests/spfifo01/init.c index 0416fe9a24..c7d3604568 100644 --- a/testsuites/sptests/spfifo01/init.c +++ b/testsuites/sptests/spfifo01/init.c @@ -23,7 +23,7 @@ static void test_main(void) puts("\n\n*** FIFO / PIPE OPEN TEST - 1 ***"); puts( - "Configuration: Pipes disabled.\n" + "\nConfiguration: Pipes disabled.\n" "Creating named fifo '" FIFO_PATH "'.\n" "Must result in failure since pipes are disabled in the configuration." ); diff --git a/testsuites/sptests/spfifo02/Makefile.am b/testsuites/sptests/spfifo02/Makefile.am index fa1e55a4ab..10c076de16 100644 --- a/testsuites/sptests/spfifo02/Makefile.am +++ b/testsuites/sptests/spfifo02/Makefile.am @@ -5,7 +5,7 @@ MANAGERS = all rtems_tests_PROGRAMS = spfifo02 -spfifo02_SOURCES = init.c +spfifo02_SOURCES = init.c ../../support/src/spin.c dist_rtems_tests_DATA = spfifo02.scn dist_rtems_tests_DATA += spfifo02.doc @@ -14,14 +14,13 @@ 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 = $(spfifo02_OBJECTS) $(spfifo02_LDADD) LINK_LIBS = $(spfifo02_LDLIBS) spfifo02$(EXEEXT): $(spfifo02_OBJECTS) $(spfifo02_DEPENDENCIES) - @rm -f spfifo02$(EXEEXT) + @rm -f spfifo08$(EXEEXT) $(make-exe) include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/spfifo02/init.c b/testsuites/sptests/spfifo02/init.c index 3b17eda996..d564e13138 100644 --- a/testsuites/sptests/spfifo02/init.c +++ b/testsuites/sptests/spfifo02/init.c @@ -1,6 +1,6 @@ /* - * COPYRIGHT (c) 2010 - * Bharath Suri. + * 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 @@ -9,85 +9,207 @@ * $Id$ */ -/* Includes */ -#include #include +#include "test_support.h" -/* Includes */ -#include #include #include #include #include #include +#include -#include -#include +#define MAXIMUM 10 +#define NUM_OPEN_REQ 26 +rtems_id Barriers[MAXIMUM]; +int BarrierCount; -void test_main(void) -{ +rtems_id Semaphores[MAXIMUM]; +int SemaphoreCount; - int status = -1; - int fd = 0; +extern Heap_Control *RTEMS_Malloc_Heap; - puts("\n\n*** FIFO / PIPE OPEN TEST - 2 ***"); - puts( -"\n\nConfiguration: Pipes configured, \ -but number of barriers configured = 0" - ); +void create_all_barriers(void) +{ + rtems_status_code status; + int i; + + BarrierCount = 0; + + memset( Barriers, 0, sizeof(Barriers) ); + for ( i=0 ; i not all resources\n\ -were acquired" - ); - - fd = open("/tmp/fifo01", O_RDONLY); - rtems_test_assert(fd == -1); - rtems_test_assert(errno == EINTR); // Should this - // be ENOMEM? - puts("\n\nRemove the entry /tmp/fifo01"); - status = unlink("/tmp/fifo01"); - rtems_test_assert(status == 0); +void delete_semaphore(void) +{ + rtems_status_code status; + + SemaphoreCount--; + printf( "Deleting semaphore id=0x%08x\n", + (unsigned int) Semaphores[SemaphoreCount] ); + status = rtems_semaphore_delete( Semaphores[SemaphoreCount] ); + directive_failed( status, "semaphore delete" ); +} - puts("\n\nRemove directory /tmp"); - status = rmdir("/tmp"); +void create_fifo(void) +{ + int status; + + status = mkfifo("/fifo01", 0777); rtems_test_assert(status == 0); +} - puts("\n\n*** END OF FIFO / PIPE OPEN TEST - 2 ***"); +void open_fifo(int expected, int flags) +{ + int fd; + + fd = open("/fifo01", flags); + 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 not_used + rtems_task_argument argument ) { - test_main(); + void *alloc_ptr = (void *)0; + int num_opens = 0; + int index = 0; + Heap_Information_block Info; + + 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 ENFILE (semaphore @ open could not be created)" ); + open_fifo(ENFILE, O_RDWR); + + delete_semaphore(); + puts( "Opening FIFO.. expect ENOMEM (semaphore for pipe could not be created)" ); + open_fifo(ENOMEM, O_RDWR); + + delete_semaphore(); + + _Heap_Get_information(RTEMS_Malloc_Heap, &Info); + alloc_ptr = malloc(Info.Free.largest-4); + puts("Opening FIFO.. expect ENOMEM since no memory is available"); + open_fifo(ENOMEM, O_RDWR); + + free(alloc_ptr); + puts( "Opening FIFO.. expect ENOMEM (barrier-1 for pipe could not be created)" ); + open_fifo(ENOMEM, O_RDWR); + + delete_barrier(); + puts( "Opening FIFO.. expect ENOMEM (barrier-2 for pipe could not be created" ); + open_fifo(ENOMEM, O_RDWR); + + delete_barrier(); + puts( "Opening FIFO.. expect ENOMEM (semaphore-1 for pipe could not be created" ); + open_fifo(ENOMEM, O_RDWR); + + delete_semaphore(); + puts( "Opening FIFO in RDWR mode. Expect OK" ); + open_fifo(0, O_RDWR); + ++num_opens; + + puts( "Opening FIFO in non blocking RDONLY mode. Expect OK"); + open_fifo(0, O_RDONLY | O_NONBLOCK); + ++num_opens; + + puts( "Opening FIFO in non blocking WRONLY mode. Expect ENXIO"); + open_fifo(ENXIO, O_WRONLY | O_NONBLOCK); + ++num_opens; + + puts("\nMultiple opens\n"); + for(index = 0; index < NUM_OPEN_REQ - num_opens; ++index) { + + open_fifo(0, O_RDONLY | O_NONBLOCK); + printf("%d... ", index+1); + } + + 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_USE_IMFS_AS_BASE_FILESYSTEM -#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 6 +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_PIPES_ENABLED -#define CONFIGURE_MAXIMUM_PIPES 1 -#define CONFIGURE_MAXIMUM_TASKS 1 +#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_RTEMS_INIT_TASKS_TABLE #define CONFIGURE_INIT #include - /* end of file */ diff --git a/testsuites/sptests/spfifo02/spfifo02.doc b/testsuites/sptests/spfifo02/spfifo02.doc index 3b0b8200da..06ae9b9d43 100644 --- a/testsuites/sptests/spfifo02/spfifo02.doc +++ b/testsuites/sptests/spfifo02/spfifo02.doc @@ -1,8 +1,8 @@ # # $Id$ # -# COPYRIGHT (c) 2010 -# Bharath Suri. +# 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 @@ -11,12 +11,14 @@ This file describes the directives and concepts tested by this test set. -Configuration: +test set name: spfifo08 -Pipes enabled. Maximum number of barriers is not defined and hence = -0. +directives: -Expected: + mkfifo() + open() - on FIFOs -Pipe requires 2 barriers to be created. With max number of barriers -set to 0, fifo_open fails with EINTR +concepts: + ++ memory allocation error cases ++ resource allocation error cases diff --git a/testsuites/sptests/spfifo02/spfifo02.scn b/testsuites/sptests/spfifo02/spfifo02.scn index c4cf9fee19..a63612096b 100644 --- a/testsuites/sptests/spfifo02/spfifo02.scn +++ b/testsuites/sptests/spfifo02/spfifo02.scn @@ -1,31 +1 @@ -Could not open '/dev/kqemu' - QEMU acceleration layer not activated: No such file or directory -Initialized console on port COM1 9600-8-N-1 - - - -*** FIFO / PIPE OPEN TEST - 2 *** - - -Configuration: Pipes configured, but number of barriers configured = 0 - - -Creating directory /tmp - - -Creating fifo /tmp/fifo - - -Attempt to open the fifo file - -Must result in failure since -number of barriers = 0 => not all resources -were acquired - - -Remove the entry /tmp/fifo01 - - -Remove directory /tmp - - -*** END OF FIFO / PIPE OPEN TEST - 2 *** +XXX fill in with test output diff --git a/testsuites/sptests/spfifo03/Makefile.am b/testsuites/sptests/spfifo03/Makefile.am index f4e8662b70..77a4f63866 100644 --- a/testsuites/sptests/spfifo03/Makefile.am +++ b/testsuites/sptests/spfifo03/Makefile.am @@ -14,7 +14,6 @@ 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 = $(spfifo03_OBJECTS) $(spfifo03_LDADD) diff --git a/testsuites/sptests/spfifo03/init.c b/testsuites/sptests/spfifo03/init.c index 4902a3bacc..610c328165 100644 --- a/testsuites/sptests/spfifo03/init.c +++ b/testsuites/sptests/spfifo03/init.c @@ -1,6 +1,16 @@ -/* - * COPYRIGHT (c) 2010 - * Bharath Suri. +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility + * of invoking the test routine + * + * Input parameters: + * not_used + * + * 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 @@ -22,48 +32,169 @@ #include #include +#define SEND_RCV_BUFSIZ 12 +rtems_id Barrier; -void test_main(void) +rtems_task read_task(rtems_task_argument not_used) { + int fd = 0; + int status = -1; + + char recvBuf_r1[SEND_RCV_BUFSIZ] = {0}; + char recvBuf_r2[SEND_RCV_BUFSIZ] = {0}; + + puts("\nRead task activated, waiting till writer opens"); + + status = rtems_barrier_wait( Barrier, RTEMS_NO_TIMEOUT ); + rtems_test_assert( status == RTEMS_SUCCESSFUL ); + + sleep(1); + + puts("\nNow, reader opening file(1)"); + fd = open("/tmp/fifo01", O_RDONLY); + if(fd <= 0) { + printf("Error opening file: (%d) :: %s", errno, strerror(errno)); + rtems_test_assert(0); + } + + status = read(fd, recvBuf_r1, sizeof(recvBuf_r1)-1); + rtems_test_assert(status == sizeof(recvBuf_r1)-1); + + printf("\n@ receiver (being a unblocked reader): Got %s", recvBuf_r1); + + status = close(fd); + rtems_test_assert(status == 0); + + status = rtems_barrier_wait( Barrier, RTEMS_NO_TIMEOUT ); + rtems_test_assert( status == RTEMS_SUCCESSFUL ); + + puts("\nReader opening file(2)"); + fd = open("/tmp/fifo01", O_RDONLY); + if(fd <= 0) { + printf("Error opening file: (%d) :: %s", errno, strerror(errno)); + rtems_test_assert(0); + } + + status = read(fd, recvBuf_r2, sizeof(recvBuf_r2)-1); + rtems_test_assert(status == sizeof(recvBuf_r2)-1); + + printf("\n@ receiver (being a blocked reader): Got %s", recvBuf_r2); + + status = close(fd); + rtems_test_assert(status == 0); + + + puts("\nReader done!"); + status = rtems_barrier_wait( Barrier, RTEMS_NO_TIMEOUT ); + rtems_test_assert( status == RTEMS_SUCCESSFUL ); + rtems_task_delete( RTEMS_SELF ); +} + + +void test_main(void) //Also acts as the write task +{ + + rtems_id readTaskID; + rtems_name readTaskName; + + char sendBuf_r1[SEND_RCV_BUFSIZ] = {0}; + char sendBuf_r2[SEND_RCV_BUFSIZ] = {0}; int status = -1; int fd = 0; - puts("\n\n*** FIFO / PIPE OPEN TEST - 3 ***"); - puts( -"\n\nConfiguration: Pipes configured, \ -but number of barriers configured = 1\n\ -Required number of barriers = 2" - ); - puts("\n\nCreating directory /tmp"); + strcpy( sendBuf_r1, "SendBuffer1" ); + strcpy( sendBuf_r2, "SendBuffer2" ); + + memset( &Barrier, 0, sizeof(Barrier) ); + status = rtems_barrier_create ( + rtems_build_name ( 'B', 'A', 'R', 't' ), + RTEMS_BARRIER_AUTOMATIC_RELEASE, + 2, + &Barrier + ); + + rtems_test_assert( status == RTEMS_SUCCESSFUL ); + + puts("\n\n*** FIFO / PIPE OPEN TEST - 6 ***"); + + puts("\nCreating a task name and a task"); + readTaskName = rtems_build_name('T','A','r',' '); + + status = rtems_task_create( + readTaskName, + 1, + RTEMS_MINIMUM_STACK_SIZE * 2, + RTEMS_INTERRUPT_LEVEL(31), + RTEMS_DEFAULT_ATTRIBUTES, + &readTaskID + ); + + rtems_test_assert( status == RTEMS_SUCCESSFUL ); + + puts("\ncreating directory /tmp"); status = mkdir("/tmp", 0777); rtems_test_assert(status == 0); - puts("\n\nCreating fifo /tmp/fifo"); + puts("\ncreating fifo file /tmp/fifo01"); status = mkfifo("/tmp/fifo01", 0777); rtems_test_assert(status == 0); - puts("\n\nAttempt to open the fifo file\n"); - puts( -"Must result in failure since \n\ -number of barriers = 1 => not all resources\n\ -were acquired" - ); + puts("\nStarting the read task"); + status = rtems_task_start(readTaskID, read_task, 0); + rtems_test_assert(status == 0); - fd = open("/tmp/fifo01", O_RDONLY); - rtems_test_assert(fd == -1); - rtems_test_assert(errno == EINTR); // Should this - // be ENOMEM? - puts("\n\nRemove the entry /tmp/fifo01"); - status = unlink("/tmp/fifo01"); + status = rtems_barrier_wait( Barrier, RTEMS_NO_TIMEOUT ); + rtems_test_assert( status == RTEMS_SUCCESSFUL ); + + puts("\nWriter opening file(1)"); + fd = open("/tmp/fifo01", O_WRONLY); + if(fd <= 0) { + printf("Error opening file: (%d) :: %s", errno, strerror(errno)); + rtems_test_assert(0); + } + + + printf("\n@ sender: %s", sendBuf_r1); + status = write(fd, sendBuf_r1, sizeof(sendBuf_r1)-1); + rtems_test_assert(status == sizeof(sendBuf_r1)-1); + + status = close(fd); rtems_test_assert(status == 0); + + status = rtems_barrier_wait( Barrier, RTEMS_NO_TIMEOUT ); + rtems_test_assert( status == RTEMS_SUCCESSFUL ); - puts("\n\nRemove directory /tmp"); - status = rmdir("/tmp"); + sleep(1); + + // Reader would have blocked by now + puts("\nWriter opening file(2)"); + fd = open("/tmp/fifo01", O_WRONLY); + if(fd <= 0) { + printf("Error opening file: (%d) :: %s", errno, strerror(errno)); + rtems_test_assert(0); + } + + printf("\n@ sender: %s", sendBuf_r2); + status = write(fd, sendBuf_r2, sizeof(sendBuf_r2)-1); + rtems_test_assert(status == sizeof(sendBuf_r2)-1); + + status = close(fd); rtems_test_assert(status == 0); - puts("\n\n*** END OF FIFO / PIPE OPEN TEST - 3 ***"); + status = rtems_barrier_wait( Barrier, RTEMS_NO_TIMEOUT ); + rtems_test_assert( status == RTEMS_SUCCESSFUL ); + + puts( "Removing the fifo" ); + status = unlink("/tmp/fifo01"); + rtems_test_assert(status == 0); + + puts( "Removing /tmp" ); + status = rmdir("/tmp"); + rtems_test_assert(status == 0); + + puts("\n*** END OF FIFO / PIPE OPEN TEST - 6 ***"); } rtems_task Init( @@ -80,13 +211,18 @@ rtems_task Init( #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 6 -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 3 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_PIPES_ENABLED -#define CONFIGURE_MAXIMUM_PIPES 1 + +#define CONFIGURE_MAXIMUM_BARRIERS 1 + #define CONFIGURE_INIT +#define CONFIGURE_FIFOS_ENABLED +#define CONFIGURE_MAXIMUM_FIFOS 1 + +#define CONFIGURE_INIT #include /* end of file */ diff --git a/testsuites/sptests/spfifo03/spfifo03.doc b/testsuites/sptests/spfifo03/spfifo03.doc index 7c74bcbe1d..20a36b4b92 100644 --- a/testsuites/sptests/spfifo03/spfifo03.doc +++ b/testsuites/sptests/spfifo03/spfifo03.doc @@ -1,8 +1,8 @@ # # $Id$ # -# COPYRIGHT (c) 2010 -# Bharath Suri. +# 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 @@ -13,9 +13,15 @@ This file describes the directives and concepts tested by this test set. Configuration: -Pipes enabled. Maximum number of barriers is set to 1. +- Pipes enabled +- Resources available >= Resources required + - Semaphores, pipes, barriers etc. -Expected: +Coverage concepts: -Pipe requires 2 barriers to be created. With max number of barriers -set to 1, fifo_open fails with EINTR +- Main task also acts as the write task +- Main task creates another task: for reading +- Write task is responsible for writing to the pipe and the read task + reads from the pipe +- The pipe is opened twice, such that the write task blocks on open + once and the read task blocks on open the 2nd time diff --git a/testsuites/sptests/spfifo03/spfifo03.scn b/testsuites/sptests/spfifo03/spfifo03.scn index 49dc5ebe8a..a0ccdb7db9 100644 --- a/testsuites/sptests/spfifo03/spfifo03.scn +++ b/testsuites/sptests/spfifo03/spfifo03.scn @@ -1,32 +1,41 @@ -Could not open '/dev/kqemu' - QEMU acceleration layer not activated: No such file or directory Initialized console on port COM1 9600-8-N-1 -*** FIFO / PIPE OPEN TEST - 3 *** +*** FIFO / PIPE OPEN TEST - 6 *** -Configuration: Pipes configured, but number of barriers configured = 1 -Required number of barriers = 2 +Creating a task name and a task -Creating directory /tmp +creating directory /tmp -Creating fifo /tmp/fifo +creating fifo file /tmp/fifo01 -Attempt to open the fifo file +Starting the read task -Must result in failure since -number of barriers = 1 => not all resources -were acquired +Writer opening file(1) -Remove the entry /tmp/fifo01 +Read task activated, sleeping to block the writer -Remove directory /tmp +Now, reader opening file(1) -*** END OF FIFO / PIPE OPEN TEST - 3 *** + +@ sender: + +@ receiver (being a unblocked reader): Got + +Reader opening file(2) + + +Writer opening file(2) + + +@ sender: SendBuffer2 + +*** END OF FIFO / PIPE OPEN TEST - 6 *** diff --git a/testsuites/sptests/spfifo04/.cvsignore b/testsuites/sptests/spfifo04/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/testsuites/sptests/spfifo04/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/testsuites/sptests/spfifo04/Makefile.am b/testsuites/sptests/spfifo04/Makefile.am deleted file mode 100644 index a2281a031b..0000000000 --- a/testsuites/sptests/spfifo04/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -## -## $Id$ -## - -MANAGERS = all - -rtems_tests_PROGRAMS = spfifo04 -spfifo04_SOURCES = init.c - -dist_rtems_tests_DATA = spfifo04.scn -dist_rtems_tests_DATA += spfifo04.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 = $(spfifo04_OBJECTS) $(spfifo04_LDADD) -LINK_LIBS = $(spfifo04_LDLIBS) - -spfifo04$(EXEEXT): $(spfifo04_OBJECTS) $(spfifo04_DEPENDENCIES) - @rm -f spfifo04$(EXEEXT) - $(make-exe) - -include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/spfifo04/init.c b/testsuites/sptests/spfifo04/init.c deleted file mode 100644 index bcf5ea71a8..0000000000 --- a/testsuites/sptests/spfifo04/init.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * COPYRIGHT (c) 2010 - * Bharath Suri. - * - * 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$ - */ - -/* Includes */ -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#define NUM_OPEN_REQ 26 - -void test_main(void) -{ - - int status = -1; - int fd = 0; - int index = 0; - int num_opens = 0; - - puts("\n\n*** FIFO / PIPE OPEN TEST - 4 ***"); - puts( -"\n\nConfiguration: Pipes configured, \ -but number of barriers configured = 2\n" - ); - - puts("\n\nCreating directory /tmp"); - status = mkdir("/tmp", 0777); - rtems_test_assert(status == 0); - - puts("\n\nCreating fifo /tmp/fifo"); - status = mkfifo("/tmp/fifo01", 0777); - rtems_test_assert(status == 0); - - puts("\n\nAttempt to open the fifo file in RDWR mode\n"); - puts("Should be successful and non-negative\ -file descriptor expected"); - - fd = open("/tmp/fifo01", O_RDWR); - rtems_test_assert(fd > 0); - ++num_opens; - - puts("\n\nClosing the fifo file"); - status = close(fd); - rtems_test_assert(status == 0); - - puts("\n\nAttempt to open the fifo file in \ -RDONLY and NONBLOCK mode\n"); - puts("Should be successful and non-negative\ -file descriptor expected"); - - fd = open("/tmp/fifo01", O_RDONLY | O_NONBLOCK); - rtems_test_assert(fd > 0); - ++num_opens; - - puts("\n\nClosing the fifo file"); - status = close(fd); - rtems_test_assert(status == 0); - - puts("\n\nAttempt to open the fifo file in \ -WRONLY and NONBLOCK mode\n"); - puts("Should return with an error ENXIO"); - - fd = open("/tmp/fifo01", O_WRONLY | O_NONBLOCK); - rtems_test_assert(fd == -1); - rtems_test_assert(errno == ENXIO); - ++num_opens; - - // Number of attempts to open fifo till now = 3 - // Number of attempts to move the static char - // from 'a' -> 'z' = 26 - // => Number of opens required = 23 - puts("\n\nMultiple opens\n"); - for(index = 0; index < NUM_OPEN_REQ - num_opens; ++index) { - - fd = open("/tmp/fifo01", O_RDONLY | O_NONBLOCK); - rtems_test_assert(fd > 0); - - status = close(fd); - rtems_test_assert(status == 0); - - printf("%d... ", index+1); - } - - puts("\n\nRemove the entry /tmp/fifo01"); - status = unlink("/tmp/fifo01"); - rtems_test_assert(status == 0); - - puts("\n\nRemove directory /tmp"); - status = rmdir("/tmp"); - rtems_test_assert(status == 0); - - puts("\n\n*** END OF FIFO / PIPE OPEN TEST - 4 ***"); -} - -rtems_task Init( - rtems_task_argument not_used -) -{ - test_main(); - rtems_test_exit(0); -} - -#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER -#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER - -#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM -#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 6 - -#define CONFIGURE_MAXIMUM_TASKS 1 - -#define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_PIPES_ENABLED -#define CONFIGURE_MAXIMUM_PIPES 1 -#define CONFIGURE_INIT - -#include - -/* end of file */ diff --git a/testsuites/sptests/spfifo04/spfifo04.doc b/testsuites/sptests/spfifo04/spfifo04.doc deleted file mode 100644 index 7b74ad3cad..0000000000 --- a/testsuites/sptests/spfifo04/spfifo04.doc +++ /dev/null @@ -1,51 +0,0 @@ -# -# $Id$ -# -# COPYRIGHT (c) 2010 -# Bharath Suri. -# -# 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. - -Configuration: - -Pipes enabled. -Maximum number of barriers is set to 2. - -Coverage concepts: - -With number of barriers set to 2, and provided there is sufficient -memory available, fifo_open -> pipe_new must be able to create a new -pipe_control_t successfully. - -This test - -- Creates a directory /tmp -- Creates a fifo file /tmp/fifo01 - -- Opens the fifo in read-write mode, covering one of the cases of the - switch statement (this should be successful) -- Closes the fifo - -- Opens the file in read-only, non-blocing mode, covering another case - of the switch (this should be successful) -- Closes the fifo - -- Opens the file in write-only, non-blocking mode, covering yet - another case in the switch. (this should not be successful, instead, - since we opened the fifo in a WRONLY and NONBLOCK mode, we receive - an ENXIO error) - -- fifo_open (pipe_new) maintains a static character variable, which it - uses to create semaphores and barriers. The value of this character - goes from a -> z -> a -> z... To hit the case where z is wrapped - back to a, fifo_open must be called a minimum total of 26 - times. This is achieved by repeated opens on the fifo file created. -- After every successful open, the file is closed - -- Remove fifo file -- Remove tmp directory diff --git a/testsuites/sptests/spfifo04/spfifo04.scn b/testsuites/sptests/spfifo04/spfifo04.scn deleted file mode 100644 index c806e24837..0000000000 --- a/testsuites/sptests/spfifo04/spfifo04.scn +++ /dev/null @@ -1,50 +0,0 @@ -Could not open '/dev/kqemu' - QEMU acceleration layer not activated: No such file or directory -Initialized console on port COM1 9600-8-N-1 - - - -*** FIFO / PIPE OPEN TEST - 4 *** - - -Configuration: Pipes configured, but number of barriers configured = 2 - - - -Creating directory /tmp - - -Creating fifo /tmp/fifo - - -Attempt to open the fifo file in RDWR mode - -Should be successful and non-negativefile descriptor expected - - -Closing the fifo file - - -Attempt to open the fifo file in RDONLY and NONBLOCK mode - -Should be successful and non-negativefile descriptor expected - - -Closing the fifo file - - -Attempt to open the fifo file in WRONLY and NONBLOCK mode - -Should return with an error ENXIO - - -Multiple opens - -1... 2... 3... 4... 5... 6... 7... 8... 9... 10... 11... 12... 13... 14... 15... 16... 17... 18... 19... 20... 21... 22... 23... - -Remove the entry /tmp/fifo01 - - -Remove directory /tmp - - -*** END OF FIFO / PIPE OPEN TEST - 4 *** diff --git a/testsuites/sptests/spfifo08/.cvsignore b/testsuites/sptests/spfifo08/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/testsuites/sptests/spfifo08/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/testsuites/sptests/spfifo08/Makefile.am b/testsuites/sptests/spfifo08/Makefile.am deleted file mode 100644 index e1d03bb7eb..0000000000 --- a/testsuites/sptests/spfifo08/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -## -## $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 deleted file mode 100644 index 10743e6ff9..0000000000 --- a/testsuites/sptests/spfifo08/init.c +++ /dev/null @@ -1,182 +0,0 @@ -/* - * 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 -#include "test_support.h" - -#include -#include -#include -#include -#include - -#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; - - memset( Barriers, 0, sizeof(Barriers) ); - for ( i=0 ; i -/* end of file */ diff --git a/testsuites/sptests/spfifo08/spfifo08.doc b/testsuites/sptests/spfifo08/spfifo08.doc deleted file mode 100644 index 06ae9b9d43..0000000000 --- a/testsuites/sptests/spfifo08/spfifo08.doc +++ /dev/null @@ -1,24 +0,0 @@ -# -# $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 deleted file mode 100644 index a63612096b..0000000000 --- a/testsuites/sptests/spfifo08/spfifo08.scn +++ /dev/null @@ -1 +0,0 @@ -XXX fill in with test output -- cgit v1.2.3