From c275f71b394085318ba9d41858adb69ef1e85886 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 15 Jul 2010 13:53:28 +0000 Subject: 2010-07-15 Bharath Suri 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. --- testsuites/sptests/ChangeLog | 9 ++ testsuites/sptests/Makefile.am | 2 +- testsuites/sptests/configure.ac | 1 + testsuites/sptests/spmountmgr01/.cvsignore | 2 + testsuites/sptests/spmountmgr01/Makefile.am | 26 ++++++ testsuites/sptests/spmountmgr01/init.c | 105 +++++++++++++++++++++++ testsuites/sptests/spmountmgr01/spmountmgr01.doc | 25 ++++++ testsuites/sptests/spmountmgr01/spmountmgr01.scn | 14 +++ 8 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 testsuites/sptests/spmountmgr01/.cvsignore create mode 100644 testsuites/sptests/spmountmgr01/Makefile.am create mode 100644 testsuites/sptests/spmountmgr01/init.c create mode 100644 testsuites/sptests/spmountmgr01/spmountmgr01.doc create mode 100644 testsuites/sptests/spmountmgr01/spmountmgr01.scn (limited to 'testsuites/sptests') diff --git a/testsuites/sptests/ChangeLog b/testsuites/sptests/ChangeLog index 5c665caad0..ffd0afd637 100644 --- a/testsuites/sptests/ChangeLog +++ b/testsuites/sptests/ChangeLog @@ -1,3 +1,12 @@ +2010-07-15 Bharath Suri + + 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. + 2010-07-14 Joel Sherrill * spprintk/init.c, spprintk/spprintk.doc, spprintk/spprintk.scn: Clean diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am index b7f0d9b5bb..42ddec6efb 100644 --- a/testsuites/sptests/Makefile.am +++ b/testsuites/sptests/Makefile.am @@ -28,7 +28,7 @@ SUBDIRS = \ spintrcritical05 spintrcritical06 spintrcritical07 spintrcritical08 \ spintrcritical09 spintrcritical10 spintrcritical11 spintrcritical12 \ spintrcritical13 spintrcritical14 spintrcritical15 spintrcritical16 \ - spintrcritical17 spmkdir + spintrcritical17 spmkdir spmountmgr01 DIST_SUBDIRS = $(SUBDIRS) spfatal_support spintrcritical_support EXTRA_DIST = spfatal_support/init.c spfatal_support/system.h diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac index c8430891f9..d6b622a7e7 100644 --- a/testsuites/sptests/configure.ac +++ b/testsuites/sptests/configure.ac @@ -149,6 +149,7 @@ spintrcritical15/Makefile spintrcritical16/Makefile spintrcritical17/Makefile spmkdir/Makefile +spmountmgr01/Makefile spnotepad01/Makefile spobjgetnext/Makefile spprintk/Makefile 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 +#include "test_support.h" +#include +#include +#include + +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 +/* 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 *** -- cgit v1.2.3