diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-07-15 13:53:28 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-07-15 13:53:28 +0000 |
commit | c275f71b394085318ba9d41858adb69ef1e85886 (patch) | |
tree | 5a54c61b719aba3102780bf914fe8a22c2a46dc6 /testsuites/sptests/spmountmgr01 | |
parent | 2010-07-15 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff) | |
download | rtems-c275f71b394085318ba9d41858adb69ef1e85886.tar.bz2 |
2010-07-15 Bharath Suri <bharath.s.jois@gmail.com>
PR 1617/testing
* spmountmgr01/init.c, spmountmgr01/Makefile.am,
spmountmgr/.cvsignore, spmountmgr01/spmountmgr01.doc,
spmountmgr01/spmountmgr01.scn: New test which improves coverage
of mount-mgr.c under libcsupport.
* Makefile.am, configure.ac: Changes to accommodate the new test.
Diffstat (limited to 'testsuites/sptests/spmountmgr01')
-rw-r--r-- | testsuites/sptests/spmountmgr01/.cvsignore | 2 | ||||
-rw-r--r-- | testsuites/sptests/spmountmgr01/Makefile.am | 26 | ||||
-rw-r--r-- | testsuites/sptests/spmountmgr01/init.c | 105 | ||||
-rw-r--r-- | testsuites/sptests/spmountmgr01/spmountmgr01.doc | 25 | ||||
-rw-r--r-- | testsuites/sptests/spmountmgr01/spmountmgr01.scn | 14 |
5 files changed, 172 insertions, 0 deletions
diff --git a/testsuites/sptests/spmountmgr01/.cvsignore b/testsuites/sptests/spmountmgr01/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/sptests/spmountmgr01/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/sptests/spmountmgr01/Makefile.am b/testsuites/sptests/spmountmgr01/Makefile.am new file mode 100644 index 0000000000..b556d88208 --- /dev/null +++ b/testsuites/sptests/spmountmgr01/Makefile.am @@ -0,0 +1,26 @@ +## +## $Id$ +## + +MANAGERS = all + +rtems_tests_PROGRAMS = spmountmgr01 +spmountmgr01_SOURCES = init.c + +dist_rtems_tests_DATA = spmountmgr01.scn +dist_rtems_tests_DATA += spmountmgr01.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 = $(spmountmgr01_OBJECTS) $(spmountmgr01_LDADD) +LINK_LIBS = $(spmountmgr01_LDLIBS) + +spmountmgr01$(EXEEXT): $(spmountmgr01_OBJECTS) $(spmountmgr01_DEPENDENCIES) + @rm -f spmountmgr01$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/spmountmgr01/init.c b/testsuites/sptests/spmountmgr01/init.c new file mode 100644 index 0000000000..4e5b8a4282 --- /dev/null +++ b/testsuites/sptests/spmountmgr01/init.c @@ -0,0 +1,105 @@ +/* + * 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 <rtems/score/heap.h> +#include <errno.h> +#include <rtems/libio_.h> + +extern Heap_Control *RTEMS_Malloc_Heap; + +int fs_mount( rtems_filesystem_mount_table_entry_t *mt_entry, + const void *data ) +{ + return 0; +} + +rtems_task Init( + rtems_task_argument argument +) +{ + int status = 0; + void *alloc_ptr = (void *)0; + Heap_Information_block Info; + + puts( "\n\n*** TEST MOUNT MANAGER ROUTINE - 01 ***" ); + + puts( "Init - allocating most of heap -- OK" ); + _Heap_Get_information(RTEMS_Malloc_Heap, &Info); + alloc_ptr = malloc( Info.Free.largest - 4 ); + rtems_test_assert( alloc_ptr != NULL ); + + puts( "Init - attempt to register filesystem fs - expect ENOMEM" ); + status = rtems_filesystem_register( "fs", fs_mount ); + rtems_test_assert( status == -1 ); + rtems_test_assert( errno == ENOMEM ); + + puts( "Init - freeing allocated memory -- OK" ); + free( alloc_ptr ); + + puts( "Init - register filesystem fs -- OK" ); + status = rtems_filesystem_register( "fs", fs_mount ); + rtems_test_assert( status == 0 ); + + puts( "Init - register filesystem fs - expect EINVAL" ); + status = rtems_filesystem_register( "fs", fs_mount ); + rtems_test_assert( status == -1 ); + rtems_test_assert( errno == EINVAL ); + + puts( "Init - register filesystem bfs -- OK" ); + status = rtems_filesystem_register( "bfs", fs_mount ); + rtems_test_assert( status == 0 ); + + puts( "Init - register filesystem bfs - expect EINVAL" ); + status = rtems_filesystem_register( "bfs", fs_mount ); + rtems_test_assert( status == -1 ); + rtems_test_assert( errno == EINVAL ); + + puts( "Init - attempt to unregister with bad args - expect EINVAL" ); + status = rtems_filesystem_unregister( NULL ); + rtems_test_assert( status == -1 ); + rtems_test_assert( errno == EINVAL ); + + puts( "Init - attempt to unregister fs -- OK" ); + status = rtems_filesystem_unregister( "fs" ); + rtems_test_assert( status == 0 ); + + puts( "Init - attempt to unregister fs again - expect ENOENT" ); + status = rtems_filesystem_unregister( "fs" ); + rtems_test_assert( status == -1 ); + rtems_test_assert( errno == ENOENT ); + + puts( "Init - attempt to unregister bfs -- OK" ); + status = rtems_filesystem_unregister( "bfs" ); + rtems_test_assert( status == 0 ); + + puts( "Init - attempt to unregister bfs again - expect ENOENT" ); + status = rtems_filesystem_unregister( "bfs" ); + rtems_test_assert( status == -1 ); + rtems_test_assert( errno == ENOENT ); + + puts( "*** END OF TEST MOUNT MANAGER ROUTINE - 01 ***" ); + rtems_test_exit(0); +} + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> +/* end of file */ diff --git a/testsuites/sptests/spmountmgr01/spmountmgr01.doc b/testsuites/sptests/spmountmgr01/spmountmgr01.doc new file mode 100644 index 0000000000..f1dae4b7d4 --- /dev/null +++ b/testsuites/sptests/spmountmgr01/spmountmgr01.doc @@ -0,0 +1,25 @@ +# +# $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: spmountmgr01 + +directives: + ++ rtems_filesystem_register ++ rtems_filesystem_unregister + +concepts: + ++ Exercise the routines of mount-mgr.c under libcsupport. ++ These routines are mostly to register / unregister new filesytem + for later use. diff --git a/testsuites/sptests/spmountmgr01/spmountmgr01.scn b/testsuites/sptests/spmountmgr01/spmountmgr01.scn new file mode 100644 index 0000000000..d85166f354 --- /dev/null +++ b/testsuites/sptests/spmountmgr01/spmountmgr01.scn @@ -0,0 +1,14 @@ +*** TEST MOUNT MANAGER ROUTINE - 01 *** +Init - allocating most of heap -- OK +Init - attempt to register filesystem fs - expect ENOMEM +Init - freeing allocated memory -- OK +Init - register filesystem fs -- OK +Init - register filesystem fs - expect EINVAL +Init - register filesystem bfs -- OK +Init - register filesystem bfs - expect EINVAL +Init - attempt to unregister with bad args - expect EINVAL +Init - attempt to unregister fs -- OK +Init - attempt to unregister fs again - expect ENOENT +Init - attempt to unregister bfs -- OK +Init - attempt to unregister bfs again - expect ENOENT +*** END OF TEST MOUNT MANAGER ROUTINE - 01 *** |