summaryrefslogtreecommitdiffstats
path: root/testsuites/fstests/fsdosfsname02/init.c
blob: 0496ca00a4153a56541f71f8c172cdb9f6be4e9a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
 * Copyright (c) 2017 embedded brains GmbH.  All rights reserved.
 *
 *  embedded brains GmbH
 *  Dornierstr. 4
 *  82178 Puchheim
 *  Germany
 *  <rtems@embedded-brains.de>
 *
 * The license and distribution terms for this file may be
 * found in the file LICENSE in this distribution or at
 * http://www.rtems.org/license/LICENSE.
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>

#include <rtems/dosfs.h>
#include <rtems/ramdisk.h>

#include "tmacros.h"

const char rtems_test_name[] = "FSDOSFSNAME 2";

#define RAMDISK_PATH "/dev/rda"

#define MOUNT_PATH "/mnt"

static const char * const dir_paths[] = {
  MOUNT_PATH "/cpukit",
  MOUNT_PATH "/cpukit/or1k-exception-frame-print.c",
  MOUNT_PATH "/cpukit/preinstall.am",
  MOUNT_PATH "/cpukit/Makefile.in",
  MOUNT_PATH "/cpukit/Makefile.am",
  MOUNT_PATH "/cpukit/rtems",
  MOUNT_PATH "/cpukit/or1k-context-switch.S",
  MOUNT_PATH "/cpukit/or1k-exception-default.c",
  MOUNT_PATH "/cpukit/or1k-context-initialize.c",
  MOUNT_PATH "/cpukit/or1k-context-volatile-clobber.S",
  MOUNT_PATH "/cpukit/or1k-context-validate.S",
  MOUNT_PATH "/cpukit/or1k-exception-handler-low.S",
  MOUNT_PATH "/cpukit/cpu.c"
};

static void test(void)
{
  int rv;
  size_t i;

  rv = msdos_format(RAMDISK_PATH, NULL);
  rtems_test_assert(rv == 0);

  rv = mount_and_make_target_path(
    RAMDISK_PATH,
    MOUNT_PATH,
    RTEMS_FILESYSTEM_TYPE_DOSFS,
    RTEMS_FILESYSTEM_READ_WRITE,
    NULL
  );
  rtems_test_assert(rv == 0);

  for (i = 0; i < RTEMS_ARRAY_SIZE(dir_paths); ++i) {
    rv = mkdir(dir_paths[i], S_IRWXU | S_IRWXG | S_IRWXO);
    rtems_test_assert(rv == 0);
  }

  for (i = RTEMS_ARRAY_SIZE(dir_paths); i > 0; --i) {
    rv = unlink(dir_paths[i - 1]);
    rtems_test_assert(rv == 0);
  }
}

static void Init(rtems_task_argument arg)
{
  TEST_BEGIN();

  test();

  TEST_END();
  rtems_test_exit(0);
}

rtems_ramdisk_config rtems_ramdisk_configuration[] = {
  { .block_size = 512, .block_num = 64 }
};

size_t rtems_ramdisk_configuration_size = RTEMS_ARRAY_SIZE(rtems_ramdisk_configuration);

#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK

#define CONFIGURE_APPLICATION_EXTRA_DRIVERS RAMDISK_DRIVER_TABLE_ENTRY

#define CONFIGURE_FILESYSTEM_DOSFS

#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32

#define CONFIGURE_BDBUF_CACHE_MEMORY_SIZE 512
#define CONFIGURE_BDBUF_BUFFER_MIN_SIZE 512
#define CONFIGURE_BDBUF_BUFFER_MAX_SIZE 512

#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_MAXIMUM_SEMAPHORES 1

#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION

#define CONFIGURE_RTEMS_INIT_TASKS_TABLE

#define CONFIGURE_INIT

#include <rtems/confdefs.h>