[rtems commit] Add simple test for scandir() on all file systems tested

Joel Sherril joel at rtems.org
Wed Mar 4 20:46:33 UTC 2015


Module:    rtems
Branch:    master
Commit:    57a914a3fb2295eceff71b18f96a6a4e66542334
Changeset: http://git.rtems.org/rtems/commit/?id=57a914a3fb2295eceff71b18f96a6a4e66542334

Author:    Joel Sherrill <joel.sherrill at oarcorp.com>
Date:      Tue Mar  3 15:15:00 2015 -0600

Add simple test for scandir() on all file systems tested

updates 1394

---

 testsuites/fstests/Makefile.am                     |  5 +++
 testsuites/fstests/configure.ac                    |  5 +++
 testsuites/fstests/fsscandir01/fsscandir01.doc     |  0
 testsuites/fstests/fsscandir01/init.c              | 52 ++++++++++++++++++++++
 testsuites/fstests/imfs_fsscandir01/Makefile.am    | 31 +++++++++++++
 .../fstests/imfs_fsscandir01/imfs_fsscandir01.scn  |  7 +++
 testsuites/fstests/jffs2_fsscandir01/Makefile.am   | 31 +++++++++++++
 .../jffs2_fsscandir01/jffs2_fsscandir01.scn        |  7 +++
 testsuites/fstests/mdosfs_fsscandir01/Makefile.am  | 33 ++++++++++++++
 .../mdosfs_fsscandir01/mdosfs_fsscandir01.scn      |  6 +++
 testsuites/fstests/mimfs_fsscandir01/Makefile.am   | 31 +++++++++++++
 .../mimfs_fsscandir01/mimfs_fsscandir01.scn        |  7 +++
 testsuites/fstests/mrfs_fsscandir01/Makefile.am    | 33 ++++++++++++++
 .../fstests/mrfs_fsscandir01/mrfs_fsscandir01.scn  |  7 +++
 14 files changed, 255 insertions(+)

diff --git a/testsuites/fstests/Makefile.am b/testsuites/fstests/Makefile.am
index 4812c8a..930fbd7 100644
--- a/testsuites/fstests/Makefile.am
+++ b/testsuites/fstests/Makefile.am
@@ -14,6 +14,7 @@ _SUBDIRS += imfs_fslink
 _SUBDIRS += imfs_fspatheval
 _SUBDIRS += imfs_fspermission
 _SUBDIRS += imfs_fsrdwr
+_SUBDIRS += imfs_fsscandir01
 _SUBDIRS += imfs_fssymlink
 _SUBDIRS += imfs_fstime
 _SUBDIRS += jffs2_fserror
@@ -21,18 +22,21 @@ _SUBDIRS += jffs2_fslink
 _SUBDIRS += jffs2_fspatheval
 _SUBDIRS += jffs2_fspermission
 _SUBDIRS += jffs2_fsrdwr
+_SUBDIRS += jffs2_fsscandir01
 _SUBDIRS += jffs2_fssymlink
 _SUBDIRS += jffs2_fstime
 _SUBDIRS += mdosfs_fserror
 _SUBDIRS += mdosfs_fspatheval
 _SUBDIRS += mdosfs_fsrdwr
 _SUBDIRS += mdosfs_fsstatvfs
+_SUBDIRS += mdosfs_fsscandir01
 _SUBDIRS += mdosfs_fstime
 _SUBDIRS += mimfs_fserror
 _SUBDIRS += mimfs_fslink
 _SUBDIRS += mimfs_fspatheval
 _SUBDIRS += mimfs_fspermission
 _SUBDIRS += mimfs_fsrdwr
+_SUBDIRS += mimfs_fsscandir01
 _SUBDIRS += mimfs_fssymlink
 _SUBDIRS += mimfs_fstime
 _SUBDIRS += mimfs_fsrename
@@ -41,6 +45,7 @@ _SUBDIRS += mrfs_fslink
 _SUBDIRS += mrfs_fspatheval
 _SUBDIRS += mrfs_fspermission
 _SUBDIRS += mrfs_fsrdwr
+_SUBDIRS += mrfs_fsscandir01
 _SUBDIRS += mrfs_fssymlink
 _SUBDIRS += mrfs_fstime
 _SUBDIRS += mrfs_fsfpathconf
diff --git a/testsuites/fstests/configure.ac b/testsuites/fstests/configure.ac
index 78800b3..f0bbaaf 100644
--- a/testsuites/fstests/configure.ac
+++ b/testsuites/fstests/configure.ac
@@ -90,6 +90,7 @@ imfs_fslink/Makefile
 imfs_fspatheval/Makefile
 imfs_fspermission/Makefile
 imfs_fsrdwr/Makefile
+imfs_fsscandir01/Makefile
 imfs_fssymlink/Makefile
 imfs_fstime/Makefile
 jffs2_fserror/Makefile
@@ -97,11 +98,13 @@ jffs2_fslink/Makefile
 jffs2_fspatheval/Makefile
 jffs2_fspermission/Makefile
 jffs2_fsrdwr/Makefile
+jffs2_fsscandir01/Makefile
 jffs2_fssymlink/Makefile
 jffs2_fstime/Makefile
 mdosfs_fserror/Makefile
 mdosfs_fspatheval/Makefile
 mdosfs_fsrdwr/Makefile
+mdosfs_fsscandir01/Makefile
 mdosfs_fsstatvfs/Makefile
 mdosfs_fstime/Makefile
 mimfs_fserror/Makefile
@@ -109,6 +112,7 @@ mimfs_fslink/Makefile
 mimfs_fspatheval/Makefile
 mimfs_fspermission/Makefile
 mimfs_fsrdwr/Makefile
+mimfs_fsscandir01/Makefile
 mimfs_fssymlink/Makefile
 mimfs_fstime/Makefile
 mimfs_fsrename/Makefile
@@ -117,6 +121,7 @@ mrfs_fslink/Makefile
 mrfs_fspatheval/Makefile
 mrfs_fspermission/Makefile
 mrfs_fsrdwr/Makefile
+mrfs_fsscandir01/Makefile
 mrfs_fssymlink/Makefile
 mrfs_fstime/Makefile
 mrfs_fsfpathconf/Makefile
diff --git a/testsuites/fstests/fsscandir01/fsscandir01.doc b/testsuites/fstests/fsscandir01/fsscandir01.doc
new file mode 100644
index 0000000..e69de29
diff --git a/testsuites/fstests/fsscandir01/init.c b/testsuites/fstests/fsscandir01/init.c
new file mode 100644
index 0000000..9cfd88e
--- /dev/null
+++ b/testsuites/fstests/fsscandir01/init.c
@@ -0,0 +1,52 @@
+/*
+ *  COPYRIGHT (c) 2015.
+ *  On-Line Applications Research Corporation (OAR).
+ *  
+ *  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 "fstest.h"
+#include "fs_config.h"
+#include "fstest_support.h"
+#include "pmacros.h"
+
+#include <dirent.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <limits.h>
+
+const char rtems_test_name[] = "FSSCANDIR " FILESYSTEM;
+
+/*
+ * This code is from the scandir() man page.
+ */
+static void test_scandir(void)
+{
+  struct dirent **namelist;
+  int n;
+
+  n = scandir(".", &namelist, 0, NULL);
+  if (n < 0) {
+    perror("scandir");
+  } else {
+    while(n--) {
+      printf("%s\n", namelist[n]->d_name);
+      free(namelist[n]);
+    }
+    free(namelist);
+  }
+}
+
+
+void test (void)
+{
+  test_scandir();
+}
diff --git a/testsuites/fstests/imfs_fsscandir01/Makefile.am b/testsuites/fstests/imfs_fsscandir01/Makefile.am
new file mode 100644
index 0000000..86bd06e
--- /dev/null
+++ b/testsuites/fstests/imfs_fsscandir01/Makefile.am
@@ -0,0 +1,31 @@
+
+rtems_tests_PROGRAMS = imfs_fsscandir01
+imfs_fsscandir01_SOURCES  = ../fsscandir01/init.c
+imfs_fsscandir01_SOURCES += ../support/fstest_support.c
+imfs_fsscandir01_SOURCES += ../support/fstest_support.h
+imfs_fsscandir01_SOURCES += ../support/fstest.h
+imfs_fsscandir01_SOURCES += ../../psxtests/include/pmacros.h
+imfs_fsscandir01_SOURCES += ../imfs_support/fs_support.c
+imfs_fsscandir01_SOURCES += ../imfs_support/fs_config.h 
+
+#dist_rtems_tests_DATA = imfs_fsscandir01.scn
+#dist_rtems_tests_DATA += imfs_fsscandir01.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+
+AM_CPPFLAGS += -I$(top_srcdir)/support
+AM_CPPFLAGS += -I$(top_srcdir)/imfs_support
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -I$(top_srcdir)/../psxtests/include
+
+LINK_OBJS = $(imfs_fsscandir01_OBJECTS)
+LINK_LIBS = $(imfs_fsscandir01_LDLIBS)
+
+imfs_fsscandir01$(EXEEXT): $(imfs_fsscandir01_OBJECTS) $(imfs_fsscandir01_DEPENDENCIES)
+	@rm -f imfs_fsscandir01$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/fstests/imfs_fsscandir01/imfs_fsscandir01.scn b/testsuites/fstests/imfs_fsscandir01/imfs_fsscandir01.scn
new file mode 100644
index 0000000..5d6a83c
--- /dev/null
+++ b/testsuites/fstests/imfs_fsscandir01/imfs_fsscandir01.scn
@@ -0,0 +1,7 @@
+*** BEGIN OF TEST FSSCANDIR ROOT IMFS ***
+Initializing filesystem ROOT IMFS
+scandir: Success
+
+
+Shutting down filesystem ROOT IMFS
+*** END OF TEST FSSCANDIR ROOT IMFS ***
diff --git a/testsuites/fstests/jffs2_fsscandir01/Makefile.am b/testsuites/fstests/jffs2_fsscandir01/Makefile.am
new file mode 100644
index 0000000..8fad0b3
--- /dev/null
+++ b/testsuites/fstests/jffs2_fsscandir01/Makefile.am
@@ -0,0 +1,31 @@
+
+rtems_tests_PROGRAMS = jffs2_fsscandir01
+jffs2_fsscandir01_SOURCES  = ../fsscandir01/init.c
+jffs2_fsscandir01_SOURCES += ../support/fstest_support.c
+jffs2_fsscandir01_SOURCES += ../support/fstest_support.h
+jffs2_fsscandir01_SOURCES += ../support/fstest.h
+jffs2_fsscandir01_SOURCES += ../../psxtests/include/pmacros.h
+jffs2_fsscandir01_SOURCES += ../jffs2_support/fs_support.c
+jffs2_fsscandir01_SOURCES += ../jffs2_support/fs_config.h
+
+dist_rtems_tests_DATA = jffs2_fsscandir01.scn
+#dist_rtems_tests_DATA += jffs2_fsscandir01.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .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_fsscandir01_OBJECTS)
+LINK_LIBS = $(jffs2_fsscandir01_LDLIBS)
+
+jffs2_fsscandir01$(EXEEXT): $(jffs2_fsscandir01_OBJECTS) $(jffs2_fsscandir01_DEPENDENCIES)
+	@rm -f jffs2_fsscandir01$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/fstests/jffs2_fsscandir01/jffs2_fsscandir01.scn b/testsuites/fstests/jffs2_fsscandir01/jffs2_fsscandir01.scn
new file mode 100644
index 0000000..c30703f
--- /dev/null
+++ b/testsuites/fstests/jffs2_fsscandir01/jffs2_fsscandir01.scn
@@ -0,0 +1,7 @@
+*** BEGIN OF TEST FSSCANDIR JFFS2 ***
+Initializing filesystem JFFS2
+scandir: Success
+
+
+Shutting down filesystem JFFS2
+*** END OF TEST FSSCANDIR JFFS2 ***
diff --git a/testsuites/fstests/mdosfs_fsscandir01/Makefile.am b/testsuites/fstests/mdosfs_fsscandir01/Makefile.am
new file mode 100644
index 0000000..ea67f71
--- /dev/null
+++ b/testsuites/fstests/mdosfs_fsscandir01/Makefile.am
@@ -0,0 +1,33 @@
+
+rtems_tests_PROGRAMS = mdosfs_fsscandir01
+mdosfs_fsscandir01_SOURCES  = ../fsscandir01/init.c
+mdosfs_fsscandir01_SOURCES += ../support/ramdisk_support.c
+mdosfs_fsscandir01_SOURCES += ../support/fstest_support.c
+mdosfs_fsscandir01_SOURCES += ../support/fstest_support.h
+mdosfs_fsscandir01_SOURCES += ../support/ramdisk_support.h
+mdosfs_fsscandir01_SOURCES += ../support/fstest.h
+mdosfs_fsscandir01_SOURCES += ../../psxtests/include/pmacros.h
+mdosfs_fsscandir01_SOURCES += ../mdosfs_support/fs_support.c
+mdosfs_fsscandir01_SOURCES += ../mdosfs_support/fs_config.h
+
+dist_rtems_tests_DATA = mdosfs_fsscandir01.scn
+#dist_rtems_tests_DATA += mdosfs_fsscandir01.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+
+AM_CPPFLAGS += -I$(top_srcdir)/support
+AM_CPPFLAGS += -I$(top_srcdir)/mdosfs_support
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -I$(top_srcdir)/../psxtests/include
+
+LINK_OBJS = $(mdosfs_fsscandir01_OBJECTS)
+LINK_LIBS = $(mdosfs_fsscandir01_LDLIBS)
+
+mdosfs_fsscandir01$(EXEEXT): $(mdosfs_fsscandir01_OBJECTS) $(mdosfs_fsscandir01_DEPENDENCIES)
+	@rm -f mdosfs_fsscandir01$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/fstests/mdosfs_fsscandir01/mdosfs_fsscandir01.scn b/testsuites/fstests/mdosfs_fsscandir01/mdosfs_fsscandir01.scn
new file mode 100644
index 0000000..4cedc78
--- /dev/null
+++ b/testsuites/fstests/mdosfs_fsscandir01/mdosfs_fsscandir01.scn
@@ -0,0 +1,6 @@
+*** BEGIN OF TEST FSSCANDIR DOSFS ***
+Initializing filesystem DOSFS
+
+
+Shutting down filesystem DOSFS
+*** END OF TEST FSSCANDIR DOSFS ***
diff --git a/testsuites/fstests/mimfs_fsscandir01/Makefile.am b/testsuites/fstests/mimfs_fsscandir01/Makefile.am
new file mode 100644
index 0000000..1f8a554
--- /dev/null
+++ b/testsuites/fstests/mimfs_fsscandir01/Makefile.am
@@ -0,0 +1,31 @@
+
+rtems_tests_PROGRAMS = mimfs_fsscandir01
+mimfs_fsscandir01_SOURCES  = ../fsscandir01/init.c
+mimfs_fsscandir01_SOURCES += ../support/fstest_support.c
+mimfs_fsscandir01_SOURCES += ../support/fstest_support.h
+mimfs_fsscandir01_SOURCES += ../support/fstest.h
+mimfs_fsscandir01_SOURCES += ../../psxtests/include/pmacros.h
+mimfs_fsscandir01_SOURCES += ../mimfs_support/fs_support.c
+mimfs_fsscandir01_SOURCES += ../mimfs_support/fs_config.h
+
+#dist_rtems_tests_DATA = mimfs_fsscandir01.scn
+#dist_rtems_tests_DATA += mimfs_fsscandir01.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+
+AM_CPPFLAGS += -I$(top_srcdir)/support
+AM_CPPFLAGS += -I$(top_srcdir)/mimfs_support
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -I$(top_srcdir)/../psxtests/include
+
+LINK_OBJS = $(mimfs_fsscandir01_OBJECTS)
+LINK_LIBS = $(mimfs_fsscandir01_LDLIBS)
+
+mimfs_fsscandir01$(EXEEXT): $(mimfs_fsscandir01_OBJECTS) $(mimfs_fsscandir01_DEPENDENCIES)
+	@rm -f mimfs_fsscandir01$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/fstests/mimfs_fsscandir01/mimfs_fsscandir01.scn b/testsuites/fstests/mimfs_fsscandir01/mimfs_fsscandir01.scn
new file mode 100644
index 0000000..39577ff
--- /dev/null
+++ b/testsuites/fstests/mimfs_fsscandir01/mimfs_fsscandir01.scn
@@ -0,0 +1,7 @@
+*** BEGIN OF TEST FSSCANDIR MOUNTED IMFS ***
+Initializing filesystem MOUNTED IMFS
+scandir: Success
+
+
+Shutting down filesystem MOUNTED IMFS
+*** END OF TEST FSSCANDIR MOUNTED IMFS ***
diff --git a/testsuites/fstests/mrfs_fsscandir01/Makefile.am b/testsuites/fstests/mrfs_fsscandir01/Makefile.am
new file mode 100644
index 0000000..6ef3a6b
--- /dev/null
+++ b/testsuites/fstests/mrfs_fsscandir01/Makefile.am
@@ -0,0 +1,33 @@
+
+rtems_tests_PROGRAMS = mrfs_fsscandir01
+mrfs_fsscandir01_SOURCES  = ../fsscandir01/init.c
+mrfs_fsscandir01_SOURCES += ../support/ramdisk_support.c
+mrfs_fsscandir01_SOURCES += ../support/fstest_support.c
+mrfs_fsscandir01_SOURCES += ../support/fstest_support.h
+mrfs_fsscandir01_SOURCES += ../support/ramdisk_support.h
+mrfs_fsscandir01_SOURCES += ../support/fstest.h
+mrfs_fsscandir01_SOURCES += ../../psxtests/include/pmacros.h
+mrfs_fsscandir01_SOURCES += ../mrfs_support/fs_support.c
+mrfs_fsscandir01_SOURCES += ../mrfs_support/fs_config.h
+
+dist_rtems_tests_DATA = mrfs_fsscandir01.scn
+#dist_rtems_tests_DATA += mrfs_fsscandir01.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+
+AM_CPPFLAGS += -I$(top_srcdir)/support
+AM_CPPFLAGS += -I$(top_srcdir)/mrfs_support
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -I$(top_srcdir)/../psxtests/include
+
+LINK_OBJS = $(mrfs_fsscandir01_OBJECTS)
+LINK_LIBS = $(mrfs_fsscandir01_LDLIBS)
+
+mrfs_fsscandir01$(EXEEXT): $(mrfs_fsscandir01_OBJECTS) $(mrfs_fsscandir01_DEPENDENCIES)
+	@rm -f mrfs_fsscandir01$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/fstests/mrfs_fsscandir01/mrfs_fsscandir01.scn b/testsuites/fstests/mrfs_fsscandir01/mrfs_fsscandir01.scn
new file mode 100644
index 0000000..3f55d65
--- /dev/null
+++ b/testsuites/fstests/mrfs_fsscandir01/mrfs_fsscandir01.scn
@@ -0,0 +1,7 @@
+*** BEGIN OF TEST FSSCANDIR RFS ***
+Initializing filesystem RFS
+.
+
+
+Shutting down filesystem RFS
+*** END OF TEST FSSCANDIR RFS ***




More information about the vc mailing list