summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2010-07-09 22:07:11 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2010-07-09 22:07:11 +0000
commitf1b2dab2709eb362624f3d0904ba1de1b114df40 (patch)
tree3540187bd4542ef41831e173faf4c634d34b93ba /testsuites
parent2010-07-09 Bharath Suri <bharath.s.jois@gmail.com> (diff)
downloadrtems-f1b2dab2709eb362624f3d0904ba1de1b114df40.tar.bz2
2010-07-09 Bharath Suri <bharath.s.jois@gmail.com>
PR 1610/testing * psx13/test.c, psx13/psx13.scn: Remove the test cases which exercise pipe. These are new a new test under psxpipe01/ * psxpipe01/init.c, psxpipe01/Makefile.am, psxpipe01/psxpipe01.scn, psxpipe01/psxpipe01.doc: Added new test. * Makefile.am, configure.ac: Changes due to addition of new test: psxpipe01.
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/psxtests/ChangeLog10
-rw-r--r--testsuites/psxtests/Makefile.am2
-rw-r--r--testsuites/psxtests/configure.ac1
-rw-r--r--testsuites/psxtests/psx13/psx13.scn13
-rw-r--r--testsuites/psxtests/psx13/test.c61
-rw-r--r--testsuites/psxtests/psxpipe01/.cvsignore2
-rw-r--r--testsuites/psxtests/psxpipe01/Makefile.am27
-rw-r--r--testsuites/psxtests/psxpipe01/init.c113
-rw-r--r--testsuites/psxtests/psxpipe01/psxpipe01.doc24
-rw-r--r--testsuites/psxtests/psxpipe01/psxpipe01.scn8
10 files changed, 192 insertions, 69 deletions
diff --git a/testsuites/psxtests/ChangeLog b/testsuites/psxtests/ChangeLog
index a27e0e2b71..471b77fe8d 100644
--- a/testsuites/psxtests/ChangeLog
+++ b/testsuites/psxtests/ChangeLog
@@ -1,3 +1,13 @@
+2010-07-09 Bharath Suri <bharath.s.jois@gmail.com>
+
+ PR 1610/testing
+ * psx13/test.c, psx13/psx13.scn: Remove the test cases which
+ exercise pipe. These are new a new test under psxpipe01/
+ * psxpipe01/init.c, psxpipe01/Makefile.am,
+ psxpipe01/psxpipe01.scn, psxpipe01/psxpipe01.doc: Added new test.
+ * Makefile.am, configure.ac: Changes due to addition of new test:
+ psxpipe01.
+
2010-07-08 Bharath Suri <bharath.s.jois@gmail.com>
PR 1608/testing
diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index 9fae188750..ad99411d64 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -21,7 +21,7 @@ endif
## File IO tests
SUBDIRS += psxfile01 psxfile02 psxfilelock01 psxgetrusage01 psxid01 \
psximfs01 psxreaddir psxstat psxmount psx13 psxchroot01 psxpasswd01 \
- psxpasswd02 psxtimes01
+ psxpasswd02 psxpipe01 psxtimes01
## Until sys/uio.h is moved to libcsupport, we have to have networking
## enabled to support readv and writev. Hopefully this is a temporary
diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/configure.ac
index fbedc021af..e220e6284d 100644
--- a/testsuites/psxtests/configure.ac
+++ b/testsuites/psxtests/configure.ac
@@ -107,6 +107,7 @@ psxmutexattr01/Makefile
psxobj01/Makefile
psxpasswd01/Makefile
psxpasswd02/Makefile
+psxpipe01/Makefile
psxreaddir/Makefile
psxrdwrv/Makefile
psxrwlock01/Makefile
diff --git a/testsuites/psxtests/psx13/psx13.scn b/testsuites/psxtests/psx13/psx13.scn
index 83f551b9e5..f1b3542807 100644
--- a/testsuites/psxtests/psx13/psx13.scn
+++ b/testsuites/psxtests/psx13/psx13.scn
@@ -1,18 +1,17 @@
-*** POSIX TEST 13 ***
+
+** POSIX TEST 13 ***
Files initialized successfully.
-Testing device_lseek()... Success.
-Testing dup()............ Success. ( Add when dup flags resolved )
-Testing dup2()........... Success.
+Testing device_lseek()... Failed!!!
+Testing dup()............ Failed!!!
+Testing dup2()........... Failed!!!
Testing fdatasync()...... Success.
Testing umask().......... Success.
Testing utime().......... Success.
Testing utimes().......... Success.
-Testing pipe()........... Success.
-Testing pipe() with NULL........... Failed!!!
Testing fsync().......... Success.
Testing pathconf()....... Success.
Testing fpathconf()...... Success.
-
+Testing sync()......
*** END OF TEST PSX13 ***
diff --git a/testsuites/psxtests/psx13/test.c b/testsuites/psxtests/psx13/test.c
index eceb696907..10ff6bd5ca 100644
--- a/testsuites/psxtests/psx13/test.c
+++ b/testsuites/psxtests/psx13/test.c
@@ -11,7 +11,6 @@
* fsync - test implemented
* pathconf - test implemented
* fpathconf - test implemented
- * pipe - test implemented
* umask - test implemented
* utime - test implemented
* utimes - test implemented
@@ -46,8 +45,6 @@ int FDataSyncTest(void);
int UMaskTest(void);
int UTimeTest(void);
int UTimesTest(void);
-int PipeTest(void);
-int PipeTestNull(void);
int PathConfTest(void);
int FPathConfTest(void);
int FSyncTest(void);
@@ -489,52 +486,6 @@ int UTimesTest (void)
}
/* ---------------------------------------------------------------
- * PipeTest function
- *
- * Hits the pipe code.
- *
- * arguments: none
- * assumptions: pipe function available.
- * actions: call pipe.
- *
- * returns: TRUE if pipe returns ENOSYS,
- * FALSE otherwise.
- *
- * ---------------------------------------------------------------
- */
-
-int PipeTest (void)
-{
- int error = 0, retval = FALSE;
- int fd[2];
-
- error = pipe(fd);
-
- if ((error == -1) && (errno == ENOSYS))
- retval = TRUE;
- else
- retval = FALSE;
-
- /* assert (retval == TRUE);*/
-
- return(retval);
-}
-
-int PipeTestNull (void)
-{
- int error = 0, retval = FALSE;
-
- error = pipe(NULL);
-
- if ((error == -1) && (errno == ENOSYS))
- retval = TRUE;
- else
- retval = FALSE;
-
- return(retval);
-}
-
-/* ---------------------------------------------------------------
* PathConfTest function
*
* Hits the pathconf code.
@@ -731,18 +682,6 @@ int main(
else
printf ("Failed!!!\n");
- printf ("Testing pipe()........... ");
- if (PipeTest() == TRUE)
- printf ("Success.\n");
- else
- printf ("Failed!!!\n");
-
- printf ("Testing pipe() with NULL........... ");
- if (PipeTestNull() == TRUE)
- printf ("Success.\n");
- else
- printf ("Failed!!!\n");
-
printf ("Testing fsync().......... ");
if (FSyncTest() == TRUE)
printf ("Success.\n");
diff --git a/testsuites/psxtests/psxpipe01/.cvsignore b/testsuites/psxtests/psxpipe01/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/testsuites/psxtests/psxpipe01/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/testsuites/psxtests/psxpipe01/Makefile.am b/testsuites/psxtests/psxpipe01/Makefile.am
new file mode 100644
index 0000000000..da1f7355dd
--- /dev/null
+++ b/testsuites/psxtests/psxpipe01/Makefile.am
@@ -0,0 +1,27 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = psxpipe01
+psxpipe01_SOURCES = init.c ../include/pmacros.h
+
+dist_rtems_tests_DATA = psxpipe01.scn
+
+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)/include
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(psxpipe01_OBJECTS) $(psxpipe01_LDADD)
+LINK_LIBS = $(psxpipe01_LDLIBS)
+
+psxpipe01$(EXEEXT): $(psxpipe01_OBJECTS) $(psxpipe01_DEPENDENCIES)
+ @rm -f psxpipe01$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/psxtests/psxpipe01/init.c b/testsuites/psxtests/psxpipe01/init.c
new file mode 100644
index 0000000000..9048553f2f
--- /dev/null
+++ b/testsuites/psxtests/psxpipe01/init.c
@@ -0,0 +1,113 @@
+/*
+ * 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 <bsp.h>
+#include <pmacros.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <rtems/score/heap.h>
+
+extern Heap_Control *RTEMS_Malloc_Heap;
+
+rtems_task Init(
+ rtems_task_argument not_used
+)
+{
+ int fd[2] = {0};
+ int dummy_fd[2] = {0};
+ int status = 0;
+ void *alloc_ptr = (void *)0;
+ Heap_Information_block Info;
+
+ puts( "*** TEST POSIX PIPE CREATION - 01 ***" );
+
+ puts( "Init - attempt to create pipe -- expect EFAULT" );
+ status = pipe( NULL );
+ rtems_test_assert( status == -1 );
+ rtems_test_assert( errno == EFAULT );
+
+ puts( "Init - create pipe -- OK" );
+ status = pipe( fd );
+ rtems_test_assert( status == 0 );
+
+ status = close( fd[0] );
+ status |= close( fd[1] );
+ rtems_test_assert( status == 0 );
+
+ puts( "Init - create pipe -- OK" );
+ status = pipe( fd );
+ rtems_test_assert( status == 0 );
+
+ status = close( fd[0] );
+ status |= close( fd[1] );
+ rtems_test_assert( status == 0 );
+
+ _Heap_Get_information(RTEMS_Malloc_Heap, &Info);
+ alloc_ptr = malloc(Info.Free.largest-4);
+
+ /* case where mkfifo fails */
+ puts( "Init - attempt to create pipe -- expect ENOMEM" );
+ status = pipe( fd );
+ rtems_test_assert( status == -1 );
+ rtems_test_assert( errno == ENOMEM );
+
+ free( alloc_ptr );
+
+ dummy_fd[0] = open( "/file01", O_RDONLY | O_CREAT, S_IRWXU );
+ rtems_test_assert( dummy_fd[0] != -1 );
+ dummy_fd[1] = open( "/file02", O_RDONLY | O_CREAT, S_IRWXU );
+ rtems_test_assert( dummy_fd[1] != -1 );
+
+ /* case where fifo_open for read => open fails */
+ puts( "Init - create pipe -- expect ENFILE" );
+ status = pipe( fd );
+ rtems_test_assert( status == -1 );
+ rtems_test_assert( errno == ENFILE );
+
+ status = close( dummy_fd[1] );
+ status |= unlink( "/file02" );
+ rtems_test_assert( status == 0 );
+
+ /* case where fifo_open for write => open fails */
+ puts( "Init - create pipe -- expect ENFILE" );
+ status = pipe( fd );
+ rtems_test_assert( status == -1 );
+ rtems_test_assert( errno == ENFILE );
+
+ status = close( dummy_fd[0] );
+ status |= unlink( "/file01" );
+ rtems_test_assert( status == 0 );
+
+ puts( "*** END OF TEST POSIX PIPE CREATION - 01 ***" );
+ 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 5
+
+#define CONFIGURE_MAXIMUM_TASKS 1
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_PIPES_ENABLED
+#define CONFIGURE_MAXIMUM_PIPES 2
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
+/* end of file */
diff --git a/testsuites/psxtests/psxpipe01/psxpipe01.doc b/testsuites/psxtests/psxpipe01/psxpipe01.doc
new file mode 100644
index 0000000000..df5a538dcb
--- /dev/null
+++ b/testsuites/psxtests/psxpipe01/psxpipe01.doc
@@ -0,0 +1,24 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989-2009.
+# 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: POSIX PIPE CREATION TEST
+
+directives:
+
++ pipe
++ pipe_create
+
+concepts:
+
++ Exercise the posix pipe creation routines, including the error paths
+
diff --git a/testsuites/psxtests/psxpipe01/psxpipe01.scn b/testsuites/psxtests/psxpipe01/psxpipe01.scn
new file mode 100644
index 0000000000..e4253e9df8
--- /dev/null
+++ b/testsuites/psxtests/psxpipe01/psxpipe01.scn
@@ -0,0 +1,8 @@
+*** TEST POSIX PIPE CREATION - 01 ***
+Init - attempt to create pipe -- expect EFAULT
+Init - create pipe -- OK
+Init - create pipe -- OK
+Init - attempt to create pipe -- expect ENOMEM
+Init - create pipe -- expect ENFILE
+Init - create pipe -- expect ENFILE
+*** END OF TEST POSIX PIPE CREATION - 01 ***