source: rtems/testsuites/sptests/spmountmgr01/init.c @ 3c8eda7

4.115
Last change on this file since 3c8eda7 was 3c8eda7, checked in by Joel Sherrill <joel.sherrill@…>, on 05/12/12 at 16:01:26

sptests - Eliminate missing prototype warnings

  • Property mode set to 100644
File size: 3.7 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
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include <tmacros.h>
15#include "test_support.h"
16#include <errno.h>
17#include <rtems/libio_.h>
18#include <rtems/libcsupport.h>
19
20/* forward declarations to avoid warnings */
21rtems_task Init(rtems_task_argument argument);
22int fs_mount(
23  rtems_filesystem_mount_table_entry_t *mt_entry,
24  const void                           *data
25);
26
27int fs_mount(
28  rtems_filesystem_mount_table_entry_t *mt_entry,
29  const void                           *data
30)
31{
32  return 0;
33}
34
35rtems_task Init(
36  rtems_task_argument argument
37)
38{
39  int status = 0;
40  void *alloc_ptr = (void *)0;
41
42  puts( "\n\n*** TEST MOUNT MANAGER ROUTINE - 01 ***" );
43
44  puts( "Init - allocating most of heap -- OK" );
45  alloc_ptr = malloc( malloc_free_space() - 4 );
46  rtems_test_assert( alloc_ptr != NULL );
47
48  puts( "Init - attempt to register filesystem fs - expect ENOMEM" );
49  status = rtems_filesystem_register( "fs", fs_mount );
50  rtems_test_assert( status == -1 );
51  rtems_test_assert( errno == ENOMEM );
52
53  puts( "Init - freeing allocated memory -- OK" );
54  free( alloc_ptr );
55
56  puts( "Init - register filesystem fs -- OK" );
57  status = rtems_filesystem_register( "fs", fs_mount );
58  rtems_test_assert( status == 0 );
59
60  puts( "Init - attempt to make target(NULL) and mount - expect EINVAL" );
61  status = mount_and_make_target_path(
62             NULL,
63             NULL,
64             "fs",
65             0,
66             NULL );
67  rtems_test_assert( status == -1 );
68  rtems_test_assert( errno == EINVAL );
69
70  puts( "Init - attempt to make target and mount - expect EINVAL" );
71  status = mount_and_make_target_path(
72             NULL,
73             "/tmp",
74             "fs",
75             2,
76             NULL );
77  rtems_test_assert( status == -1 );
78  rtems_test_assert( errno == EINVAL );
79
80  puts( "Init - register filesystem fs - expect EINVAL" );
81  status = rtems_filesystem_register( "fs", fs_mount );
82  rtems_test_assert( status == -1 );
83  rtems_test_assert( errno == EINVAL );
84
85  puts( "Init - register filesystem bfs -- OK" );
86  status = rtems_filesystem_register( "bfs", fs_mount );
87  rtems_test_assert( status == 0 );
88
89  puts( "Init - register filesystem bfs - expect EINVAL" );
90  status = rtems_filesystem_register( "bfs", fs_mount );
91  rtems_test_assert( status == -1 );
92  rtems_test_assert( errno == EINVAL );
93
94  puts( "Init - attempt to unregister with bad args - expect EINVAL" );
95  status = rtems_filesystem_unregister( NULL );
96  rtems_test_assert( status == -1 );
97  rtems_test_assert( errno == EINVAL );
98
99  puts( "Init - attempt to unregister fs -- OK" );
100  status = rtems_filesystem_unregister( "fs" );
101  rtems_test_assert( status == 0 );
102
103  puts( "Init - attempt to unregister fs again - expect ENOENT" );
104  status = rtems_filesystem_unregister( "fs" );
105  rtems_test_assert( status == -1 );
106  rtems_test_assert( errno == ENOENT );
107
108  puts( "Init - attempt to unregister bfs -- OK" );
109  status = rtems_filesystem_unregister( "bfs" );
110  rtems_test_assert( status == 0 );
111
112  puts( "Init - attempt to unregister bfs again - expect ENOENT" );
113  status = rtems_filesystem_unregister( "bfs" );
114  rtems_test_assert( status == -1 );
115  rtems_test_assert( errno == ENOENT );
116
117  puts( "*** END OF TEST MOUNT MANAGER ROUTINE - 01 ***" );
118  rtems_test_exit(0);
119}
120
121/* configuration information */
122
123#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
124#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
125
126#define CONFIGURE_MAXIMUM_TASKS             1
127#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
128
129#define CONFIGURE_INIT
130
131#include <rtems/confdefs.h>
132/* end of file */
Note: See TracBrowser for help on using the repository browser.