diff options
Diffstat (limited to 'testsuites/fstests')
-rw-r--r-- | testsuites/fstests/Makefile.am | 1 | ||||
-rw-r--r-- | testsuites/fstests/configure.ac | 1 | ||||
-rw-r--r-- | testsuites/fstests/fsimfsconfig01/init.c | 27 | ||||
-rw-r--r-- | testsuites/fstests/fsimfsconfig03/Makefile.am | 19 | ||||
-rw-r--r-- | testsuites/fstests/fsimfsconfig03/fsimfsconfig03.doc | 11 | ||||
-rw-r--r-- | testsuites/fstests/fsimfsconfig03/fsimfsconfig03.scn | 2 | ||||
-rw-r--r-- | testsuites/fstests/fsimfsconfig03/init.c | 145 |
7 files changed, 203 insertions, 3 deletions
diff --git a/testsuites/fstests/Makefile.am b/testsuites/fstests/Makefile.am index 6b01b20184..4812c8a955 100644 --- a/testsuites/fstests/Makefile.am +++ b/testsuites/fstests/Makefile.am @@ -1,6 +1,7 @@ ACLOCAL_AMFLAGS = -I ../aclocal _SUBDIRS = +_SUBDIRS += fsimfsconfig03 _SUBDIRS += fsimfsconfig02 _SUBDIRS += fsimfsconfig01 _SUBDIRS += fsdosfsname01 diff --git a/testsuites/fstests/configure.ac b/testsuites/fstests/configure.ac index 87b8961746..78800b3a70 100644 --- a/testsuites/fstests/configure.ac +++ b/testsuites/fstests/configure.ac @@ -77,6 +77,7 @@ AC_CHECK_SIZEOF([blkcnt_t]) # Explicitly list all Makefiles here AC_CONFIG_FILES([Makefile +fsimfsconfig03/Makefile fsimfsconfig02/Makefile fsimfsconfig01/Makefile fsdosfsname01/Makefile diff --git a/testsuites/fstests/fsimfsconfig01/init.c b/testsuites/fstests/fsimfsconfig01/init.c index 3f842c0451..e14ca8d5d8 100644 --- a/testsuites/fstests/fsimfsconfig01/init.c +++ b/testsuites/fstests/fsimfsconfig01/init.c @@ -20,6 +20,7 @@ #include <sys/stat.h> #include <errno.h> +#include <fcntl.h> #include <stdio.h> #include <unistd.h> #include <utime.h> @@ -40,7 +41,11 @@ static void Init(rtems_task_argument arg) struct utimbuf times; const char *generic = "generic"; const char *mnt = "mnt"; + const char *dev = "device"; + const char *file = "file"; + const char *fifo = "fifo"; int rv; + int fd; TEST_BEGIN(); @@ -70,6 +75,20 @@ static void Init(rtems_task_argument arg) rv = mkdir(mnt, S_IRWXU); rtems_test_assert(rv == 0); + rv = mknod(dev, S_IFCHR | S_IRWXU, 0); + rtems_test_assert(rv == 0); + + fd = creat(file, S_IRWXU); + rtems_test_assert(fd == 3); + + rv = close(fd); + rtems_test_assert(rv == 0); + + errno = 0; + rv = mkfifo(fifo, S_IRWXU); + rtems_test_assert(rv == -1); + rtems_test_assert(errno == ENOSYS); + errno = 0; rv = mount( "", @@ -87,17 +106,17 @@ static void Init(rtems_task_argument arg) rtems_test_assert(errno == ENOTSUP); errno = 0; - rv = unlink(generic); + rv = symlink(generic, "link"); rtems_test_assert(rv == -1); rtems_test_assert(errno == ENOTSUP); errno = 0; - rv = symlink(generic, "link"); + rv = utime(generic, ×); rtems_test_assert(rv == -1); rtems_test_assert(errno == ENOTSUP); errno = 0; - rv = utime(generic, ×); + rv = unlink(generic); rtems_test_assert(rv == -1); rtems_test_assert(errno == ENOTSUP); @@ -108,6 +127,8 @@ static void Init(rtems_task_argument arg) #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4 + #define CONFIGURE_FILESYSTEM_IMFS #define CONFIGURE_IMFS_DISABLE_CHOWN diff --git a/testsuites/fstests/fsimfsconfig03/Makefile.am b/testsuites/fstests/fsimfsconfig03/Makefile.am new file mode 100644 index 0000000000..83a824cb58 --- /dev/null +++ b/testsuites/fstests/fsimfsconfig03/Makefile.am @@ -0,0 +1,19 @@ +rtems_tests_PROGRAMS = fsimfsconfig03 +fsimfsconfig03_SOURCES = init.c + +dist_rtems_tests_DATA = fsimfsconfig03.scn fsimfsconfig03.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 = $(fsimfsconfig03_OBJECTS) +LINK_LIBS = $(fsimfsconfig03_LDLIBS) + +fsimfsconfig03$(EXEEXT): $(fsimfsconfig03_OBJECTS) $(fsimfsconfig03_DEPENDENCIES) + @rm -f fsimfsconfig03$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/fstests/fsimfsconfig03/fsimfsconfig03.doc b/testsuites/fstests/fsimfsconfig03/fsimfsconfig03.doc new file mode 100644 index 0000000000..a7c2710093 --- /dev/null +++ b/testsuites/fstests/fsimfsconfig03/fsimfsconfig03.doc @@ -0,0 +1,11 @@ +This file describes the directives and concepts tested by this test set. + +test set name: fsimfsconfig03 + +directives: + + TBD + +concepts: + + - Ensure that the IMFS configuration defines work. diff --git a/testsuites/fstests/fsimfsconfig03/fsimfsconfig03.scn b/testsuites/fstests/fsimfsconfig03/fsimfsconfig03.scn new file mode 100644 index 0000000000..5da52a7a0f --- /dev/null +++ b/testsuites/fstests/fsimfsconfig03/fsimfsconfig03.scn @@ -0,0 +1,2 @@ +*** BEGIN OF TEST FSIMFSCONFIG 3 *** +*** END OF TEST FSIMFSCONFIG 3 *** diff --git a/testsuites/fstests/fsimfsconfig03/init.c b/testsuites/fstests/fsimfsconfig03/init.c new file mode 100644 index 0000000000..7307e74c95 --- /dev/null +++ b/testsuites/fstests/fsimfsconfig03/init.c @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2015 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 "tmacros.h" + +#include <sys/stat.h> +#include <errno.h> +#include <fcntl.h> +#include <stdio.h> +#include <unistd.h> +#include <utime.h> + +#include <rtems/imfs.h> +#include <rtems/libio.h> + +const char rtems_test_name[] = "FSIMFSCONFIG 3"; + +static const IMFS_node_control node_control = IMFS_GENERIC_INITIALIZER( + &rtems_filesystem_handlers_default, + IMFS_node_initialize_generic, + IMFS_node_destroy_default +); + +static void Init(rtems_task_argument arg) +{ + struct utimbuf times; + const char *generic = "generic"; + const char *mnt = "mnt"; + const char *dev = "device"; + const char *file = "file"; + const char *fifo = "fifo"; + int rv; + int fd; + + TEST_BEGIN(); + + rv = IMFS_make_generic_node( + generic, + S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO, + &node_control, + NULL + ); + rtems_test_assert(rv == 0); + + errno = 0; + rv = chown(generic, 0, 0); + rtems_test_assert(rv == -1); + rtems_test_assert(errno == ENOTSUP); + + errno = 0; + rv = chmod(generic, 0); + rtems_test_assert(rv == -1); + rtems_test_assert(errno == ENOTSUP); + + errno = 0; + rv = link(generic, "link"); + rtems_test_assert(rv == -1); + rtems_test_assert(errno == ENOTSUP); + + rv = mkdir(mnt, S_IRWXU); + rtems_test_assert(rv == 0); + + rv = mknod(dev, S_IFCHR | S_IRWXU, 0); + rtems_test_assert(rv == 0); + + fd = creat(file, S_IRWXU); + rtems_test_assert(fd == 3); + + rv = close(fd); + rtems_test_assert(rv == 0); + + errno = 0; + rv = mkfifo(fifo, S_IRWXU); + rtems_test_assert(rv == -1); + rtems_test_assert(errno == ENOSYS); + + rv = mount( + "", + mnt, + RTEMS_FILESYSTEM_TYPE_IMFS, + RTEMS_FILESYSTEM_READ_ONLY, + NULL + ); + rtems_test_assert(rv == 0); + + errno = 0; + rv = unmount(mnt); + rtems_test_assert(rv == -1); + rtems_test_assert(errno == ENOTSUP); + + errno = 0; + rv = rename(generic, "new"); + rtems_test_assert(rv == -1); + rtems_test_assert(errno == ENOTSUP); + + errno = 0; + rv = symlink(generic, "link"); + rtems_test_assert(rv == -1); + rtems_test_assert(errno == ENOTSUP); + + errno = 0; + rv = utime(generic, ×); + rtems_test_assert(rv == -1); + rtems_test_assert(errno == ENOTSUP); + + rv = unlink(generic); + rtems_test_assert(rv == 0); + + TEST_END(); + rtems_test_exit(0); +} + +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4 + +#define CONFIGURE_FILESYSTEM_IMFS + +#define CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM + +#define CONFIGURE_MAXIMUM_TASKS 1 + +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> |