summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2010-07-15 13:53:28 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2010-07-15 13:53:28 +0000
commitc275f71b394085318ba9d41858adb69ef1e85886 (patch)
tree5a54c61b719aba3102780bf914fe8a22c2a46dc6 /testsuites/sptests
parent2010-07-15 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff)
downloadrtems-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')
-rw-r--r--testsuites/sptests/ChangeLog9
-rw-r--r--testsuites/sptests/Makefile.am2
-rw-r--r--testsuites/sptests/configure.ac1
-rw-r--r--testsuites/sptests/spmountmgr01/.cvsignore2
-rw-r--r--testsuites/sptests/spmountmgr01/Makefile.am26
-rw-r--r--testsuites/sptests/spmountmgr01/init.c105
-rw-r--r--testsuites/sptests/spmountmgr01/spmountmgr01.doc25
-rw-r--r--testsuites/sptests/spmountmgr01/spmountmgr01.scn14
8 files changed, 183 insertions, 1 deletions
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 <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.
+
2010-07-14 Joel Sherrill <joel.sherrill@oarcorp.com>
* 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 <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 ***