Index: testsuites/sptests/ChangeLog
===================================================================
--- testsuites/sptests/ChangeLog	(revision eb8c45dfdf878614e2ea9cecbe3187058b92e020)
+++ testsuites/sptests/ChangeLog	(revision 287febb50397f321d5a38f8d7df668833c192125)
@@ -1,2 +1,18 @@
+2010-06-24	Bharath Suri <bharath.s.jois@gmail.com>
+
+	* 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 <joel.sherrilL@OARcorp.com>
 
Index: testsuites/sptests/Makefile.am
===================================================================
--- testsuites/sptests/Makefile.am	(revision eb8c45dfdf878614e2ea9cecbe3187058b92e020)
+++ testsuites/sptests/Makefile.am	(revision 287febb50397f321d5a38f8d7df668833c192125)
@@ -21,5 +21,5 @@
     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 \
Index: testsuites/sptests/configure.ac
===================================================================
--- testsuites/sptests/configure.ac	(revision eb8c45dfdf878614e2ea9cecbe3187058b92e020)
+++ testsuites/sptests/configure.ac	(revision 287febb50397f321d5a38f8d7df668833c192125)
@@ -123,6 +123,4 @@
 spfifo02/Makefile
 spfifo03/Makefile
-spfifo04/Makefile
-spfifo08/Makefile
 spintrcritical01/Makefile
 spintrcritical02/Makefile
Index: testsuites/sptests/spfifo01/Makefile.am
===================================================================
--- testsuites/sptests/spfifo01/Makefile.am	(revision eb8c45dfdf878614e2ea9cecbe3187058b92e020)
+++ testsuites/sptests/spfifo01/Makefile.am	(revision 287febb50397f321d5a38f8d7df668833c192125)
@@ -15,5 +15,4 @@
 include $(top_srcdir)/../automake/leaf.am
 
-
 AM_CPPFLAGS += -I$(top_srcdir)/../support/include
 
Index: testsuites/sptests/spfifo01/init.c
===================================================================
--- testsuites/sptests/spfifo01/init.c	(revision eb8c45dfdf878614e2ea9cecbe3187058b92e020)
+++ testsuites/sptests/spfifo01/init.c	(revision 287febb50397f321d5a38f8d7df668833c192125)
@@ -24,5 +24,5 @@
 
   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."
Index: testsuites/sptests/spfifo02/Makefile.am
===================================================================
--- testsuites/sptests/spfifo02/Makefile.am	(revision eb8c45dfdf878614e2ea9cecbe3187058b92e020)
+++ testsuites/sptests/spfifo02/Makefile.am	(revision 287febb50397f321d5a38f8d7df668833c192125)
@@ -6,5 +6,5 @@
 
 rtems_tests_PROGRAMS = spfifo02
-spfifo02_SOURCES = init.c
+spfifo02_SOURCES = init.c ../../support/src/spin.c
 
 dist_rtems_tests_DATA = spfifo02.scn
@@ -15,5 +15,4 @@
 include $(top_srcdir)/../automake/leaf.am
 
-
 AM_CPPFLAGS += -I$(top_srcdir)/../support/include
 
@@ -22,5 +21,5 @@
 
 spfifo02$(EXEEXT): $(spfifo02_OBJECTS) $(spfifo02_DEPENDENCIES)
-	@rm -f spfifo02$(EXEEXT)
+	@rm -f spfifo08$(EXEEXT)
 	$(make-exe)
 
Index: testsuites/sptests/spfifo02/init.c
===================================================================
--- testsuites/sptests/spfifo02/init.c	(revision eb8c45dfdf878614e2ea9cecbe3187058b92e020)
+++ testsuites/sptests/spfifo02/init.c	(revision 287febb50397f321d5a38f8d7df668833c192125)
@@ -1,5 +1,5 @@
 /*
- *  COPYRIGHT (c) 2010
- *  Bharath Suri<bharath.s.jois@gmail.com>.
+ *  COPYRIGHT (c) 1989-2010.
+ *  On-Line Applications Research Corporation (OAR).
  *
  *  The license and distribution terms for this file may be
@@ -10,10 +10,7 @@
  */
 
-/* Includes */
-#include <bsp.h>
 #include <tmacros.h>
-
-/* Includes */
-#include <stdio.h>
+#include "test_support.h"
+
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -21,73 +18,198 @@
 #include <unistd.h>
 #include <errno.h>
-
-#include <rtems.h>
-#include <rtems/libio.h>
-
-
-void test_main(void)
-{
-
-  int status = -1;
-  int fd = 0;
-
-  puts("\n\n*** FIFO / PIPE OPEN TEST - 2 ***");
-  puts(
-"\n\nConfiguration: Pipes configured, \
-but number of barriers configured = 0"
-       );
-
-  puts("\n\nCreating directory /tmp");
-  status = mkdir("/tmp", 0777);
+#include <rtems/score/heap.h>
+
+#define MAXIMUM 10
+#define NUM_OPEN_REQ 26
+
+rtems_id Barriers[MAXIMUM];
+int BarrierCount;
+
+rtems_id Semaphores[MAXIMUM];
+int SemaphoreCount;
+
+extern Heap_Control  *RTEMS_Malloc_Heap;
+
+void create_all_barriers(void)
+{
+  rtems_status_code status;
+  int               i;
+
+  BarrierCount = 0;
+
+  memset( Barriers, 0, sizeof(Barriers) );
+  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+1 );
+      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+1 );
+      return;
+    } 
+
+    directive_failed( status, "semaphore create" );
+    SemaphoreCount++;
+  }
+}
+
+void delete_barrier(void)
+{
+  rtems_status_code status;
+  
+  BarrierCount--;
+  printf( "Deleting barrier id=0x%08x\n",
+    (unsigned int)Barriers[BarrierCount] );
+  status = rtems_barrier_delete( Barriers[BarrierCount] );
+  directive_failed( status, "barrier delete" );
+}
+
+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" );
+}
+
+void create_fifo(void)
+{
+  int status;
+
+  status = mkfifo("/fifo01", 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\n");
-  puts(
-"Must result in failure since \n\
-number of barriers = 0 => 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);
-
-  puts("\n\nRemove directory /tmp");
-  status = rmdir("/tmp");
-  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 argument
+)
+{
+  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();
   
-rtems_task Init(
-  rtems_task_argument not_used
-)
-{
-  test_main();
+  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_MAXIMUM_TASKS             1
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
 #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
-#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 6
-
-#define CONFIGURE_PIPES_ENABLED
-#define CONFIGURE_MAXIMUM_PIPES 1
-#define CONFIGURE_MAXIMUM_TASKS 1
-
-#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#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 */
Index: testsuites/sptests/spfifo02/spfifo02.scn
===================================================================
--- testsuites/sptests/spfifo02/spfifo02.scn	(revision eb8c45dfdf878614e2ea9cecbe3187058b92e020)
+++ testsuites/sptests/spfifo02/spfifo02.scn	(revision 287febb50397f321d5a38f8d7df668833c192125)
@@ -1,32 +1,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
Index: testsuites/sptests/spfifo03/Makefile.am
===================================================================
--- testsuites/sptests/spfifo03/Makefile.am	(revision eb8c45dfdf878614e2ea9cecbe3187058b92e020)
+++ testsuites/sptests/spfifo03/Makefile.am	(revision 287febb50397f321d5a38f8d7df668833c192125)
@@ -15,5 +15,4 @@
 include $(top_srcdir)/../automake/leaf.am
 
-
 AM_CPPFLAGS += -I$(top_srcdir)/../support/include
 
Index: testsuites/sptests/spfifo03/init.c
===================================================================
--- testsuites/sptests/spfifo03/init.c	(revision eb8c45dfdf878614e2ea9cecbe3187058b92e020)
+++ testsuites/sptests/spfifo03/init.c	(revision 287febb50397f321d5a38f8d7df668833c192125)
@@ -1,5 +1,15 @@
-/*
- *  COPYRIGHT (c) 2010
- *  Bharath Suri<bharath.s.jois@gmail.com>.
+/*  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
@@ -23,46 +33,167 @@
 #include <rtems/libio.h>
 
-
-void test_main(void)
+#define SEND_RCV_BUFSIZ 12
+rtems_id Barrier;
+
+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"
-       );
-
-  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");
+  puts("\nStarting the read task");
+  status = rtems_task_start(readTaskID, read_task, 0);
+  rtems_test_assert(status == 0);
+
+  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 );
+
+  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);
+
+  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("\n\nRemove directory /tmp");
+  
+  puts( "Removing /tmp" );
   status = rmdir("/tmp");
   rtems_test_assert(status == 0);
-
-  puts("\n\n*** END OF FIFO / PIPE OPEN TEST - 3 ***");
+  
+  puts("\n*** END OF FIFO / PIPE OPEN TEST - 6 ***");
 }
 
@@ -81,11 +212,16 @@
 #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 <rtems/confdefs.h>
 
Index: testsuites/sptests/spfifo03/spfifo03.scn
===================================================================
--- testsuites/sptests/spfifo03/spfifo03.scn	(revision eb8c45dfdf878614e2ea9cecbe3187058b92e020)
+++ testsuites/sptests/spfifo03/spfifo03.scn	(revision 287febb50397f321d5a38f8d7df668833c192125)
@@ -1,3 +1,2 @@
-Could not open '/dev/kqemu' - QEMU acceleration layer not activated: No such file or directory
 Initialized console on port COM1 9600-8-N-1
 
@@ -5,29 +4,39 @@
 
 
-*** 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
-
-Must result in failure since 
-number of barriers = 1 => not all resources
-were acquired
+Starting the read task
 
 
-Remove the entry /tmp/fifo01
+Writer opening file(1)
 
 
-Remove directory /tmp
+Read task activated, sleeping to block the writer
 
 
-*** END OF FIFO / PIPE OPEN TEST - 3 ***
+Now, reader opening file(1)
+
+
+@ sender: 
+
+@ receiver (being a unblocked reader): Got 
+
+Reader opening file(2)
+
+
+Writer opening file(2)
+
+
+@ sender: SendBuffer2
+
+*** END OF FIFO / PIPE OPEN TEST - 6 ***
Index: stsuites/sptests/spfifo04/.cvsignore
===================================================================
--- testsuites/sptests/spfifo04/.cvsignore	(revision eb8c45dfdf878614e2ea9cecbe3187058b92e020)
+++ 	(revision )
@@ -1,2 +1,0 @@
-Makefile
-Makefile.in
Index: stsuites/sptests/spfifo04/Makefile.am
===================================================================
--- testsuites/sptests/spfifo04/Makefile.am	(revision eb8c45dfdf878614e2ea9cecbe3187058b92e020)
+++ 	(revision )
@@ -1,26 +1,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
Index: stsuites/sptests/spfifo04/init.c
===================================================================
--- testsuites/sptests/spfifo04/init.c	(revision eb8c45dfdf878614e2ea9cecbe3187058b92e020)
+++ 	(revision )
@@ -1,133 +1,0 @@
-/*
- *  COPYRIGHT (c) 2010
- *  Bharath Suri<bharath.s.jois@gmail.com>.
- *
- *  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 <bsp.h>
-#include <tmacros.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <rtems.h>
-#include <rtems/libio.h>
-
-#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 <rtems/confdefs.h>
-
-/* end of file */
Index: stsuites/sptests/spfifo04/spfifo04.scn
===================================================================
--- testsuites/sptests/spfifo04/spfifo04.scn	(revision eb8c45dfdf878614e2ea9cecbe3187058b92e020)
+++ 	(revision )
@@ -1,51 +1,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 ***
Index: stsuites/sptests/spfifo08/.cvsignore
===================================================================
--- testsuites/sptests/spfifo08/.cvsignore	(revision eb8c45dfdf878614e2ea9cecbe3187058b92e020)
+++ 	(revision )
@@ -1,2 +1,0 @@
-Makefile
-Makefile.in
Index: stsuites/sptests/spfifo08/Makefile.am
===================================================================
--- testsuites/sptests/spfifo08/Makefile.am	(revision eb8c45dfdf878614e2ea9cecbe3187058b92e020)
+++ 	(revision )
@@ -1,26 +1,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
Index: stsuites/sptests/spfifo08/init.c
===================================================================
--- testsuites/sptests/spfifo08/init.c	(revision eb8c45dfdf878614e2ea9cecbe3187058b92e020)
+++ 	(revision )
@@ -1,182 +1,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 <tmacros.h>
-#include "test_support.h"
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.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;
-
-  memset( Barriers, 0, sizeof(Barriers) );
-  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+1 );
-      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+1 );
-      return;
-    } 
-
-    directive_failed( status, "semaphore create" );
-    SemaphoreCount++;
-  }
-}
-
-void delete_barrier(void)
-{
-  rtems_status_code status;
-  
-  BarrierCount--;
-  printf( "Deleting barrier id=0x%08x\n",
-    (unsigned int)Barriers[BarrierCount] );
-  status = rtems_barrier_delete( Barriers[BarrierCount] );
-  directive_failed( status, "barrier delete" );
-}
-
-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" );
-}
-
-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 ENFILE (barrier - case 1)" );
-  open_fifo(ENFILE); /* XXX ENOMEM */
-
-  delete_barrier();
-  puts( "Opening FIFO.. expect ENFILE (barrier - case 2)" );
-  open_fifo(ENFILE); /* XXX ENOMEM */
-
-  delete_barrier();
-  puts( "Opening FIFO.. expect ENFILE (semaphore - case 1)" );
-  open_fifo(ENFILE); /* XXX ENOMEM */
-
-  delete_semaphore();
-  puts( "Opening FIFO.. expect ERROR ???" );
-  open_fifo(EINTR); /* XXX ENOMEM */
-
-  delete_semaphore();
-  puts( "Opening FIFO.. expect ENOSPC???" );
-  open_fifo(ENOMEM);
-  
-  delete_semaphore();
-  puts( "Opening FIFO.. expect OK???" );
-  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 */
Index: stsuites/sptests/spfifo08/spfifo08.scn
===================================================================
--- testsuites/sptests/spfifo08/spfifo08.scn	(revision eb8c45dfdf878614e2ea9cecbe3187058b92e020)
+++ 	(revision )
@@ -1,1 +1,0 @@
-XXX fill in with test output
