diff options
author | Joel Sherrill <joel.sherrill@oarcorp.com> | 2015-03-03 15:15:00 -0600 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@oarcorp.com> | 2015-03-04 14:46:14 -0600 |
commit | 57a914a3fb2295eceff71b18f96a6a4e66542334 (patch) | |
tree | d9de15013aa9fb098615f91b3c4e93c8f003e5f6 /testsuites/fstests/fsscandir01 | |
parent | psxtests/psxclock01: use clock() and CLOCKS_PER_SEC (diff) | |
download | rtems-57a914a3fb2295eceff71b18f96a6a4e66542334.tar.bz2 |
Add simple test for scandir() on all file systems tested
updates 1394
Diffstat (limited to 'testsuites/fstests/fsscandir01')
-rw-r--r-- | testsuites/fstests/fsscandir01/fsscandir01.doc | 0 | ||||
-rw-r--r-- | testsuites/fstests/fsscandir01/init.c | 52 |
2 files changed, 52 insertions, 0 deletions
diff --git a/testsuites/fstests/fsscandir01/fsscandir01.doc b/testsuites/fstests/fsscandir01/fsscandir01.doc new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/testsuites/fstests/fsscandir01/fsscandir01.doc diff --git a/testsuites/fstests/fsscandir01/init.c b/testsuites/fstests/fsscandir01/init.c new file mode 100644 index 0000000000..9cfd88e829 --- /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(); +} |