1 | /* |
---|
2 | * COPYRIGHT (c) 1989-2010. |
---|
3 | * On-Line Applications Research Corporation (OAR). |
---|
4 | * |
---|
5 | * Modifications to support reference counting in the file system are |
---|
6 | * Copyright (c) 2012 embedded brains GmbH. |
---|
7 | * |
---|
8 | * The license and distribution terms for this file may be |
---|
9 | * found in the file LICENSE in this distribution or at |
---|
10 | * http://www.rtems.com/license/LICENSE. |
---|
11 | */ |
---|
12 | |
---|
13 | #ifdef HAVE_CONFIG_H |
---|
14 | #include "config.h" |
---|
15 | #endif |
---|
16 | |
---|
17 | #include <tmacros.h> |
---|
18 | #include "test_support.h" |
---|
19 | #include <rtems/devfs.h> |
---|
20 | #include <errno.h> |
---|
21 | #include <unistd.h> |
---|
22 | #include <sys/types.h> |
---|
23 | #include <sys/stat.h> |
---|
24 | #include <fcntl.h> |
---|
25 | |
---|
26 | rtems_task Init( |
---|
27 | rtems_task_argument argument |
---|
28 | ) |
---|
29 | { |
---|
30 | int status; |
---|
31 | devFS_node nodes [1]; |
---|
32 | devFS_data data = { |
---|
33 | .nodes = nodes, |
---|
34 | .count = 1 |
---|
35 | }; |
---|
36 | |
---|
37 | puts( "\n\n*** TEST DEVFS03 ***" ); |
---|
38 | |
---|
39 | puts( "Init - attempt to create /dir01 -- OK" ); |
---|
40 | status = mkdir( "/dir01", S_IRWXU ); |
---|
41 | rtems_test_assert( status == 0 ); |
---|
42 | |
---|
43 | puts( "Init - mount a new fs at /dir01 - expect EINVAL" ); |
---|
44 | status = mount( NULL, |
---|
45 | "/dir01", |
---|
46 | "devfs", |
---|
47 | RTEMS_FILESYSTEM_READ_WRITE, |
---|
48 | NULL ); |
---|
49 | rtems_test_assert( status == -1 ); |
---|
50 | rtems_test_assert( errno == EINVAL ); |
---|
51 | |
---|
52 | puts( "Init - mount a new fs at /dir01 - OK" ); |
---|
53 | status = mount( NULL, |
---|
54 | "/dir01", |
---|
55 | "devfs", |
---|
56 | RTEMS_FILESYSTEM_READ_WRITE, |
---|
57 | &data ); |
---|
58 | rtems_test_assert( status == 0 ); |
---|
59 | |
---|
60 | puts( "Init - make file /dir01/dev -- expect ENOTSUP" ); |
---|
61 | status = creat( "/dir01/dev", S_IRWXU ); |
---|
62 | rtems_test_assert( status == -1 ); |
---|
63 | rtems_test_assert( errno == ENOTSUP ); |
---|
64 | |
---|
65 | puts( "Init - unmount fs at /dir01 - OK" ); |
---|
66 | status = unmount( "/dir01" ); |
---|
67 | rtems_test_assert( status == 0 ); |
---|
68 | |
---|
69 | status = rmdir( "/dir01" ); |
---|
70 | rtems_test_assert( status == 0 ); |
---|
71 | |
---|
72 | puts( "*** END OF TEST DEVFS03 ***" ); |
---|
73 | |
---|
74 | rtems_test_exit(0); |
---|
75 | } |
---|
76 | |
---|
77 | /* configuration information */ |
---|
78 | |
---|
79 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
80 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
81 | |
---|
82 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4 |
---|
83 | #define CONFIGURE_MAXIMUM_TASKS 1 |
---|
84 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
85 | |
---|
86 | #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM |
---|
87 | #define CONFIGURE_FILESYSTEM_DEVFS |
---|
88 | |
---|
89 | #define CONFIGURE_INIT |
---|
90 | #include <rtems/confdefs.h> |
---|
91 | /* end of file */ |
---|