forked from Imagelibrary/rtems
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.
This commit is contained in:
@@ -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>
|
2010-07-14 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||||
|
|
||||||
* spprintk/init.c, spprintk/spprintk.doc, spprintk/spprintk.scn: Clean
|
* spprintk/init.c, spprintk/spprintk.doc, spprintk/spprintk.scn: Clean
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ SUBDIRS = \
|
|||||||
spintrcritical05 spintrcritical06 spintrcritical07 spintrcritical08 \
|
spintrcritical05 spintrcritical06 spintrcritical07 spintrcritical08 \
|
||||||
spintrcritical09 spintrcritical10 spintrcritical11 spintrcritical12 \
|
spintrcritical09 spintrcritical10 spintrcritical11 spintrcritical12 \
|
||||||
spintrcritical13 spintrcritical14 spintrcritical15 spintrcritical16 \
|
spintrcritical13 spintrcritical14 spintrcritical15 spintrcritical16 \
|
||||||
spintrcritical17 spmkdir
|
spintrcritical17 spmkdir spmountmgr01
|
||||||
|
|
||||||
DIST_SUBDIRS = $(SUBDIRS) spfatal_support spintrcritical_support
|
DIST_SUBDIRS = $(SUBDIRS) spfatal_support spintrcritical_support
|
||||||
EXTRA_DIST = spfatal_support/init.c spfatal_support/system.h
|
EXTRA_DIST = spfatal_support/init.c spfatal_support/system.h
|
||||||
|
|||||||
@@ -149,6 +149,7 @@ spintrcritical15/Makefile
|
|||||||
spintrcritical16/Makefile
|
spintrcritical16/Makefile
|
||||||
spintrcritical17/Makefile
|
spintrcritical17/Makefile
|
||||||
spmkdir/Makefile
|
spmkdir/Makefile
|
||||||
|
spmountmgr01/Makefile
|
||||||
spnotepad01/Makefile
|
spnotepad01/Makefile
|
||||||
spobjgetnext/Makefile
|
spobjgetnext/Makefile
|
||||||
spprintk/Makefile
|
spprintk/Makefile
|
||||||
|
|||||||
2
testsuites/sptests/spmountmgr01/.cvsignore
Normal file
2
testsuites/sptests/spmountmgr01/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
26
testsuites/sptests/spmountmgr01/Makefile.am
Normal file
26
testsuites/sptests/spmountmgr01/Makefile.am
Normal file
@@ -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
|
||||||
105
testsuites/sptests/spmountmgr01/init.c
Normal file
105
testsuites/sptests/spmountmgr01/init.c
Normal file
@@ -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 */
|
||||||
25
testsuites/sptests/spmountmgr01/spmountmgr01.doc
Normal file
25
testsuites/sptests/spmountmgr01/spmountmgr01.doc
Normal file
@@ -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.
|
||||||
14
testsuites/sptests/spmountmgr01/spmountmgr01.scn
Normal file
14
testsuites/sptests/spmountmgr01/spmountmgr01.scn
Normal file
@@ -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 ***
|
||||||
Reference in New Issue
Block a user