source: rtems/testsuites/fstests/fsimfsconfig03/init.c @ 3cec2df

5
Last change on this file since 3cec2df was 3cec2df, checked in by Sebastian Huber <sebastian.huber@…>, on 12/17/19 at 08:17:43

config: CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS

Rename CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS into
CONFIGURE_MAXIMUM_FILE_DESCRIPTORS.

Update #3753.

  • Property mode set to 100644
File size: 2.9 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 3";
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  fd = creat(file, S_IRWXU);
82  rtems_test_assert(fd == 0);
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
92  rv = mount(
93    "",
94    mnt,
95    RTEMS_FILESYSTEM_TYPE_IMFS,
96    RTEMS_FILESYSTEM_READ_ONLY,
97    NULL
98  );
99  rtems_test_assert(rv == 0);
100
101  errno = 0;
102  rv = unmount(mnt);
103  rtems_test_assert(rv == -1);
104  rtems_test_assert(errno == ENOTSUP);
105
106  errno = 0;
107  rv = rename(generic, "new");
108  rtems_test_assert(rv == -1);
109  rtems_test_assert(errno == ENOTSUP);
110
111  errno = 0;
112  rv = symlink(generic, "link");
113  rtems_test_assert(rv == -1);
114  rtems_test_assert(errno == ENOTSUP);
115
116  errno = 0;
117  rv = utime(generic, &times);
118  rtems_test_assert(rv == -1);
119  rtems_test_assert(errno == ENOTSUP);
120
121  rv = unlink(generic);
122  rtems_test_assert(rv == 0);
123
124  TEST_END();
125  rtems_test_exit(0);
126}
127
128#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
129
130#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 1
131
132#define CONFIGURE_FILESYSTEM_IMFS
133
134#define CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM
135
136#define CONFIGURE_MAXIMUM_TASKS 1
137
138#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
139
140#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
141
142#define CONFIGURE_INIT
143
144#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.