1 | /* |
---|
2 | * Copyright (c) 2017 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 <sys/stat.h> |
---|
20 | #include <fcntl.h> |
---|
21 | #include <stdlib.h> |
---|
22 | #include <unistd.h> |
---|
23 | |
---|
24 | #include <rtems/dosfs.h> |
---|
25 | #include <rtems/ramdisk.h> |
---|
26 | |
---|
27 | #include "tmacros.h" |
---|
28 | |
---|
29 | const char rtems_test_name[] = "FSDOSFSNAME 2"; |
---|
30 | |
---|
31 | #define RAMDISK_PATH "/dev/rda" |
---|
32 | |
---|
33 | #define MOUNT_PATH "/mnt" |
---|
34 | |
---|
35 | static const char * const dir_paths[] = { |
---|
36 | MOUNT_PATH "/cpukit", |
---|
37 | MOUNT_PATH "/cpukit/or1k-exception-frame-print.c", |
---|
38 | MOUNT_PATH "/cpukit/preinstall.am", |
---|
39 | MOUNT_PATH "/cpukit/Makefile.in", |
---|
40 | MOUNT_PATH "/cpukit/Makefile.am", |
---|
41 | MOUNT_PATH "/cpukit/rtems", |
---|
42 | MOUNT_PATH "/cpukit/or1k-context-switch.S", |
---|
43 | MOUNT_PATH "/cpukit/or1k-exception-default.c", |
---|
44 | MOUNT_PATH "/cpukit/or1k-context-initialize.c", |
---|
45 | MOUNT_PATH "/cpukit/or1k-context-volatile-clobber.S", |
---|
46 | MOUNT_PATH "/cpukit/or1k-context-validate.S", |
---|
47 | MOUNT_PATH "/cpukit/or1k-exception-handler-low.S", |
---|
48 | MOUNT_PATH "/cpukit/cpu.c" |
---|
49 | }; |
---|
50 | |
---|
51 | static void test(void) |
---|
52 | { |
---|
53 | int rv; |
---|
54 | size_t i; |
---|
55 | |
---|
56 | rv = msdos_format(RAMDISK_PATH, NULL); |
---|
57 | rtems_test_assert(rv == 0); |
---|
58 | |
---|
59 | rv = mount_and_make_target_path( |
---|
60 | RAMDISK_PATH, |
---|
61 | MOUNT_PATH, |
---|
62 | RTEMS_FILESYSTEM_TYPE_DOSFS, |
---|
63 | RTEMS_FILESYSTEM_READ_WRITE, |
---|
64 | NULL |
---|
65 | ); |
---|
66 | rtems_test_assert(rv == 0); |
---|
67 | |
---|
68 | for (i = 0; i < RTEMS_ARRAY_SIZE(dir_paths); ++i) { |
---|
69 | rv = mkdir(dir_paths[i], S_IRWXU | S_IRWXG | S_IRWXO); |
---|
70 | rtems_test_assert(rv == 0); |
---|
71 | } |
---|
72 | |
---|
73 | for (i = RTEMS_ARRAY_SIZE(dir_paths); i > 0; --i) { |
---|
74 | rv = unlink(dir_paths[i - 1]); |
---|
75 | rtems_test_assert(rv == 0); |
---|
76 | } |
---|
77 | } |
---|
78 | |
---|
79 | static void Init(rtems_task_argument arg) |
---|
80 | { |
---|
81 | TEST_BEGIN(); |
---|
82 | |
---|
83 | test(); |
---|
84 | |
---|
85 | TEST_END(); |
---|
86 | rtems_test_exit(0); |
---|
87 | } |
---|
88 | |
---|
89 | rtems_ramdisk_config rtems_ramdisk_configuration[] = { |
---|
90 | { .block_size = 512, .block_num = 64 } |
---|
91 | }; |
---|
92 | |
---|
93 | size_t rtems_ramdisk_configuration_size = RTEMS_ARRAY_SIZE(rtems_ramdisk_configuration); |
---|
94 | |
---|
95 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER |
---|
96 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
97 | #define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK |
---|
98 | |
---|
99 | #define CONFIGURE_APPLICATION_EXTRA_DRIVERS RAMDISK_DRIVER_TABLE_ENTRY |
---|
100 | |
---|
101 | #define CONFIGURE_FILESYSTEM_DOSFS |
---|
102 | |
---|
103 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32 |
---|
104 | |
---|
105 | #define CONFIGURE_BDBUF_CACHE_MEMORY_SIZE 512 |
---|
106 | #define CONFIGURE_BDBUF_BUFFER_MIN_SIZE 512 |
---|
107 | #define CONFIGURE_BDBUF_BUFFER_MAX_SIZE 512 |
---|
108 | |
---|
109 | #define CONFIGURE_MAXIMUM_TASKS 1 |
---|
110 | #define CONFIGURE_MAXIMUM_SEMAPHORES 1 |
---|
111 | |
---|
112 | #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION |
---|
113 | |
---|
114 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
115 | |
---|
116 | #define CONFIGURE_INIT |
---|
117 | |
---|
118 | #include <rtems/confdefs.h> |
---|