summaryrefslogtreecommitdiffstats
path: root/testsuites/fstests/fsdosfsname02
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-03-13 15:20:20 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-03-16 15:33:57 +0100
commite69ee3629d09e7ba3237d47f6e5c13cfb3eb51d5 (patch)
treed906464787cf6227bd7db23edc8858deb6505c61 /testsuites/fstests/fsdosfsname02
parentdosfs: Fix msdos_utf8_normalize_and_fold() (diff)
downloadrtems-e69ee3629d09e7ba3237d47f6e5c13cfb3eb51d5.tar.bz2
dosfs: Fix fat_file_write()
Remove forced overwrite which leads to file data corruption. The logic to determine a forced overwrite was fundamentally broken. For simplity, disable this feature. Update #2622.
Diffstat (limited to 'testsuites/fstests/fsdosfsname02')
-rw-r--r--testsuites/fstests/fsdosfsname02/Makefile.am19
-rw-r--r--testsuites/fstests/fsdosfsname02/fsdosfsname02.doc11
-rw-r--r--testsuites/fstests/fsdosfsname02/fsdosfsname02.scn2
-rw-r--r--testsuites/fstests/fsdosfsname02/init.c118
4 files changed, 150 insertions, 0 deletions
diff --git a/testsuites/fstests/fsdosfsname02/Makefile.am b/testsuites/fstests/fsdosfsname02/Makefile.am
new file mode 100644
index 0000000000..d3fdc5ce15
--- /dev/null
+++ b/testsuites/fstests/fsdosfsname02/Makefile.am
@@ -0,0 +1,19 @@
+rtems_tests_PROGRAMS = fsdosfsname02
+fsdosfsname02_SOURCES = init.c
+
+dist_rtems_tests_DATA = fsdosfsname02.scn fsdosfsname02.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(fsdosfsname02_OBJECTS)
+LINK_LIBS = $(fsdosfsname02_LDLIBS)
+
+fsdosfsname02$(EXEEXT): $(fsdosfsname02_OBJECTS) $(fsdosfsname02_DEPENDENCIES)
+ @rm -f fsdosfsname02$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/fstests/fsdosfsname02/fsdosfsname02.doc b/testsuites/fstests/fsdosfsname02/fsdosfsname02.doc
new file mode 100644
index 0000000000..079c2ae8b1
--- /dev/null
+++ b/testsuites/fstests/fsdosfsname02/fsdosfsname02.doc
@@ -0,0 +1,11 @@
+This file describes the directives and concepts tested by this test set.
+
+test set name: fsdosfsname02
+
+directives:
+
+ - msdos_add_file()
+
+concepts:
+
+ - Ensure that directory entries accross cluster boundaries work.
diff --git a/testsuites/fstests/fsdosfsname02/fsdosfsname02.scn b/testsuites/fstests/fsdosfsname02/fsdosfsname02.scn
new file mode 100644
index 0000000000..116c6671a4
--- /dev/null
+++ b/testsuites/fstests/fsdosfsname02/fsdosfsname02.scn
@@ -0,0 +1,2 @@
+*** BEGIN OF TEST FSDOSFSNAME 2 ***
+*** END OF TEST FSDOSFSNAME 2 ***
diff --git a/testsuites/fstests/fsdosfsname02/init.c b/testsuites/fstests/fsdosfsname02/init.c
new file mode 100644
index 0000000000..0496ca00a4
--- /dev/null
+++ b/testsuites/fstests/fsdosfsname02/init.c
@@ -0,0 +1,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>