source: rtems/testsuites/sptests/spmountmgr01/init.c @ 917e4b4

4.115
Last change on this file since 917e4b4 was 917e4b4, checked in by Joel Sherrill <joel.sherrill@…>, on 07/16/10 at 15:01:11

2010-07-16 Bharath Suri <bharath.s.jois@…>

PR 1617/testing

  • spmountmgr01/init.c, spmountmgr01/spmountmgr01.scn, spmountmgr01/spmountmgr01.doc: Added cases to exercise mount-mktgt.c.
  • Property mode set to 100644
File size: 3.6 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2010.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#include <tmacros.h>
13#include "test_support.h"
14#include <rtems/score/heap.h>
15#include <errno.h>
16#include <rtems/libio_.h>
17
18extern Heap_Control  *RTEMS_Malloc_Heap;
19
20int fs_mount( rtems_filesystem_mount_table_entry_t *mt_entry,
21              const void                           *data )
22{
23  return 0;
24}
25
26rtems_task Init(
27  rtems_task_argument argument
28)
29{
30  int status = 0;
31  void *alloc_ptr = (void *)0;
32  Heap_Information_block Info;
33 
34  puts( "\n\n*** TEST MOUNT MANAGER ROUTINE - 01 ***" );
35
36  puts( "Init - allocating most of heap -- OK" );
37  _Heap_Get_information(RTEMS_Malloc_Heap, &Info);
38  alloc_ptr = malloc( Info.Free.largest - 4 );
39  rtems_test_assert( alloc_ptr != NULL );
40
41  puts( "Init - attempt to register filesystem fs - expect ENOMEM" );
42  status = rtems_filesystem_register( "fs", fs_mount );
43  rtems_test_assert( status == -1 );
44  rtems_test_assert( errno == ENOMEM );
45
46  puts( "Init - freeing allocated memory -- OK" );
47  free( alloc_ptr );
48
49  puts( "Init - register filesystem fs -- OK" );
50  status = rtems_filesystem_register( "fs", fs_mount );
51  rtems_test_assert( status == 0 );
52
53  puts( "Init - attempt to make target(NULL) and mount - expect EINVAL" );
54  status = mount_and_make_target_path(
55             NULL,
56             NULL,
57             "fs",
58             0,
59             NULL );
60  rtems_test_assert( status == -1 );
61  rtems_test_assert( errno == EINVAL );
62
63  puts( "Init - attempt to make target and mount - expect EINVAL" );
64  status = mount_and_make_target_path(
65             NULL,
66             "/tmp",
67             "fs",
68             2,
69             NULL );
70  rtems_test_assert( status == -1 );
71  rtems_test_assert( errno == EINVAL );
72
73             
74  puts( "Init - register filesystem fs - expect EINVAL" );
75  status = rtems_filesystem_register( "fs", fs_mount );
76  rtems_test_assert( status == -1 );
77  rtems_test_assert( errno == EINVAL );
78
79  puts( "Init - register filesystem bfs -- OK" );
80  status = rtems_filesystem_register( "bfs", fs_mount );
81  rtems_test_assert( status == 0 );
82
83  puts( "Init - register filesystem bfs - expect EINVAL" );
84  status = rtems_filesystem_register( "bfs", fs_mount );
85  rtems_test_assert( status == -1 );
86  rtems_test_assert( errno == EINVAL );
87 
88  puts( "Init - attempt to unregister with bad args - expect EINVAL" );
89  status = rtems_filesystem_unregister( NULL );
90  rtems_test_assert( status == -1 );
91  rtems_test_assert( errno == EINVAL );
92
93  puts( "Init - attempt to unregister fs -- OK" );
94  status = rtems_filesystem_unregister( "fs" );
95  rtems_test_assert( status == 0 );
96 
97  puts( "Init - attempt to unregister fs again - expect ENOENT" );
98  status = rtems_filesystem_unregister( "fs" );
99  rtems_test_assert( status == -1 );
100  rtems_test_assert( errno == ENOENT );
101
102  puts( "Init - attempt to unregister bfs -- OK" );
103  status = rtems_filesystem_unregister( "bfs" );
104  rtems_test_assert( status == 0 );
105 
106  puts( "Init - attempt to unregister bfs again - expect ENOENT" );
107  status = rtems_filesystem_unregister( "bfs" );
108  rtems_test_assert( status == -1 );
109  rtems_test_assert( errno == ENOENT );
110
111  puts( "*** END OF TEST MOUNT MANAGER ROUTINE - 01 ***" );
112  rtems_test_exit(0);
113}
114
115/* configuration information */
116
117#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
118#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
119
120#define CONFIGURE_MAXIMUM_TASKS             1
121#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
122
123#define CONFIGURE_INIT
124
125#include <rtems/confdefs.h>
126/* end of file */
Note: See TracBrowser for help on using the repository browser.