source: rtems/testsuites/fstests/fsimfsconfig01/init.c @ 12eee4fd

4.11
Last change on this file since 12eee4fd was 12eee4fd, checked in by Sebastian Huber <sebastian.huber@…>, on Feb 13, 2015 at 7:53:41 PM

IMFS: CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM

Resurrect CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM.

  • Property mode set to 100644
File size: 3.4 KB
RevLine 
[a9df916]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>
[12eee4fd]23#include <fcntl.h>
[a9df916]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";
[12eee4fd]44  const char *dev = "device";
45  const char *file = "file";
46  const char *fifo = "fifo";
[a9df916]47  int rv;
[12eee4fd]48  int fd;
[a9df916]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
[12eee4fd]78  rv = mknod(dev, S_IFCHR | S_IRWXU, 0);
79  rtems_test_assert(rv == 0);
80
81  fd = creat(file, S_IRWXU);
82  rtems_test_assert(fd == 3);
83
84  rv = close(fd);
85  rtems_test_assert(rv == 0);
86
87  errno = 0;
88  rv = mkfifo(fifo, S_IRWXU);
89  rtems_test_assert(rv == -1);
90  rtems_test_assert(errno == ENOSYS);
91
[a9df916]92  errno = 0;
93  rv = mount(
94    "",
95    mnt,
96    RTEMS_FILESYSTEM_TYPE_IMFS,
97    RTEMS_FILESYSTEM_READ_ONLY,
98    NULL
99  );
100  rtems_test_assert(rv == -1);
101  rtems_test_assert(errno == ENOTSUP);
102
103  errno = 0;
104  rv = rename(generic, "new");
105  rtems_test_assert(rv == -1);
106  rtems_test_assert(errno == ENOTSUP);
107
108  errno = 0;
[12eee4fd]109  rv = symlink(generic, "link");
[a9df916]110  rtems_test_assert(rv == -1);
111  rtems_test_assert(errno == ENOTSUP);
112
113  errno = 0;
[12eee4fd]114  rv = utime(generic, &times);
[a9df916]115  rtems_test_assert(rv == -1);
116  rtems_test_assert(errno == ENOTSUP);
117
118  errno = 0;
[12eee4fd]119  rv = unlink(generic);
[a9df916]120  rtems_test_assert(rv == -1);
121  rtems_test_assert(errno == ENOTSUP);
122
123  TEST_END();
124  rtems_test_exit(0);
125}
126
127#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
128#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
129
[12eee4fd]130#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4
131
[a9df916]132#define CONFIGURE_FILESYSTEM_IMFS
133
134#define CONFIGURE_IMFS_DISABLE_CHOWN
135#define CONFIGURE_IMFS_DISABLE_FCHMOD
136#define CONFIGURE_IMFS_DISABLE_LINK
137
138#if 0
139/*
140 * This would lead to a fatal error since rtems_filesystem_initialize() creates
141 * a "/dev" directory.
142 */
143#define CONFIGURE_IMFS_DISABLE_MKNOD
144#endif
145
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.