Ticket #1394: 0001-Add-simple-test-for-scandir-on-all-file-systems-test.patch

File 0001-Add-simple-test-for-scandir-on-all-file-systems-test.patch, 13.4 KB (added by Joel Sherrill, on Mar 3, 2015 at 9:17:09 PM)

fstest suite scandir() family of tests

  • testsuites/fstests/Makefile.am

    From 2b8c74c024becf072885974a69a710f439a63dcc Mon Sep 17 00:00:00 2001
    From: Joel Sherrill <joel.sherrill@oarcorp.com>
    Date: Tue, 3 Mar 2015 15:15:00 -0600
    Subject: [PATCH] Add simple test for scandir() on all file systems tested
    
    ---
     testsuites/fstests/Makefile.am                     |    5 ++
     testsuites/fstests/configure.ac                    |    5 ++
     testsuites/fstests/fsscandir01/init.c              |   52 ++++++++++++++++++++
     testsuites/fstests/imfs_fsscandir01/Makefile.am    |   31 ++++++++++++
     testsuites/fstests/jffs2_fsscandir01/Makefile.am   |   31 ++++++++++++
     testsuites/fstests/mdosfs_fsscandir01/Makefile.am  |   33 ++++++++++++
     testsuites/fstests/mimfs_fsscandir01/Makefile.am   |   31 ++++++++++++
     testsuites/fstests/mrfs_fsscandir01/Makefile.am    |   33 ++++++++++++
     8 files changed, 221 insertions(+), 0 deletions(-)
     create mode 100644 testsuites/fstests/fsscandir01/fsscandir01.doc
     create mode 100644 testsuites/fstests/fsscandir01/init.c
     create mode 100644 testsuites/fstests/imfs_fsscandir01/Makefile.am
     create mode 100644 testsuites/fstests/imfs_fsscandir01/imfs_fsscandir01.scn
     create mode 100644 testsuites/fstests/jffs2_fsscandir01/Makefile.am
     create mode 100644 testsuites/fstests/jffs2_fsscandir01/jffs2_fsscandir01.scn
     create mode 100644 testsuites/fstests/mdosfs_fsscandir01/Makefile.am
     create mode 100644 testsuites/fstests/mdosfs_fsscandir01/mdosfs_fsscandir01.scn
     create mode 100644 testsuites/fstests/mimfs_fsscandir01/Makefile.am
     create mode 100644 testsuites/fstests/mimfs_fsscandir01/mimfs_fsscandir01.scn
     create mode 100644 testsuites/fstests/mrfs_fsscandir01/Makefile.am
     create mode 100644 testsuites/fstests/mrfs_fsscandir01/mrfs_fsscandir01.scn
    
    diff --git a/testsuites/fstests/Makefile.am b/testsuites/fstests/Makefile.am
    index 4812c8a..930fbd7 100644
    a b _SUBDIRS += imfs_fslink 
    1414_SUBDIRS += imfs_fspatheval
    1515_SUBDIRS += imfs_fspermission
    1616_SUBDIRS += imfs_fsrdwr
     17_SUBDIRS += imfs_fsscandir01
    1718_SUBDIRS += imfs_fssymlink
    1819_SUBDIRS += imfs_fstime
    1920_SUBDIRS += jffs2_fserror
    _SUBDIRS += jffs2_fslink 
    2122_SUBDIRS += jffs2_fspatheval
    2223_SUBDIRS += jffs2_fspermission
    2324_SUBDIRS += jffs2_fsrdwr
     25_SUBDIRS += jffs2_fsscandir01
    2426_SUBDIRS += jffs2_fssymlink
    2527_SUBDIRS += jffs2_fstime
    2628_SUBDIRS += mdosfs_fserror
    2729_SUBDIRS += mdosfs_fspatheval
    2830_SUBDIRS += mdosfs_fsrdwr
    2931_SUBDIRS += mdosfs_fsstatvfs
     32_SUBDIRS += mdosfs_fsscandir01
    3033_SUBDIRS += mdosfs_fstime
    3134_SUBDIRS += mimfs_fserror
    3235_SUBDIRS += mimfs_fslink
    3336_SUBDIRS += mimfs_fspatheval
    3437_SUBDIRS += mimfs_fspermission
    3538_SUBDIRS += mimfs_fsrdwr
     39_SUBDIRS += mimfs_fsscandir01
    3640_SUBDIRS += mimfs_fssymlink
    3741_SUBDIRS += mimfs_fstime
    3842_SUBDIRS += mimfs_fsrename
    _SUBDIRS += mrfs_fslink 
    4145_SUBDIRS += mrfs_fspatheval
    4246_SUBDIRS += mrfs_fspermission
    4347_SUBDIRS += mrfs_fsrdwr
     48_SUBDIRS += mrfs_fsscandir01
    4449_SUBDIRS += mrfs_fssymlink
    4550_SUBDIRS += mrfs_fstime
    4651_SUBDIRS += mrfs_fsfpathconf
  • testsuites/fstests/configure.ac

    diff --git a/testsuites/fstests/configure.ac b/testsuites/fstests/configure.ac
    index 78800b3..f0bbaaf 100644
    a b imfs_fslink/Makefile 
    9090imfs_fspatheval/Makefile
    9191imfs_fspermission/Makefile
    9292imfs_fsrdwr/Makefile
     93imfs_fsscandir01/Makefile
    9394imfs_fssymlink/Makefile
    9495imfs_fstime/Makefile
    9596jffs2_fserror/Makefile
    jffs2_fslink/Makefile 
    9798jffs2_fspatheval/Makefile
    9899jffs2_fspermission/Makefile
    99100jffs2_fsrdwr/Makefile
     101jffs2_fsscandir01/Makefile
    100102jffs2_fssymlink/Makefile
    101103jffs2_fstime/Makefile
    102104mdosfs_fserror/Makefile
    103105mdosfs_fspatheval/Makefile
    104106mdosfs_fsrdwr/Makefile
     107mdosfs_fsscandir01/Makefile
    105108mdosfs_fsstatvfs/Makefile
    106109mdosfs_fstime/Makefile
    107110mimfs_fserror/Makefile
    mimfs_fslink/Makefile 
    109112mimfs_fspatheval/Makefile
    110113mimfs_fspermission/Makefile
    111114mimfs_fsrdwr/Makefile
     115mimfs_fsscandir01/Makefile
    112116mimfs_fssymlink/Makefile
    113117mimfs_fstime/Makefile
    114118mimfs_fsrename/Makefile
    mrfs_fslink/Makefile 
    117121mrfs_fspatheval/Makefile
    118122mrfs_fspermission/Makefile
    119123mrfs_fsrdwr/Makefile
     124mrfs_fsscandir01/Makefile
    120125mrfs_fssymlink/Makefile
    121126mrfs_fstime/Makefile
    122127mrfs_fsfpathconf/Makefile
  • new file testsuites/fstests/fsscandir01/init.c

    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
    - +  
     1/*
     2 *  COPYRIGHT (c) 2015.
     3 *  On-Line Applications Research Corporation (OAR).
     4 * 
     5 *  The license and distribution terms for this file may be
     6 *  found in the file LICENSE in this distribution or at
     7 *  http://www.rtems.org/license/LICENSE.
     8 */
     9
     10#ifdef HAVE_CONFIG_H
     11  #include "config.h"
     12#endif
     13
     14#include "fstest.h"
     15#include "fs_config.h"
     16#include "fstest_support.h"
     17#include "pmacros.h"
     18
     19#include <dirent.h>
     20#include <stdio.h>
     21#include <string.h>
     22#include <unistd.h>
     23#include <errno.h>
     24#include <limits.h>
     25
     26const char rtems_test_name[] = "FSSCANDIR " FILESYSTEM;
     27
     28/*
     29 * This code is from the scandir() man page.
     30 */
     31static void test_scandir(void)
     32{
     33  struct dirent **namelist;
     34  int n;
     35
     36  n = scandir(".", &namelist, 0, NULL);
     37  if (n < 0) {
     38    perror("scandir");
     39  } else {
     40    while(n--) {
     41      printf("%s\n", namelist[n]->d_name);
     42      free(namelist[n]);
     43    }
     44    free(namelist);
     45  }
     46}
     47
     48
     49void test (void)
     50{
     51  test_scandir();
     52}
  • new file testsuites/fstests/imfs_fsscandir01/Makefile.am

    diff --git a/testsuites/fstests/imfs_fsscandir01/Makefile.am b/testsuites/fstests/imfs_fsscandir01/Makefile.am
    new file mode 100644
    index 0000000..86bd06e
    - +  
     1
     2rtems_tests_PROGRAMS = imfs_fsscandir01
     3imfs_fsscandir01_SOURCES  = ../fsscandir01/init.c
     4imfs_fsscandir01_SOURCES += ../support/fstest_support.c
     5imfs_fsscandir01_SOURCES += ../support/fstest_support.h
     6imfs_fsscandir01_SOURCES += ../support/fstest.h
     7imfs_fsscandir01_SOURCES += ../../psxtests/include/pmacros.h
     8imfs_fsscandir01_SOURCES += ../imfs_support/fs_support.c
     9imfs_fsscandir01_SOURCES += ../imfs_support/fs_config.h
     10
     11#dist_rtems_tests_DATA = imfs_fsscandir01.scn
     12#dist_rtems_tests_DATA += imfs_fsscandir01.doc
     13
     14include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
     15include $(top_srcdir)/../automake/compile.am
     16include $(top_srcdir)/../automake/leaf.am
     17
     18
     19AM_CPPFLAGS += -I$(top_srcdir)/support
     20AM_CPPFLAGS += -I$(top_srcdir)/imfs_support
     21AM_CPPFLAGS += -I$(top_srcdir)/../support/include
     22AM_CPPFLAGS += -I$(top_srcdir)/../psxtests/include
     23
     24LINK_OBJS = $(imfs_fsscandir01_OBJECTS)
     25LINK_LIBS = $(imfs_fsscandir01_LDLIBS)
     26
     27imfs_fsscandir01$(EXEEXT): $(imfs_fsscandir01_OBJECTS) $(imfs_fsscandir01_DEPENDENCIES)
     28        @rm -f imfs_fsscandir01$(EXEEXT)
     29        $(make-exe)
     30
     31include $(top_srcdir)/../automake/local.am
  • new file testsuites/fstests/jffs2_fsscandir01/Makefile.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..e69de29
    diff --git a/testsuites/fstests/jffs2_fsscandir01/Makefile.am b/testsuites/fstests/jffs2_fsscandir01/Makefile.am
    new file mode 100644
    index 0000000..8fad0b3
    - +  
     1
     2rtems_tests_PROGRAMS = jffs2_fsscandir01
     3jffs2_fsscandir01_SOURCES  = ../fsscandir01/init.c
     4jffs2_fsscandir01_SOURCES += ../support/fstest_support.c
     5jffs2_fsscandir01_SOURCES += ../support/fstest_support.h
     6jffs2_fsscandir01_SOURCES += ../support/fstest.h
     7jffs2_fsscandir01_SOURCES += ../../psxtests/include/pmacros.h
     8jffs2_fsscandir01_SOURCES += ../jffs2_support/fs_support.c
     9jffs2_fsscandir01_SOURCES += ../jffs2_support/fs_config.h
     10
     11dist_rtems_tests_DATA = jffs2_fsscandir01.scn
     12#dist_rtems_tests_DATA += jffs2_fsscandir01.doc
     13
     14include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
     15include $(top_srcdir)/../automake/compile.am
     16include $(top_srcdir)/../automake/leaf.am
     17
     18
     19AM_CPPFLAGS += -I$(top_srcdir)/support
     20AM_CPPFLAGS += -I$(top_srcdir)/jffs2_support
     21AM_CPPFLAGS += -I$(top_srcdir)/../support/include
     22AM_CPPFLAGS += -I$(top_srcdir)/../psxtests/include
     23
     24LINK_OBJS = $(jffs2_fsscandir01_OBJECTS)
     25LINK_LIBS = $(jffs2_fsscandir01_LDLIBS)
     26
     27jffs2_fsscandir01$(EXEEXT): $(jffs2_fsscandir01_OBJECTS) $(jffs2_fsscandir01_DEPENDENCIES)
     28        @rm -f jffs2_fsscandir01$(EXEEXT)
     29        $(make-exe)
     30
     31include $(top_srcdir)/../automake/local.am
  • new file testsuites/fstests/mdosfs_fsscandir01/Makefile.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..e69de29
    diff --git a/testsuites/fstests/mdosfs_fsscandir01/Makefile.am b/testsuites/fstests/mdosfs_fsscandir01/Makefile.am
    new file mode 100644
    index 0000000..ea67f71
    - +  
     1
     2rtems_tests_PROGRAMS = mdosfs_fsscandir01
     3mdosfs_fsscandir01_SOURCES  = ../fsscandir01/init.c
     4mdosfs_fsscandir01_SOURCES += ../support/ramdisk_support.c
     5mdosfs_fsscandir01_SOURCES += ../support/fstest_support.c
     6mdosfs_fsscandir01_SOURCES += ../support/fstest_support.h
     7mdosfs_fsscandir01_SOURCES += ../support/ramdisk_support.h
     8mdosfs_fsscandir01_SOURCES += ../support/fstest.h
     9mdosfs_fsscandir01_SOURCES += ../../psxtests/include/pmacros.h
     10mdosfs_fsscandir01_SOURCES += ../mdosfs_support/fs_support.c
     11mdosfs_fsscandir01_SOURCES += ../mdosfs_support/fs_config.h
     12
     13dist_rtems_tests_DATA = mdosfs_fsscandir01.scn
     14#dist_rtems_tests_DATA += mdosfs_fsscandir01.doc
     15
     16include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
     17include $(top_srcdir)/../automake/compile.am
     18include $(top_srcdir)/../automake/leaf.am
     19
     20
     21AM_CPPFLAGS += -I$(top_srcdir)/support
     22AM_CPPFLAGS += -I$(top_srcdir)/mdosfs_support
     23AM_CPPFLAGS += -I$(top_srcdir)/../support/include
     24AM_CPPFLAGS += -I$(top_srcdir)/../psxtests/include
     25
     26LINK_OBJS = $(mdosfs_fsscandir01_OBJECTS)
     27LINK_LIBS = $(mdosfs_fsscandir01_LDLIBS)
     28
     29mdosfs_fsscandir01$(EXEEXT): $(mdosfs_fsscandir01_OBJECTS) $(mdosfs_fsscandir01_DEPENDENCIES)
     30        @rm -f mdosfs_fsscandir01$(EXEEXT)
     31        $(make-exe)
     32
     33include $(top_srcdir)/../automake/local.am
  • new file testsuites/fstests/mimfs_fsscandir01/Makefile.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..e69de29
    diff --git a/testsuites/fstests/mimfs_fsscandir01/Makefile.am b/testsuites/fstests/mimfs_fsscandir01/Makefile.am
    new file mode 100644
    index 0000000..1f8a554
    - +  
     1
     2rtems_tests_PROGRAMS = mimfs_fsscandir01
     3mimfs_fsscandir01_SOURCES  = ../fsscandir01/init.c
     4mimfs_fsscandir01_SOURCES += ../support/fstest_support.c
     5mimfs_fsscandir01_SOURCES += ../support/fstest_support.h
     6mimfs_fsscandir01_SOURCES += ../support/fstest.h
     7mimfs_fsscandir01_SOURCES += ../../psxtests/include/pmacros.h
     8mimfs_fsscandir01_SOURCES += ../mimfs_support/fs_support.c
     9mimfs_fsscandir01_SOURCES += ../mimfs_support/fs_config.h
     10
     11#dist_rtems_tests_DATA = mimfs_fsscandir01.scn
     12#dist_rtems_tests_DATA += mimfs_fsscandir01.doc
     13
     14include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
     15include $(top_srcdir)/../automake/compile.am
     16include $(top_srcdir)/../automake/leaf.am
     17
     18
     19AM_CPPFLAGS += -I$(top_srcdir)/support
     20AM_CPPFLAGS += -I$(top_srcdir)/mimfs_support
     21AM_CPPFLAGS += -I$(top_srcdir)/../support/include
     22AM_CPPFLAGS += -I$(top_srcdir)/../psxtests/include
     23
     24LINK_OBJS = $(mimfs_fsscandir01_OBJECTS)
     25LINK_LIBS = $(mimfs_fsscandir01_LDLIBS)
     26
     27mimfs_fsscandir01$(EXEEXT): $(mimfs_fsscandir01_OBJECTS) $(mimfs_fsscandir01_DEPENDENCIES)
     28        @rm -f mimfs_fsscandir01$(EXEEXT)
     29        $(make-exe)
     30
     31include $(top_srcdir)/../automake/local.am
  • new file testsuites/fstests/mrfs_fsscandir01/Makefile.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..e69de29
    diff --git a/testsuites/fstests/mrfs_fsscandir01/Makefile.am b/testsuites/fstests/mrfs_fsscandir01/Makefile.am
    new file mode 100644
    index 0000000..6ef3a6b
    - +  
     1
     2rtems_tests_PROGRAMS = mrfs_fsscandir01
     3mrfs_fsscandir01_SOURCES  = ../fsscandir01/init.c
     4mrfs_fsscandir01_SOURCES += ../support/ramdisk_support.c
     5mrfs_fsscandir01_SOURCES += ../support/fstest_support.c
     6mrfs_fsscandir01_SOURCES += ../support/fstest_support.h
     7mrfs_fsscandir01_SOURCES += ../support/ramdisk_support.h
     8mrfs_fsscandir01_SOURCES += ../support/fstest.h
     9mrfs_fsscandir01_SOURCES += ../../psxtests/include/pmacros.h
     10mrfs_fsscandir01_SOURCES += ../mrfs_support/fs_support.c
     11mrfs_fsscandir01_SOURCES += ../mrfs_support/fs_config.h
     12
     13dist_rtems_tests_DATA = mrfs_fsscandir01.scn
     14#dist_rtems_tests_DATA += mrfs_fsscandir01.doc
     15
     16include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
     17include $(top_srcdir)/../automake/compile.am
     18include $(top_srcdir)/../automake/leaf.am
     19
     20
     21AM_CPPFLAGS += -I$(top_srcdir)/support
     22AM_CPPFLAGS += -I$(top_srcdir)/mrfs_support
     23AM_CPPFLAGS += -I$(top_srcdir)/../support/include
     24AM_CPPFLAGS += -I$(top_srcdir)/../psxtests/include
     25
     26LINK_OBJS = $(mrfs_fsscandir01_OBJECTS)
     27LINK_LIBS = $(mrfs_fsscandir01_LDLIBS)
     28
     29mrfs_fsscandir01$(EXEEXT): $(mrfs_fsscandir01_OBJECTS) $(mrfs_fsscandir01_DEPENDENCIES)
     30        @rm -f mrfs_fsscandir01$(EXEEXT)
     31        $(make-exe)
     32
     33include $(top_srcdir)/../automake/local.am