diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-07-29 22:40:50 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-07-29 22:40:50 +0000 |
commit | d08ba49ea2f678113a09ce0bcea0f1091cd09c82 (patch) | |
tree | 16161598b8a7e9c5132122d73131fbbf9c03822c /testsuites/psxtests | |
parent | 2010-07-29 Bharath Suri <bharath.s.jois@gmail.com> (diff) | |
download | rtems-d08ba49ea2f678113a09ce0bcea0f1091cd09c82.tar.bz2 |
2010-07-29 Bharath Suri <bharath.s.jois@gmail.com>
PR 1642/testing
* psximfs02/init.c, psximfs02/psximfs02.scn,
psximfs02/psximfs02.doc, psximfs02/Makefile.am: New test added.
* configure.ac, Makefile.am: Changes to accommodate psximfs02
test.
Diffstat (limited to 'testsuites/psxtests')
-rw-r--r-- | testsuites/psxtests/ChangeLog | 8 | ||||
-rw-r--r-- | testsuites/psxtests/Makefile.am | 4 | ||||
-rw-r--r-- | testsuites/psxtests/configure.ac | 1 | ||||
-rw-r--r-- | testsuites/psxtests/psximfs02/.cvsignore | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psximfs02/Makefile.am | 24 | ||||
-rw-r--r-- | testsuites/psxtests/psximfs02/init.c | 153 | ||||
-rw-r--r-- | testsuites/psxtests/psximfs02/psximfs02.doc | 28 | ||||
-rw-r--r-- | testsuites/psxtests/psximfs02/psximfs02.scn | 37 |
8 files changed, 255 insertions, 2 deletions
diff --git a/testsuites/psxtests/ChangeLog b/testsuites/psxtests/ChangeLog index 584d178b29..76e1b7963b 100644 --- a/testsuites/psxtests/ChangeLog +++ b/testsuites/psxtests/ChangeLog @@ -1,5 +1,13 @@ 2010-07-29 Bharath Suri <bharath.s.jois@gmail.com> + PR 1642/testing + * psximfs02/init.c, psximfs02/psximfs02.scn, + psximfs02/psximfs02.doc, psximfs02/Makefile.am: New test added. + * configure.ac, Makefile.am: Changes to accommodate psximfs02 + test. + +2010-07-29 Bharath Suri <bharath.s.jois@gmail.com> + PR 1633/testing * psximfs01/init.c, psximfs01/psximfs01.scn, psximfs01/psximfs01.doc: New cases to exercise diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am index 287112c5a8..a26cbfd445 100644 --- a/testsuites/psxtests/Makefile.am +++ b/testsuites/psxtests/Makefile.am @@ -20,8 +20,8 @@ endif ## File IO tests SUBDIRS += psxfile01 psxfile02 psxfilelock01 psxgetrusage01 psxid01 \ - psximfs01 psxreaddir psxstat psxmount psx13 psxchroot01 psxpasswd01 \ - psxpasswd02 psxpipe01 psxtimes01 psxfchx01 + psximfs01 psximfs02 psxreaddir psxstat psxmount psx13 psxchroot01 \ + psxpasswd01 psxpasswd02 psxpipe01 psxtimes01 psxfchx01 ## 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 9645969e3b..851ecc205e 100644 --- a/testsuites/psxtests/configure.ac +++ b/testsuites/psxtests/configure.ac @@ -94,6 +94,7 @@ psxgetrusage01/Makefile psxhdrs/Makefile psxid01/Makefile psximfs01/Makefile +psximfs02/Makefile psxintrcritical01/Makefile psxitimer/Makefile psxkey01/Makefile diff --git a/testsuites/psxtests/psximfs02/.cvsignore b/testsuites/psxtests/psximfs02/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/psxtests/psximfs02/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/psxtests/psximfs02/Makefile.am b/testsuites/psxtests/psximfs02/Makefile.am new file mode 100644 index 0000000000..6e8ffe5325 --- /dev/null +++ b/testsuites/psxtests/psximfs02/Makefile.am @@ -0,0 +1,24 @@ +## +## $Id$ +## + +rtems_tests_PROGRAMS = psximfs02 +psximfs02_SOURCES = init.c + +dist_rtems_tests_DATA = psximfs02.scn +dist_rtems_tests_DATA += psximfs02.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 = $(psximfs02_OBJECTS) $(psximfs02_LDADD) +LINK_LIBS = $(psximfs02_LDLIBS) + +psximfs02$(EXEEXT): $(psximfs02_OBJECTS) $(psximfs02_DEPENDENCIES) + @rm -f psximfs02$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/psxtests/psximfs02/init.c b/testsuites/psxtests/psximfs02/init.c new file mode 100644 index 0000000000..1454cd1a3e --- /dev/null +++ b/testsuites/psxtests/psximfs02/init.c @@ -0,0 +1,153 @@ +/* + * 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 <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <errno.h> +#include <rtems/libio.h> + +extern Heap_Control *RTEMS_Malloc_Heap; + +rtems_task Init( + rtems_task_argument argument +) +{ + int status = 0; + void *alloc_ptr = (void *)0; + Heap_Information_block Info; + char linkname_n[20] = {0}; + char linkname_p[20] = {0}; + int i; + struct stat stat_buf; + + puts( "\n\n*** TEST IMFS 02 ***" ); + + puts( "Creating directory /dir00" ); + status = mkdir( "/dir00", S_IRWXU ); + rtems_test_assert( status == 0 ); + + puts( "Creating directory /dir00/dir01" ); + status = mkdir( "/dir00/dir01", S_IRWXU ); + rtems_test_assert( status == 0 ); + + puts( "Changing directory to /dir00" ); + status = chdir( "/dir00" ); + rtems_test_assert( status == 0 ); + + puts( "Creating link dir01-link0 for dir01" ); + status = link( "dir01", "dir01-link0" ); + rtems_test_assert( status == 0 ); + + for( i = 1 ; ; ++i ) { + sprintf( linkname_p, "dir01-link%d", i-1 ); + sprintf( linkname_n, "dir01-link%d", i ); + printf( "\nCreating link %s for %s\n", linkname_n, linkname_p ); + status = link( linkname_p, linkname_n ); + if( status != 0 ) { + puts("Link creation failed" ); + break; + } + } + + puts( "Creating a regular node /node, RDONLY" ); + status = mknod( "/node", S_IFREG | S_IRUSR, 0LL ); + rtems_test_assert( status == 0 ); + + puts( "Creating link /node-link for /node" ); + status = link( "/node" , "/node-link" ); + rtems_test_assert( status == 0 ); + + puts( "Opening /node-link in WRONLY mode -- expect EACCES" ); + status = open( "/node-link", O_WRONLY ); + rtems_test_assert( status == -1 ); + rtems_test_assert( errno == EACCES ); + + puts( "Creating a symlink /node-slink for /node" ); + status = symlink( "/node" , "/node-slink" ); + rtems_test_assert( status == 0 ); + + puts( "Opening /node-slink in WRONLY mode -- expect EACCES" ); + status = open( "/node-slink", O_WRONLY ); + rtems_test_assert( status == -1 ); + rtems_test_assert( errno == EACCES ); + + puts( "Allocate most of heap" ); + _Heap_Get_information( RTEMS_Malloc_Heap, &Info ); + alloc_ptr = malloc( Info.Free.largest - 150 ); + + puts( "Attempt to mount a fs at /dir01 -- expect ENOMEM" ); + status = mount( NULL, + "dir01", + "imfs", + RTEMS_FILESYSTEM_READ_WRITE, + NULL ); + rtems_test_assert( status == -1 ); + rtems_test_assert( errno == ENOMEM ); + + puts( "Freeing allocated memory" ); + free( alloc_ptr ); + + puts( "Allocate most of heap" ); + _Heap_Get_information( RTEMS_Malloc_Heap, &Info ); + alloc_ptr = malloc( Info.Free.largest - 4 ); + + puts( "Changing directory to /" ); + status = chdir( "/" ); + rtems_test_assert( status == 0 ); + + puts( "Attempt to create /node-link-2 for /node -- expect ENOMEM" ); + status = link( "/node", "/node-link-2" ); + rtems_test_assert( status == -1 ); + rtems_test_assert( errno == ENOMEM ); + + puts( "Attempt to create /node-slink-2 for /node -- expect ENOMEM" ); + status = symlink( "/node", "node-slink-2" ); + rtems_test_assert( status == -1 ); + rtems_test_assert( errno == ENOMEM ); + + puts( "Freeing allocated memory" ); + free( alloc_ptr ); + + puts( "Allocate most of heap" ); + alloc_ptr = malloc( Info.Free.largest - 40 ); + + puts( "Attempt to create /node-slink-2 for /node -- expect ENOMEM" ); + status = symlink( "/node", "node-slink-2" ); + rtems_test_assert( status == -1 ); + rtems_test_assert( errno == ENOMEM ); + + puts( "Attempt to stat a hardlink -- expect ENOTSUP" ); + status = lstat( "/node-link", &stat_buf ); + rtems_test_assert( status == -1 ); + rtems_test_assert( errno == ENOTSUP ); + + puts( "*** END OF TEST IMFS 02 ***" ); + 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_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4 +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> +/* end of file */ diff --git a/testsuites/psxtests/psximfs02/psximfs02.doc b/testsuites/psxtests/psximfs02/psximfs02.doc new file mode 100644 index 0000000000..7596b68908 --- /dev/null +++ b/testsuites/psxtests/psximfs02/psximfs02.doc @@ -0,0 +1,28 @@ +# +# $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: psximfs02 + +directives: + + + mkdir + + link + + mknod + + open + + symlink + + mount + + lstat + +concepts: + ++ A above calls exercise the IMFS routines, mostly error paths. diff --git a/testsuites/psxtests/psximfs02/psximfs02.scn b/testsuites/psxtests/psximfs02/psximfs02.scn new file mode 100644 index 0000000000..c225d5cc49 --- /dev/null +++ b/testsuites/psxtests/psximfs02/psximfs02.scn @@ -0,0 +1,37 @@ +*** TEST IMFS 02 *** +Creating directory /dir00 +Creating directory /dir00/dir01 +Changing directory to /dir00 +Creating link dir01-link0 for dir01 + +Creating link dir01-link1 for dir01-link0 + +Creating link dir01-link2 for dir01-link1 + +Creating link dir01-link3 for dir01-link2 + +Creating link dir01-link4 for dir01-link3 + +Creating link dir01-link5 for dir01-link4 + +Creating link dir01-link6 for dir01-link5 + +Creating link dir01-link7 for dir01-link6 +Link creation failed +Creating a regular node /node, RDONLY +Creating link /node-link for /node +Opening /node-link in WRONLY mode -- expect EACCES +Creating a symlink /node-slink for /node +Opening /node-slink in WRONLY mode -- expect EACCES +Allocate most of heap +Attempt to mount a fs at /dir01 -- expect ENOMEM +Freeing allocated memory +Allocate most of heap +Changing directory to / +Attempt to create /node-link-2 for /node -- expect ENOMEM +Attempt to create /node-slink-2 for /node -- expect ENOMEM +Freeing allocated memory +Allocate most of heap +Attempt to create /node-slink-2 for /node -- expect ENOMEM +Attempt to stat a hardlink -- expect ENOTSUP +*** END OF TEST IMFS 02 *** |