source: rtems/testsuites/fstests/fsimfsconfig01/init.c @ 249766c5

4.115
Last change on this file since 249766c5 was 249766c5, checked in by Sebastian Huber <sebastian.huber@…>, on 02/13/15 at 20:26:17

IMFS: Rename CONFIGURE_IMFS_DISABLE_FCHMOD

Rename CONFIGURE_IMFS_DISABLE_FCHMOD to CONFIGURE_IMFS_DISABLE_CHMOD.

  • Property mode set to 100644
File size: 3.4 KB
Line 
1/*
2 * Copyright (c) 2015 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Dornierstr. 4
6 *  82178 Puchheim
7 *  Germany
8 *  <rtems@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15#ifdef HAVE_CONFIG_H
16  #include "config.h"
17#endif
18
19#include "tmacros.h"
20
21#include <sys/stat.h>
22#include <errno.h>
23#include <fcntl.h>
24#include <stdio.h>
25#include <unistd.h>
26#include <utime.h>
27
28#include <rtems/imfs.h>
29#include <rtems/libio.h>
30
31const char rtems_test_name[] = "FSIMFSCONFIG 1";
32
33static const IMFS_node_control node_control = IMFS_GENERIC_INITIALIZER(
34  &rtems_filesystem_handlers_default,
35  IMFS_node_initialize_generic,
36  IMFS_node_destroy_default
37);
38
39static void Init(rtems_task_argument arg)
40{
41  struct utimbuf times;
42  const char *generic = "generic";
43  const char *mnt = "mnt";
44  const char *dev = "device";
45  const char *file = "file";
46  const char *fifo = "fifo";
47  int rv;
48  int fd;
49
50  TEST_BEGIN();
51
52  rv = IMFS_make_generic_node(
53    generic,
54    S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO,
55    &node_control,
56    NULL
57  );
58  rtems_test_assert(rv == 0);
59
60  errno = 0;
61  rv = chown(generic, 0, 0);
62  rtems_test_assert(rv == -1);
63  rtems_test_assert(errno == ENOTSUP);
64
65  errno = 0;
66  rv = chmod(generic, 0);
67  rtems_test_assert(rv == -1);
68  rtems_test_assert(errno == ENOTSUP);
69
70  errno = 0;
71  rv = link(generic, "link");
72  rtems_test_assert(rv == -1);
73  rtems_test_assert(errno == ENOTSUP);
74
75  rv = mkdir(mnt, S_IRWXU);
76  rtems_test_assert(rv == 0);
77
78  rv = mknod(dev, S_IFCHR | S_IRWXU, 0);
79  rtems_test_assert(rv == 0);
80
81  errno = 0;
82  fd = creat(file, S_IRWXU);
83  rtems_test_assert(fd == -1);
84  rtems_test_assert(errno == ENOSYS);
85
86  errno = 0;
87  rv = mkfifo(fifo, S_IRWXU);
88  rtems_test_assert(rv == -1);
89  rtems_test_assert(errno == ENOSYS);
90
91  errno = 0;
92  rv = mount(
93    "",
94    mnt,
95    RTEMS_FILESYSTEM_TYPE_IMFS,
96    RTEMS_FILESYSTEM_READ_ONLY,
97    NULL
98  );
99  rtems_test_assert(rv == -1);
100  rtems_test_assert(errno == ENOTSUP);
101
102  errno = 0;
103  rv = rename(generic, "new");
104  rtems_test_assert(rv == -1);
105  rtems_test_assert(errno == ENOTSUP);
106
107  errno = 0;
108  rv = symlink(generic, "link");
109  rtems_test_assert(rv == -1);
110  rtems_test_assert(errno == ENOTSUP);
111
112  errno = 0;
113  rv = utime(generic, &times);
114  rtems_test_assert(rv == -1);
115  rtems_test_assert(errno == ENOTSUP);
116
117  errno = 0;
118  rv = unlink(generic);
119  rtems_test_assert(rv == -1);
120  rtems_test_assert(errno == ENOTSUP);
121
122  TEST_END();
123  rtems_test_exit(0);
124}
125
126#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
127#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
128
129#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4
130
131#define CONFIGURE_FILESYSTEM_IMFS
132
133#define CONFIGURE_IMFS_DISABLE_CHOWN
134#define CONFIGURE_IMFS_DISABLE_CHMOD
135#define CONFIGURE_IMFS_DISABLE_LINK
136
137#if 0
138/*
139 * This would lead to a fatal error since rtems_filesystem_initialize() creates
140 * a "/dev" directory.
141 */
142#define CONFIGURE_IMFS_DISABLE_MKNOD
143#endif
144
145#define CONFIGURE_IMFS_DISABLE_MKNOD_FILE
146#define CONFIGURE_IMFS_DISABLE_MOUNT
147#define CONFIGURE_IMFS_DISABLE_RENAME
148#define CONFIGURE_IMFS_DISABLE_RMNOD
149#define CONFIGURE_IMFS_DISABLE_SYMLINK
150#define CONFIGURE_IMFS_DISABLE_UTIME
151
152#define CONFIGURE_MAXIMUM_TASKS 1
153
154#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
155
156#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
157
158#define CONFIGURE_INIT
159
160#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.