source: rtems/testsuites/fstests/fsimfsconfig03/init.c @ acc9d064

5
Last change on this file since acc9d064 was acc9d064, checked in by Sebastian Huber <sebastian.huber@…>, on 10/26/17 at 11:59:10

tests: Remove obsolete TESTS_USE_PRINTK

Update #3170.
Update #3199.

  • Property mode set to 100644
File size: 2.9 KB
RevLine 
[12eee4fd]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
[98c6d50]19#define TEST_INIT
20
[12eee4fd]21#include "tmacros.h"
22
23#include <sys/stat.h>
24#include <errno.h>
25#include <fcntl.h>
26#include <stdio.h>
27#include <unistd.h>
28#include <utime.h>
29
30#include <rtems/imfs.h>
31#include <rtems/libio.h>
32
33const char rtems_test_name[] = "FSIMFSCONFIG 3";
34
35static const IMFS_node_control node_control = IMFS_GENERIC_INITIALIZER(
36  &rtems_filesystem_handlers_default,
37  IMFS_node_initialize_generic,
38  IMFS_node_destroy_default
39);
40
41static void Init(rtems_task_argument arg)
42{
43  struct utimbuf times;
44  const char *generic = "generic";
45  const char *mnt = "mnt";
46  const char *dev = "device";
47  const char *file = "file";
48  const char *fifo = "fifo";
49  int rv;
50  int fd;
51
52  TEST_BEGIN();
53
54  rv = IMFS_make_generic_node(
55    generic,
56    S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO,
57    &node_control,
58    NULL
59  );
60  rtems_test_assert(rv == 0);
61
62  errno = 0;
63  rv = chown(generic, 0, 0);
64  rtems_test_assert(rv == -1);
65  rtems_test_assert(errno == ENOTSUP);
66
67  errno = 0;
68  rv = chmod(generic, 0);
69  rtems_test_assert(rv == -1);
70  rtems_test_assert(errno == ENOTSUP);
71
72  errno = 0;
73  rv = link(generic, "link");
74  rtems_test_assert(rv == -1);
75  rtems_test_assert(errno == ENOTSUP);
76
77  rv = mkdir(mnt, S_IRWXU);
78  rtems_test_assert(rv == 0);
79
80  rv = mknod(dev, S_IFCHR | S_IRWXU, 0);
81  rtems_test_assert(rv == 0);
82
83  fd = creat(file, S_IRWXU);
[caf4064]84  rtems_test_assert(fd == 0);
[12eee4fd]85
86  rv = close(fd);
87  rtems_test_assert(rv == 0);
88
89  errno = 0;
90  rv = mkfifo(fifo, S_IRWXU);
91  rtems_test_assert(rv == -1);
92  rtems_test_assert(errno == ENOSYS);
93
94  rv = mount(
95    "",
96    mnt,
97    RTEMS_FILESYSTEM_TYPE_IMFS,
98    RTEMS_FILESYSTEM_READ_ONLY,
99    NULL
100  );
101  rtems_test_assert(rv == 0);
102
103  errno = 0;
104  rv = unmount(mnt);
105  rtems_test_assert(rv == -1);
106  rtems_test_assert(errno == ENOTSUP);
107
108  errno = 0;
109  rv = rename(generic, "new");
110  rtems_test_assert(rv == -1);
111  rtems_test_assert(errno == ENOTSUP);
112
113  errno = 0;
114  rv = symlink(generic, "link");
115  rtems_test_assert(rv == -1);
116  rtems_test_assert(errno == ENOTSUP);
117
118  errno = 0;
119  rv = utime(generic, &times);
120  rtems_test_assert(rv == -1);
121  rtems_test_assert(errno == ENOTSUP);
122
123  rv = unlink(generic);
124  rtems_test_assert(rv == 0);
125
126  TEST_END();
127  rtems_test_exit(0);
128}
129
130#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
131
[caf4064]132#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 1
[12eee4fd]133
134#define CONFIGURE_FILESYSTEM_IMFS
135
136#define CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM
137
138#define CONFIGURE_MAXIMUM_TASKS 1
139
140#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
141
142#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
143
144#define CONFIGURE_INIT
145
146#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.