Index: testsuites/fstests/Makefile.am
===================================================================
--- testsuites/fstests/Makefile.am	(revision bdcf4102f71d1bc2a50f23d2d425d85c24ec0900)
+++ testsuites/fstests/Makefile.am	(revision 0282e83d64ab6f3460b20dbfc945b1bd5b054376)
@@ -14,4 +14,11 @@
 SUBDIRS += imfs_fssymlink
 SUBDIRS += imfs_fstime
+SUBDIRS += jffs2_fserror
+SUBDIRS += jffs2_fslink
+SUBDIRS += jffs2_fspatheval
+SUBDIRS += jffs2_fspermission
+SUBDIRS += jffs2_fsrdwr
+SUBDIRS += jffs2_fssymlink
+SUBDIRS += jffs2_fstime
 SUBDIRS += mdosfs_fserror
 SUBDIRS += mdosfs_fspatheval
Index: testsuites/fstests/configure.ac
===================================================================
--- testsuites/fstests/configure.ac	(revision bdcf4102f71d1bc2a50f23d2d425d85c24ec0900)
+++ testsuites/fstests/configure.ac	(revision 0282e83d64ab6f3460b20dbfc945b1bd5b054376)
@@ -90,4 +90,11 @@
 imfs_fssymlink/Makefile
 imfs_fstime/Makefile
+jffs2_fserror/Makefile
+jffs2_fslink/Makefile
+jffs2_fspatheval/Makefile
+jffs2_fspermission/Makefile
+jffs2_fsrdwr/Makefile
+jffs2_fssymlink/Makefile
+jffs2_fstime/Makefile
 mdosfs_fserror/Makefile
 mdosfs_fspatheval/Makefile
Index: testsuites/fstests/jffs2_fserror/Makefile.am
===================================================================
--- testsuites/fstests/jffs2_fserror/Makefile.am	(revision 0282e83d64ab6f3460b20dbfc945b1bd5b054376)
+++ testsuites/fstests/jffs2_fserror/Makefile.am	(revision 0282e83d64ab6f3460b20dbfc945b1bd5b054376)
@@ -0,0 +1,31 @@
+
+rtems_tests_PROGRAMS = jffs2_fserror
+jffs2_fserror_SOURCES  = ../fserror/test.c
+jffs2_fserror_SOURCES += ../support/fstest_support.c
+jffs2_fserror_SOURCES += ../support/fstest_support.h
+jffs2_fserror_SOURCES += ../support/fstest.h
+jffs2_fserror_SOURCES += ../../psxtests/include/pmacros.h
+jffs2_fserror_SOURCES += ../jffs2_support/fs_support.c
+jffs2_fserror_SOURCES += ../jffs2_support/fs_config.h
+
+#dist_rtems_tests_DATA = jffs2_fserror.scn
+#dist_rtems_tests_DATA += jffs2_fserror.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
+AM_CPPFLAGS += -I$(top_srcdir)/jffs2_support
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -I$(top_srcdir)/../psxtests/include
+
+LINK_OBJS = $(jffs2_fserror_OBJECTS)
+LINK_LIBS = $(jffs2_fserror_LDLIBS)
+
+jffs2_fserror$(EXEEXT): $(jffs2_fserror_OBJECTS) $(jffs2_fserror_DEPENDENCIES)
+	@rm -f jffs2_fserror$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am
Index: testsuites/fstests/jffs2_fslink/Makefile.am
===================================================================
--- testsuites/fstests/jffs2_fslink/Makefile.am	(revision 0282e83d64ab6f3460b20dbfc945b1bd5b054376)
+++ testsuites/fstests/jffs2_fslink/Makefile.am	(revision 0282e83d64ab6f3460b20dbfc945b1bd5b054376)
@@ -0,0 +1,31 @@
+
+rtems_tests_PROGRAMS = jffs2_fslink
+jffs2_fslink_SOURCES  = ../fslink/test.c
+jffs2_fslink_SOURCES += ../support/fstest_support.c
+jffs2_fslink_SOURCES += ../support/fstest_support.h
+jffs2_fslink_SOURCES += ../support/fstest.h
+jffs2_fslink_SOURCES += ../../psxtests/include/pmacros.h
+jffs2_fslink_SOURCES += ../jffs2_support/fs_support.c
+jffs2_fslink_SOURCES += ../jffs2_support/fs_config.h
+
+#dist_rtems_tests_DATA = jffs2_fslink.scn
+#dist_rtems_tests_DATA += jffs2_fslink.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
+AM_CPPFLAGS += -I$(top_srcdir)/jffs2_support
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -I$(top_srcdir)/../psxtests/include
+
+LINK_OBJS = $(jffs2_fslink_OBJECTS)
+LINK_LIBS = $(jffs2_fslink_LDLIBS)
+
+jffs2_fslink$(EXEEXT): $(jffs2_fslink_OBJECTS) $(jffs2_fslink_DEPENDENCIES)
+	@rm -f jffs2_fslink$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am
Index: testsuites/fstests/jffs2_fspatheval/Makefile.am
===================================================================
--- testsuites/fstests/jffs2_fspatheval/Makefile.am	(revision 0282e83d64ab6f3460b20dbfc945b1bd5b054376)
+++ testsuites/fstests/jffs2_fspatheval/Makefile.am	(revision 0282e83d64ab6f3460b20dbfc945b1bd5b054376)
@@ -0,0 +1,31 @@
+
+rtems_tests_PROGRAMS = jffs2_fspatheval
+jffs2_fspatheval_SOURCES  = ../fspatheval/test.c
+jffs2_fspatheval_SOURCES += ../support/fstest_support.c
+jffs2_fspatheval_SOURCES += ../support/fstest_support.h
+jffs2_fspatheval_SOURCES += ../support/fstest.h
+jffs2_fspatheval_SOURCES += ../../psxtests/include/pmacros.h
+jffs2_fspatheval_SOURCES += ../jffs2_support/fs_support.c
+jffs2_fspatheval_SOURCES += ../jffs2_support/fs_config.h
+
+#dist_rtems_tests_DATA = jffs2_fspatheval.scn
+#dist_rtems_tests_DATA += jffs2_fspatheval.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
+AM_CPPFLAGS += -I$(top_srcdir)/jffs2_support
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -I$(top_srcdir)/../psxtests/include
+
+LINK_OBJS = $(jffs2_fspatheval_OBJECTS)
+LINK_LIBS = $(jffs2_fspatheval_LDLIBS)
+
+jffs2_fspatheval$(EXEEXT): $(jffs2_fspatheval_OBJECTS) $(jffs2_fspatheval_DEPENDENCIES)
+	@rm -f jffs2_fspatheval$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am
Index: testsuites/fstests/jffs2_fspermission/Makefile.am
===================================================================
--- testsuites/fstests/jffs2_fspermission/Makefile.am	(revision 0282e83d64ab6f3460b20dbfc945b1bd5b054376)
+++ testsuites/fstests/jffs2_fspermission/Makefile.am	(revision 0282e83d64ab6f3460b20dbfc945b1bd5b054376)
@@ -0,0 +1,31 @@
+
+rtems_tests_PROGRAMS = jffs2_fspermission
+jffs2_fspermission_SOURCES  = ../fspermission/test.c
+jffs2_fspermission_SOURCES += ../support/fstest_support.c
+jffs2_fspermission_SOURCES += ../support/fstest_support.h
+jffs2_fspermission_SOURCES += ../support/fstest.h
+jffs2_fspermission_SOURCES += ../../psxtests/include/pmacros.h
+jffs2_fspermission_SOURCES += ../jffs2_support/fs_support.c
+jffs2_fspermission_SOURCES += ../jffs2_support/fs_config.h
+
+#dist_rtems_tests_DATA = jffs2_fspermission.scn
+#dist_rtems_tests_DATA += jffs2_fspermission.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
+AM_CPPFLAGS += -I$(top_srcdir)/jffs2_support
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -I$(top_srcdir)/../psxtests/include
+
+LINK_OBJS = $(jffs2_fspermission_OBJECTS)
+LINK_LIBS = $(jffs2_fspermission_LDLIBS)
+
+jffs2_fspermission$(EXEEXT): $(jffs2_fspermission_OBJECTS) $(jffs2_fspermission_DEPENDENCIES)
+	@rm -f jffs2_fspermission$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am
Index: testsuites/fstests/jffs2_fsrdwr/Makefile.am
===================================================================
--- testsuites/fstests/jffs2_fsrdwr/Makefile.am	(revision 0282e83d64ab6f3460b20dbfc945b1bd5b054376)
+++ testsuites/fstests/jffs2_fsrdwr/Makefile.am	(revision 0282e83d64ab6f3460b20dbfc945b1bd5b054376)
@@ -0,0 +1,31 @@
+
+rtems_tests_PROGRAMS = jffs2_fsrdwr
+jffs2_fsrdwr_SOURCES  = ../fsrdwr/init.c
+jffs2_fsrdwr_SOURCES += ../support/fstest_support.c
+jffs2_fsrdwr_SOURCES += ../support/fstest_support.h
+jffs2_fsrdwr_SOURCES += ../support/fstest.h
+jffs2_fsrdwr_SOURCES += ../../psxtests/include/pmacros.h
+jffs2_fsrdwr_SOURCES += ../jffs2_support/fs_support.c
+jffs2_fsrdwr_SOURCES += ../jffs2_support/fs_config.h
+
+#dist_rtems_tests_DATA = jffs2_fsrdwr.scn
+#dist_rtems_tests_DATA += jffs2_fsrdwr.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
+AM_CPPFLAGS += -I$(top_srcdir)/jffs2_support
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -I$(top_srcdir)/../psxtests/include
+
+LINK_OBJS = $(jffs2_fsrdwr_OBJECTS)
+LINK_LIBS = $(jffs2_fsrdwr_LDLIBS)
+
+jffs2_fsrdwr$(EXEEXT): $(jffs2_fsrdwr_OBJECTS) $(jffs2_fsrdwr_DEPENDENCIES)
+	@rm -f jffs2_fsrdwr$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am
Index: testsuites/fstests/jffs2_fssymlink/Makefile.am
===================================================================
--- testsuites/fstests/jffs2_fssymlink/Makefile.am	(revision 0282e83d64ab6f3460b20dbfc945b1bd5b054376)
+++ testsuites/fstests/jffs2_fssymlink/Makefile.am	(revision 0282e83d64ab6f3460b20dbfc945b1bd5b054376)
@@ -0,0 +1,31 @@
+
+rtems_tests_PROGRAMS = jffs2_fssymlink
+jffs2_fssymlink_SOURCES  = ../fssymlink/test.c
+jffs2_fssymlink_SOURCES += ../support/fstest_support.c
+jffs2_fssymlink_SOURCES += ../support/fstest_support.h
+jffs2_fssymlink_SOURCES += ../support/fstest.h
+jffs2_fssymlink_SOURCES += ../../psxtests/include/pmacros.h
+jffs2_fssymlink_SOURCES += ../jffs2_support/fs_support.c
+jffs2_fssymlink_SOURCES += ../jffs2_support/fs_config.h
+
+#dist_rtems_tests_DATA = jffs2_fssymlink.scn
+#dist_rtems_tests_DATA += jffs2_fssymlink.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
+AM_CPPFLAGS += -I$(top_srcdir)/jffs2_support
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -I$(top_srcdir)/../psxtests/include
+
+LINK_OBJS = $(jffs2_fssymlink_OBJECTS)
+LINK_LIBS = $(jffs2_fssymlink_LDLIBS)
+
+jffs2_fssymlink$(EXEEXT): $(jffs2_fssymlink_OBJECTS) $(jffs2_fssymlink_DEPENDENCIES)
+	@rm -f jffs2_fssymlink$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am
Index: testsuites/fstests/jffs2_fstime/Makefile.am
===================================================================
--- testsuites/fstests/jffs2_fstime/Makefile.am	(revision 0282e83d64ab6f3460b20dbfc945b1bd5b054376)
+++ testsuites/fstests/jffs2_fstime/Makefile.am	(revision 0282e83d64ab6f3460b20dbfc945b1bd5b054376)
@@ -0,0 +1,31 @@
+
+rtems_tests_PROGRAMS = jffs2_fstime
+jffs2_fstime_SOURCES  = ../fstime/test.c
+jffs2_fstime_SOURCES += ../support/fstest_support.c
+jffs2_fstime_SOURCES += ../support/fstest_support.h
+jffs2_fstime_SOURCES += ../support/fstest.h
+jffs2_fstime_SOURCES += ../../psxtests/include/pmacros.h
+jffs2_fstime_SOURCES += ../jffs2_support/fs_support.c
+jffs2_fstime_SOURCES += ../jffs2_support/fs_config.h
+
+#dist_rtems_tests_DATA = jffs2_fstime.scn
+#dist_rtems_tests_DATA += jffs2_fstime.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
+AM_CPPFLAGS += -I$(top_srcdir)/jffs2_support
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -I$(top_srcdir)/../psxtests/include
+
+LINK_OBJS = $(jffs2_fstime_OBJECTS)
+LINK_LIBS = $(jffs2_fstime_LDLIBS)
+
+jffs2_fstime$(EXEEXT): $(jffs2_fstime_OBJECTS) $(jffs2_fstime_DEPENDENCIES)
+	@rm -f jffs2_fstime$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am
Index: testsuites/fstests/jffs2_support/fs_config.h
===================================================================
--- testsuites/fstests/jffs2_support/fs_config.h	(revision 0282e83d64ab6f3460b20dbfc945b1bd5b054376)
+++ testsuites/fstests/jffs2_support/fs_config.h	(revision 0282e83d64ab6f3460b20dbfc945b1bd5b054376)
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2013 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  <info@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.com/license/LICENSE.
+ */
+
+#ifndef __JFFS2_SUPPORT_h
+#define __JFFS2_SUPPORT_h
+
+#define FILESYSTEM "JFFS2"
+
+#endif
Index: testsuites/fstests/jffs2_support/fs_support.c
===================================================================
--- testsuites/fstests/jffs2_support/fs_support.c	(revision 0282e83d64ab6f3460b20dbfc945b1bd5b054376)
+++ testsuites/fstests/jffs2_support/fs_support.c	(revision 0282e83d64ab6f3460b20dbfc945b1bd5b054376)
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2013 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  <info@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.com/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include "pmacros.h"
+
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <string.h>
+
+#include <rtems/jffs2.h>
+#include <rtems/libio.h>
+#include <rtems/libcsupport.h>
+
+#include "fstest.h"
+#include "fstest_support.h"
+
+#define BLOCK_SIZE (16UL * 1024UL)
+
+#define FLASH_SIZE (8UL * BLOCK_SIZE)
+
+typedef struct {
+  rtems_jffs2_flash_control super;
+  unsigned char area[FLASH_SIZE];
+} flash_control;
+
+static flash_control *get_flash_control(rtems_jffs2_flash_control *super)
+{
+  return (flash_control *) super;
+}
+
+static int flash_read(
+  rtems_jffs2_flash_control *super,
+  uint32_t offset,
+  unsigned char *buffer,
+  size_t size_of_buffer
+)
+{
+  flash_control *self = get_flash_control(super);
+  unsigned char *chunk = &self->area[offset];
+
+  memcpy(buffer, chunk, size_of_buffer);
+
+  return 0;
+}
+
+static int flash_write(
+  rtems_jffs2_flash_control *super,
+  uint32_t offset,
+  const unsigned char *buffer,
+  size_t size_of_buffer
+)
+{
+  flash_control *self = get_flash_control(super);
+  unsigned char *chunk = &self->area[offset];
+  size_t i;
+
+  for (i = 0; i < size_of_buffer; ++i) {
+    chunk[i] &= buffer[i];
+  }
+
+  return 0;
+}
+
+static int flash_erase(
+  rtems_jffs2_flash_control *super,
+  uint32_t offset
+)
+{
+  flash_control *self = get_flash_control(super);
+  unsigned char *chunk = &self->area[offset];
+
+  memset(chunk, 0xff, BLOCK_SIZE);
+
+  return 0;
+}
+
+static flash_control flash_instance = {
+  .super = {
+    .block_size = BLOCK_SIZE,
+    .flash_size = FLASH_SIZE,
+    .read = flash_read,
+    .write = flash_write,
+    .erase = flash_erase
+  }
+};
+
+static rtems_jffs2_compressor_control compressor_instance = {
+  .compress = rtems_jffs2_compressor_rtime_compress,
+  .decompress = rtems_jffs2_compressor_rtime_decompress
+};
+
+static const rtems_jffs2_mount_data mount_data = {
+  .flash_control = &flash_instance.super,
+  .compressor_control = &compressor_instance
+};
+
+static void erase_all(void)
+{
+  memset(&flash_instance.area[0], 0xff, FLASH_SIZE);
+}
+
+static rtems_resource_snapshot before_mount;
+
+void test_initialize_filesystem(void)
+{
+  int rv;
+
+  erase_all();
+
+  rv = mkdir(BASE_FOR_TEST, S_IRWXU | S_IRWXG | S_IRWXO);
+  rtems_test_assert(rv == 0);
+
+  rtems_resource_snapshot_take(&before_mount);
+
+  rv = mount(
+    NULL,
+    BASE_FOR_TEST,
+    RTEMS_FILESYSTEM_TYPE_JFFS2,
+    RTEMS_FILESYSTEM_READ_WRITE,
+    &mount_data
+  );
+  rtems_test_assert(rv == 0);
+}
+
+void test_shutdown_filesystem(void)
+{
+  int rv = unmount(BASE_FOR_TEST);
+  rtems_test_assert(rv == 0);
+  rtems_test_assert(rtems_resource_snapshot_check(&before_mount));
+}
+
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
+#define CONFIGURE_FILESYSTEM_JFFS2
+
+#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 40
+
+#define CONFIGURE_MAXIMUM_TASKS 1
+
+#define CONFIGURE_INIT_TASK_STACK_SIZE (32 * 1024)
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
