diff --git a/examples/README.txt b/examples/README.txt index 8dcfb3cbe..523002537 100644 --- a/examples/README.txt +++ b/examples/README.txt @@ -451,24 +451,6 @@ examples/ft80x GUI chip. As an example configuration, see nuttx/configs/viewtool-stm32f107/ft80x/defconfig. -examples/fstest -^^^^^^^^^^^^^^ - - This is a generic file system test that derives from examples/nxffs. It - was created to test the tmpfs file system, but should work with any file - system provided that all initialization has already been performed prior - to starting the test. - - * CONFIG_EXAMPLES_FSTEST: Enable the file system example - * CONFIG_EXAMPLES_FSTEST_MAXNAME: Determines the maximum size of names used - in the filesystem - * CONFIG_EXAMPLES_FSTEST_MAXFILE: Determines the maximum size of a file - * CONFIG_EXAMPLES_FSTEST_MAXIO: Max I/O, default 347. - * CONFIG_EXAMPLES_FSTEST_MAXOPEN: Max open files. - * CONFIG_EXAMPLES_FSTEST_MOUNTPT: Path where the file system is mounted. - * CONFIG_EXAMPLES_FSTEST_NLOOPS: Number of test loops. default 100 - * CONFIG_EXAMPLES_FSTEST_VERBOSE: Verbose output - examples/ftpc ^^^^^^^^^^^^^ @@ -1090,14 +1072,6 @@ examples/nxterm CONFIG_EXAMPLES_NXTERM_NOTIFYSIGNO -- The signal number to use with nx_eventnotify(). Default: 4 -examples/nxffs -^^^^^^^^^^^^^^ - - This is a test of the NuttX NXFFS FLASH file system. This is an NXFFS - stress test and beats on the file system very hard. It should only - be used in a simulation environment! Putting this NXFFS test on real - hardware will most likely destroy your FLASH. You have been warned. - examples/nxflat ^^^^^^^^^^^^^^^ @@ -1645,44 +1619,6 @@ examples/slcd * CONFIG_EXAMPLES_SLCD - Enable the SLCD test -examples/smart -^^^^^^^^^^^^^^ - - This is a test of the SMART file system that derives from - examples/nxffs. - - * CONFIG_EXAMPLES_SMART: - Enable the SMART file system example - * CONFIG_EXAMPLES_SMART_ARCHINIT: The default is to use the RAM MTD - device at drivers/mtd/rammtd.c. But an architecture-specific MTD - driver can be used instead by defining CONFIG_EXAMPLES_SMART_ARCHINIT. In - this case, the initialization logic will call smart_archinitialize() - to obtain the MTD driver instance. - * CONFIG_EXAMPLES_SMART_NEBLOCKS: When CONFIG_EXAMPLES_SMART_ARCHINIT is not - defined, this test will use the RAM MTD device at drivers/mtd/rammtd.c - to simulate FLASH. In this case, this value must be provided to give - the nubmer of erase blocks in MTD RAM device. The size of the allocated - RAM drive will be: CONFIG_RAMMTD_ERASESIZE * CONFIG_EXAMPLES_SMART_NEBLOCKS - * CONFIG_EXAMPLES_SMART_MAXNAME: Determines the maximum size of names used - in the filesystem - * CONFIG_EXAMPLES_SMART_MAXFILE: Determines the maximum size of a file - * CONFIG_EXAMPLES_SMART_MAXIO: Max I/O, default 347. - * CONFIG_EXAMPLES_SMART_MAXOPEN: Max open files. - * CONFIG_EXAMPLES_SMART_MOUNTPT: SMART mountpoint - * CONFIG_EXAMPLES_SMART_NLOOPS: Number of test loops. default 100 - * CONFIG_EXAMPLES_SMART_VERBOSE: Verbose output - -examples/smart_test -^^^^^^^^^^^^^^^^^^^ - - Performs a file-based test on a SMART (or any) filesystem. Validates - seek, append and seek-with-write operations. - - * CONFIG_EXAMPLES_SMART_TEST=y - - Dependencies: - - * CONFIG_NSH_BUILTIN_APPS=y: This test can be built only as an NSH - command examples/smps ^^^^^^^^^^^^^ diff --git a/examples/smart_test/README.txt b/examples/smart_test/README.txt deleted file mode 100644 index 3cd9e5536..000000000 --- a/examples/smart_test/README.txt +++ /dev/null @@ -1,17 +0,0 @@ - -Install Program -=============== - - Source: NuttX - Author: Ken Pettit - Date: April 24, 2013 - -Performs a file-based test on a SMART (or any) filesystem. Validates seek, -append and seek-with-write operations. - -Usage: - flash_test mtdblock_device - -Additional options: - - --force to replace existing installation diff --git a/testing/README.txt b/testing/README.txt index 509270488..374a16e8d 100644 --- a/testing/README.txt +++ b/testing/README.txt @@ -4,8 +4,37 @@ apps/testing README file The apps/testing directory is used to build NuttX-specific tests and to include external testing frameworks -examples/ostest -^^^^^^^^^^^^^^^ +testing/fstest +============== + + This is a generic file system test that derives from testing/nxffs. It + was created to test the tmpfs file system, but should work with any file + system provided that all initialization has already been performed prior + to starting the test. + + This test a a general test for any file system, but includes some specific + hooks for the SPIFFS file system. + + * CONFIG_TESTING_FSTEST: Enable the file system example + * CONFIG_TESTING_FSTEST_MAXNAME: Determines the maximum size of names used + in the filesystem + * CONFIG_TESTING_FSTEST_MAXFILE: Determines the maximum size of a file + * CONFIG_TESTING_FSTEST_MAXIO: Max I/O, default 347. + * CONFIG_TESTING_FSTEST_MAXOPEN: Max open files. + * CONFIG_TESTING_FSTEST_MOUNTPT: Path where the file system is mounted. + * CONFIG_TESTING_FSTEST_NLOOPS: Number of test loops. default 100 + * CONFIG_TESTING_FSTEST_VERBOSE: Verbose output + +testing/nxffs +============= + + This is a test of the NuttX NXFFS FLASH file system. This is an NXFFS + stress test and beats on the file system very hard. It should only + be used in a simulation environment! Putting this NXFFS test on real + hardware will most likely destroy your FLASH. You have been warned. + +testing/ostest +============== This is the NuttX 'qualification' suite. It attempts to exercise a broad set of OS functionality. Its coverage is not very extensive @@ -38,8 +67,68 @@ examples/ostest searches for prime numbers in the configurable range, doing that configurable number of times. +testing/smart +============= + + This is a test of the SMART file system that derives from + testing/nxffs. + + * CONFIG_TESTING_SMART: - Enable the SMART file system example + * CONFIG_TESTING_SMART_ARCHINIT: The default is to use the RAM MTD + device at drivers/mtd/rammtd.c. But an architecture-specific MTD + driver can be used instead by defining CONFIG_TESTING_SMART_ARCHINIT. In + this case, the initialization logic will call smart_archinitialize() + to obtain the MTD driver instance. + * CONFIG_TESTING_SMART_NEBLOCKS: When CONFIG_TESTING_SMART_ARCHINIT is not + defined, this test will use the RAM MTD device at drivers/mtd/rammtd.c + to simulate FLASH. In this case, this value must be provided to give + the nubmer of erase blocks in MTD RAM device. The size of the allocated + RAM drive will be: CONFIG_RAMMTD_ERASESIZE * CONFIG_TESTING_SMART_NEBLOCKS + * CONFIG_TESTING_SMART_MAXNAME: Determines the maximum size of names used + in the filesystem + * CONFIG_TESTING_SMART_MAXFILE: Determines the maximum size of a file + * CONFIG_TESTING_SMART_MAXIO: Max I/O, default 347. + * CONFIG_TESTING_SMART_MAXOPEN: Max open files. + * CONFIG_TESTING_SMART_MOUNTPT: SMART mountpoint + * CONFIG_TESTING_SMART_NLOOPS: Number of test loops. default 100 + * CONFIG_TESTING_SMART_VERBOSE: Verbose output + +testing/smart_test +================== + + Performs a file-based test on a SMART (or any) filesystem. Validates + seek, append and seek-with-write operations. + + * CONFIG_TESTING_SMART_TEST=y + + Dependencies: + + * CONFIG_NSH_BUILTIN_APPS=y: This test can be built only as an NSH + command + + Source: NuttX + Author: Ken Pettit + Date: April 24, 2013 + + Performs a file-based test on a SMART (or any) filesystem. Validates seek, + append and seek-with-write operations. + + Usage: + + flash_test mtdblock_device + + Additional options: + + --force to replace existing installation + +testing/smp +=========== + + This is a simple test for SMP functionality. It is basically just the + pthread barrier test with some custom instrumentation. + testing/unity -^^^^^^^^^^^^^^ +============= Unity is a unit testing framework for C developed by ThrowTheSwitch.org: diff --git a/examples/fstest/.gitignore b/testing/fstest/.gitignore similarity index 100% rename from examples/fstest/.gitignore rename to testing/fstest/.gitignore diff --git a/examples/fstest/Kconfig b/testing/fstest/Kconfig similarity index 77% rename from examples/fstest/Kconfig rename to testing/fstest/Kconfig index e36668b3e..10e206344 100644 --- a/examples/fstest/Kconfig +++ b/testing/fstest/Kconfig @@ -3,16 +3,16 @@ # see the file kconfig-language.txt in the NuttX tools repository. # -config EXAMPLES_FSTEST +config TESTING_FSTEST tristate "Generic file system test" default n depends on FS_READABLE && FS_WRITABLE ---help--- Enable the generic file system test -if EXAMPLES_FSTEST +if TESTING_FSTEST -config EXAMPLES_FSTEST_PROGNAME +config TESTING_FSTEST_PROGNAME string "Program name" default "fstest" depends on BUILD_LOADABLE @@ -20,43 +20,43 @@ config EXAMPLES_FSTEST_PROGNAME This is the name of the program that will be use when the NSH ELF program is installed. -config EXAMPLES_FSTEST_PRIORITY +config TESTING_FSTEST_PRIORITY int "FS test task priority" default 100 -config EXAMPLES_FSTEST_STACKSIZE +config TESTING_FSTEST_STACKSIZE int "FS test stack size" default 2048 -config EXAMPLES_FSTEST_MAXNAME +config TESTING_FSTEST_MAXNAME int "Max name size" default 32 range 1 255 ---help--- Determines the maximum size of names used in the filesystem -config EXAMPLES_FSTEST_MAXFILE +config TESTING_FSTEST_MAXFILE int "Max file size" default 8192 ---help--- Determines the maximum size of a file -config EXAMPLES_FSTEST_MAXIO +config TESTING_FSTEST_MAXIO int "Max I/O" default 347 -config EXAMPLES_FSTEST_MAXOPEN +config TESTING_FSTEST_MAXOPEN int "Max open files" default 512 -config EXAMPLES_FSTEST_MOUNTPT +config TESTING_FSTEST_MOUNTPT string "FSTEST mountpoint" -config EXAMPLES_FSTEST_NLOOPS +config TESTING_FSTEST_NLOOPS int "Number of test loops" default 100 -config EXAMPLES_FSTEST_SPIFFS +config TESTING_FSTEST_SPIFFS bool "Enable SPIFFS testing" default y depends on FS_SPIFFS && EXPERIMENTAL @@ -69,7 +69,7 @@ config EXAMPLES_FSTEST_SPIFFS Marked EXPERIMENTAL because it interferes with test performance. -config EXAMPLES_FSTEST_VERBOSE +config TESTING_FSTEST_VERBOSE bool "Verbose output" default n diff --git a/examples/nxffs/Make.defs b/testing/fstest/Make.defs similarity index 94% rename from examples/nxffs/Make.defs rename to testing/fstest/Make.defs index 68d30e6f0..86003fdc8 100644 --- a/examples/nxffs/Make.defs +++ b/testing/fstest/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# apps/examples/nxffs/Make.defs +# apps/testing/fstest/Make.defs # Adds selected applications to apps/ build # # Copyright (C) 2015 Gregory Nutt. All rights reserved. @@ -34,6 +34,6 @@ # ############################################################################ -ifneq ($(CONFIG_EXAMPLES_NXFFS),) -CONFIGURED_APPS += examples/nxffs +ifneq ($(CONFIG_TESTING_FSTEST),) +CONFIGURED_APPS += testing/fstest endif diff --git a/examples/fstest/Makefile b/testing/fstest/Makefile similarity index 84% rename from examples/fstest/Makefile rename to testing/fstest/Makefile index b3803030a..77573b883 100644 --- a/examples/fstest/Makefile +++ b/testing/fstest/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# apps/examples/fstest/Makefile +# apps/testing/fstest/Makefile # # Copyright (C) 2015 Gregory Nutt. All rights reserved. # Author: Gregory Nutt @@ -37,12 +37,12 @@ # Generic file system stress test application info -CONFIG_EXAMPLES_FSTEST_PRIORITY ?= SCHED_PRIORITY_DEFAULT -CONFIG_EXAMPLES_FSTEST_STACKSIZE ?= 2048 +CONFIG_TESTING_FSTEST_PRIORITY ?= SCHED_PRIORITY_DEFAULT +CONFIG_TESTING_FSTEST_STACKSIZE ?= 2048 APPNAME = fstest -PRIORITY = $(CONFIG_EXAMPLES_FSTEST_PRIORITY) -STACKSIZE = $(CONFIG_EXAMPLES_FSTEST_STACKSIZE) +PRIORITY = $(CONFIG_TESTING_FSTEST_PRIORITY) +STACKSIZE = $(CONFIG_TESTING_FSTEST_STACKSIZE) # Generic file system stress test @@ -50,9 +50,9 @@ ASRCS = CSRCS = MAINSRC = fstest_main.c -CONFIG_EXAMPLES_FSTEST_PROGNAME ?= hello$(EXEEXT) -PROGNAME = $(CONFIG_EXAMPLES_FSTEST_PROGNAME) +CONFIG_TESTING_FSTEST_PROGNAME ?= hello$(EXEEXT) +PROGNAME = $(CONFIG_TESTING_FSTEST_PROGNAME) -MODULE = CONFIG_EXAMPLES_FSTEST +MODULE = CONFIG_TESTING_FSTEST include $(APPDIR)/Application.mk diff --git a/testing/fstest/README.txt b/testing/fstest/README.txt new file mode 100644 index 000000000..19a2762e9 --- /dev/null +++ b/testing/fstest/README.txt @@ -0,0 +1,20 @@ +README +====== + + This is a generic file system test that derives from testing/nxffs. It + was created to test the tmpfs file system, but should work with any file + system provided that all initialization has already been performed prior + to starting the test. + + This test a a general test for any file system, but includes some specific + hooks for the SPIFFS file system. + + * CONFIG_TESTING_FSTEST: Enable the file system example + * CONFIG_TESTING_FSTEST_MAXNAME: Determines the maximum size of names used + in the filesystem + * CONFIG_TESTING_FSTEST_MAXFILE: Determines the maximum size of a file + * CONFIG_TESTING_FSTEST_MAXIO: Max I/O, default 347. + * CONFIG_TESTING_FSTEST_MAXOPEN: Max open files. + * CONFIG_TESTING_FSTEST_MOUNTPT: Path where the file system is mounted. + * CONFIG_TESTING_FSTEST_NLOOPS: Number of test loops. default 100 + * CONFIG_TESTING_FSTEST_VERBOSE: Verbose output diff --git a/examples/fstest/fstest_main.c b/testing/fstest/fstest_main.c similarity index 92% rename from examples/fstest/fstest_main.c rename to testing/fstest/fstest_main.c index 8b739b88e..a4eb79352 100644 --- a/examples/fstest/fstest_main.c +++ b/testing/fstest/fstest_main.c @@ -1,5 +1,5 @@ /**************************************************************************** - * examples/fstest/fstest_main.c + * testing/fstest/fstest_main.c * * Copyright (C) 2015, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -59,37 +59,37 @@ ****************************************************************************/ /* Configuration ************************************************************/ -#ifndef CONFIG_EXAMPLES_FSTEST_MAXNAME -# define CONFIG_EXAMPLES_FSTEST_MAXNAME 128 +#ifndef CONFIG_TESTING_FSTEST_MAXNAME +# define CONFIG_TESTING_FSTEST_MAXNAME 128 #endif -#if CONFIG_EXAMPLES_FSTEST_MAXNAME > 255 -# undef CONFIG_EXAMPLES_FSTEST_MAXNAME -# define CONFIG_EXAMPLES_FSTEST_MAXNAME 255 +#if CONFIG_TESTING_FSTEST_MAXNAME > 255 +# undef CONFIG_TESTING_FSTEST_MAXNAME +# define CONFIG_TESTING_FSTEST_MAXNAME 255 #endif -#ifndef CONFIG_EXAMPLES_FSTEST_MAXFILE -# define CONFIG_EXAMPLES_FSTEST_MAXFILE 8192 +#ifndef CONFIG_TESTING_FSTEST_MAXFILE +# define CONFIG_TESTING_FSTEST_MAXFILE 8192 #endif -#ifndef CONFIG_EXAMPLES_FSTEST_MAXIO -# define CONFIG_EXAMPLES_FSTEST_MAXIO 347 +#ifndef CONFIG_TESTING_FSTEST_MAXIO +# define CONFIG_TESTING_FSTEST_MAXIO 347 #endif -#ifndef CONFIG_EXAMPLES_FSTEST_MAXOPEN -# define CONFIG_EXAMPLES_FSTEST_MAXOPEN 512 +#ifndef CONFIG_TESTING_FSTEST_MAXOPEN +# define CONFIG_TESTING_FSTEST_MAXOPEN 512 #endif -#ifndef CONFIG_EXAMPLES_FSTEST_MOUNTPT -# error CONFIG_EXAMPLES_FSTEST_MOUNTPT must be provided +#ifndef CONFIG_TESTING_FSTEST_MOUNTPT +# error CONFIG_TESTING_FSTEST_MOUNTPT must be provided #endif -#ifndef CONFIG_EXAMPLES_FSTEST_NLOOPS -# define CONFIG_EXAMPLES_FSTEST_NLOOPS 100 +#ifndef CONFIG_TESTING_FSTEST_NLOOPS +# define CONFIG_TESTING_FSTEST_NLOOPS 100 #endif -#ifndef CONFIG_EXAMPLES_FSTEST_VERBOSE -# define CONFIG_EXAMPLES_FSTEST_VERBOSE 0 +#ifndef CONFIG_TESTING_FSTEST_VERBOSE +# define CONFIG_TESTING_FSTEST_VERBOSE 0 #endif /**************************************************************************** @@ -110,9 +110,9 @@ struct fstest_filedesc_s ****************************************************************************/ /* Pre-allocated simulated flash */ -static uint8_t g_fileimage[CONFIG_EXAMPLES_FSTEST_MAXFILE]; -static struct fstest_filedesc_s g_files[CONFIG_EXAMPLES_FSTEST_MAXOPEN]; -static const char g_mountdir[] = CONFIG_EXAMPLES_FSTEST_MOUNTPT "/"; +static uint8_t g_fileimage[CONFIG_TESTING_FSTEST_MAXFILE]; +static struct fstest_filedesc_s g_files[CONFIG_TESTING_FSTEST_MAXOPEN]; +static const char g_mountdir[] = CONFIG_TESTING_FSTEST_MOUNTPT "/"; static int g_nfiles; static int g_ndeleted; static int g_nfailed; @@ -223,7 +223,7 @@ static inline void fstest_randname(FAR struct fstest_filedesc_s *file) int i; dirlen = strlen(g_mountdir); - maxname = CONFIG_EXAMPLES_FSTEST_MAXNAME - dirlen; + maxname = CONFIG_TESTING_FSTEST_MAXNAME - dirlen; namelen = (rand() % maxname) + 1; alloclen = namelen + dirlen; @@ -252,7 +252,7 @@ static inline void fstest_randfile(FAR struct fstest_filedesc_s *file) { int i; - file->len = (rand() % CONFIG_EXAMPLES_FSTEST_MAXFILE) + 1; + file->len = (rand() % CONFIG_TESTING_FSTEST_MAXFILE) + 1; for (i = 0; i < file->len; i++) { g_fileimage[i] = fstest_randchar(); @@ -279,7 +279,7 @@ static void fstest_freefile(FAR struct fstest_filedesc_s *file) * Name: fstest_gc and fstest_gc_withfd ****************************************************************************/ -#ifdef CONFIG_EXAMPLES_FSTEST_SPIFFS +#ifdef CONFIG_TESTING_FSTEST_SPIFFS static int fstest_gc_withfd(int fd, size_t nbytes) { int ret; @@ -351,7 +351,7 @@ static int fstest_gc(size_t nbytes) /* Find the first valid file */ - for (i = 0; i < CONFIG_EXAMPLES_FSTEST_MAXOPEN; i++) + for (i = 0; i < CONFIG_TESTING_FSTEST_MAXOPEN; i++) { file = &g_files[i]; if (file->name != NULL && !file->deleted) @@ -420,7 +420,7 @@ static inline int fstest_wrfile(FAR struct fstest_filedesc_s *file) for (offset = 0; offset < file->len; ) { - size_t maxio = (rand() % CONFIG_EXAMPLES_FSTEST_MAXIO) + 1; + size_t maxio = (rand() % CONFIG_TESTING_FSTEST_MAXIO) + 1; size_t nbytestowrite = file->len - offset; ssize_t nbyteswritten; @@ -466,7 +466,7 @@ static inline int fstest_wrfile(FAR struct fstest_filedesc_s *file) } else { -#if CONFIG_EXAMPLES_FSTEST_VERBOSE != 0 +#if CONFIG_TESTING_FSTEST_VERBOSE != 0 printf(" Successfully removed partial file\n"); #endif } @@ -505,7 +505,7 @@ static int fstest_fillfs(void) g_media_full = false; - for (i = 0; i < CONFIG_EXAMPLES_FSTEST_MAXOPEN; i++) + for (i = 0; i < CONFIG_TESTING_FSTEST_MAXOPEN; i++) { file = &g_files[i]; if (file->name == NULL) @@ -513,13 +513,13 @@ static int fstest_fillfs(void) ret = fstest_wrfile(file); if (ret < 0) { -#if CONFIG_EXAMPLES_FSTEST_VERBOSE != 0 +#if CONFIG_TESTING_FSTEST_VERBOSE != 0 printf("ERROR: Failed to write file %d\n", i); #endif return ERROR; } -#if CONFIG_EXAMPLES_FSTEST_VERBOSE != 0 +#if CONFIG_TESTING_FSTEST_VERBOSE != 0 printf(" Created file %s\n", file->name); #endif g_nfiles++; @@ -541,7 +541,7 @@ static int fstest_fillfs(void) static ssize_t fstest_rdblock(int fd, FAR struct fstest_filedesc_s *file, size_t offset, size_t len) { - size_t maxio = (rand() % CONFIG_EXAMPLES_FSTEST_MAXIO) + 1; + size_t maxio = (rand() % CONFIG_TESTING_FSTEST_MAXIO) + 1; ssize_t nbytesread; if (len > maxio) @@ -677,7 +677,7 @@ static unsigned long long fstest_filesize(void) bytes_used = 0; - for (i = 0; i < CONFIG_EXAMPLES_FSTEST_MAXOPEN; i++) + for (i = 0; i < CONFIG_TESTING_FSTEST_MAXOPEN; i++) { file = &g_files[i]; if (file->name != NULL && !file->deleted) @@ -697,7 +697,7 @@ static unsigned long fstest_filesize(void) bytes_used = 0; - for (i = 0; i < CONFIG_EXAMPLES_FSTEST_MAXOPEN; i++) + for (i = 0; i < CONFIG_TESTING_FSTEST_MAXOPEN; i++) { file = &g_files[i]; if (file->name != NULL && !file->deleted) @@ -722,7 +722,7 @@ static int fstest_verifyfs(void) /* Create a file for each unused file structure */ - for (i = 0; i < CONFIG_EXAMPLES_FSTEST_MAXOPEN; i++) + for (i = 0; i < CONFIG_TESTING_FSTEST_MAXOPEN; i++) { file = &g_files[i]; if (file->name != NULL) @@ -732,7 +732,7 @@ static int fstest_verifyfs(void) { if (file->deleted) { -#if CONFIG_EXAMPLES_FSTEST_VERBOSE != 0 +#if CONFIG_TESTING_FSTEST_VERBOSE != 0 printf("Deleted file %d OK\n", i); #endif fstest_freefile(file); @@ -751,7 +751,7 @@ static int fstest_verifyfs(void) { if (file->deleted) { -#if CONFIG_EXAMPLES_FSTEST_VERBOSE != 0 +#if CONFIG_TESTING_FSTEST_VERBOSE != 0 printf("ERROR: Successfully read a deleted file\n"); printf(" File name: %s\n", file->name); printf(" File size: %d\n", file->len); @@ -763,7 +763,7 @@ static int fstest_verifyfs(void) } else { -#if CONFIG_EXAMPLES_FSTEST_VERBOSE != 0 +#if CONFIG_TESTING_FSTEST_VERBOSE != 0 printf(" Verified file %s\n", file->name); #endif } @@ -814,7 +814,7 @@ static int fstest_delfiles(void) { /* Test for wrap-around */ - if (j >= CONFIG_EXAMPLES_FSTEST_MAXOPEN) + if (j >= CONFIG_TESTING_FSTEST_MAXOPEN) { j = 0; } @@ -845,7 +845,7 @@ static int fstest_delfiles(void) } else { -#if CONFIG_EXAMPLES_FSTEST_VERBOSE != 0 +#if CONFIG_TESTING_FSTEST_VERBOSE != 0 printf(" Deleted file %s\n", file->name); #endif file->deleted = true; @@ -869,7 +869,7 @@ static int fstest_delallfiles(void) int ret; int i; - for (i = 0; i < CONFIG_EXAMPLES_FSTEST_MAXOPEN; i++) + for (i = 0; i < CONFIG_TESTING_FSTEST_MAXOPEN; i++) { file = &g_files[i]; if (file->name) @@ -884,7 +884,7 @@ static int fstest_delallfiles(void) } else { -#if CONFIG_EXAMPLES_FSTEST_VERBOSE != 0 +#if CONFIG_TESTING_FSTEST_VERBOSE != 0 printf(" Deleted file %s\n", file->name); #endif fstest_freefile(file); @@ -909,14 +909,14 @@ static int fstest_directory(void) /* Open the directory */ - dirp = opendir(CONFIG_EXAMPLES_FSTEST_MOUNTPT); + dirp = opendir(CONFIG_TESTING_FSTEST_MOUNTPT); if (!dirp) { /* Failed to open the directory */ printf("ERROR: Failed to open directory '%s': %d\n", - CONFIG_EXAMPLES_FSTEST_MOUNTPT, errno); + CONFIG_TESTING_FSTEST_MOUNTPT, errno); return ERROR; } @@ -980,10 +980,10 @@ int fstest_main(int argc, char *argv[]) * delete, etc. This beats the FLASH very hard! */ -#if CONFIG_EXAMPLES_FSTEST_NLOOPS == 0 +#if CONFIG_TESTING_FSTEST_NLOOPS == 0 for (i = 0; ; i++) #else - for (i = 1; i <= CONFIG_EXAMPLES_FSTEST_NLOOPS; i++) + for (i = 1; i <= CONFIG_TESTING_FSTEST_NLOOPS; i++) #endif { /* Write a files to the file system until either (1) all of the open @@ -1017,7 +1017,7 @@ int fstest_main(int argc, char *argv[]) } else { -#if CONFIG_EXAMPLES_FSTEST_VERBOSE != 0 +#if CONFIG_TESTING_FSTEST_VERBOSE != 0 printf("Verified!\n"); printf(" Number of files: %d\n", g_nfiles); printf(" Number deleted: %d\n", g_ndeleted); @@ -1061,7 +1061,7 @@ int fstest_main(int argc, char *argv[]) } else { -#if CONFIG_EXAMPLES_FSTEST_VERBOSE != 0 +#if CONFIG_TESTING_FSTEST_VERBOSE != 0 printf("Verified!\n"); printf(" Number of files: %d\n", g_nfiles); printf(" Number deleted: %d\n", g_ndeleted); diff --git a/examples/nxffs/.gitignore b/testing/nxffs/.gitignore similarity index 100% rename from examples/nxffs/.gitignore rename to testing/nxffs/.gitignore diff --git a/examples/nxffs/Kconfig b/testing/nxffs/Kconfig similarity index 70% rename from examples/nxffs/Kconfig rename to testing/nxffs/Kconfig index 3dd791ef5..b6928a89a 100644 --- a/examples/nxffs/Kconfig +++ b/testing/nxffs/Kconfig @@ -3,68 +3,68 @@ # see the file kconfig-language.txt in the NuttX tools repository. # -config EXAMPLES_NXFFS +config TESTING_NXFFS tristate "NXFFS file system example" default n ---help--- Enable the NXFFS file system example -if EXAMPLES_NXFFS +if TESTING_NXFFS -config EXAMPLES_NXFFS_ARCHINIT +config TESTING_NXFFS_ARCHINIT bool "Architecture-specific initialization" default n ---help--- The default is to use the RAM MTD device at drivers/mtd/rammtd.c. But an architecture-specific MTD driver can be used instead by - defining EXAMPLES_NXFFS_ARCHINIT. In this case, the + defining TESTING_NXFFS_ARCHINIT. In this case, the initialization logic will call mtdpart_archinitialize() to obtain the MTD driver instance. -config EXAMPLES_NXFFS_NEBLOCKS +config TESTING_NXFFS_NEBLOCKS int "Number of erase blocks (simulated)" default 32 - depends on !EXAMPLES_NXFFS_ARCHINIT + depends on !TESTING_NXFFS_ARCHINIT ---help--- - When EXAMPLES_NXFFS_ARCHINIT is not defined, this test will use + When TESTING_NXFFS_ARCHINIT is not defined, this test will use the RAM MTD device at drivers/mtd/rammtd.c to simulate FLASH. In this case, this value must be provided to give the nubmer of erase blocks in MTD RAM device. The size of the allocated RAM drive will be: - RAMMTD_ERASESIZE * EXAMPLES_NXFFS_NEBLOCKS + RAMMTD_ERASESIZE * TESTING_NXFFS_NEBLOCKS -config EXAMPLES_NXFFS_MAXNAME +config TESTING_NXFFS_MAXNAME int "Max name size" default 128 range 1 255 ---help--- Determines the maximum size of names used in the filesystem - config EXAMPLES_NXFFS_MAXFILE + config TESTING_NXFFS_MAXFILE int "Max file size" default 8192 ---help--- Determines the maximum size of a file -config EXAMPLES_NXFFS_MAXIO +config TESTING_NXFFS_MAXIO int "Max I/O" default 347 -config EXAMPLES_NXFFS_MAXOPEN +config TESTING_NXFFS_MAXOPEN int "Max open files" default 512 -config EXAMPLES_NXFFS_MOUNTPT +config TESTING_NXFFS_MOUNTPT string "NXFFS mountpoint" default "/mnt/nxffs" -config EXAMPLES_NXFFS_NLOOPS +config TESTING_NXFFS_NLOOPS int "Number of test loops" default 100 -config EXAMPLES_NXFFS_VERBOSE +config TESTING_NXFFS_VERBOSE bool "Verbose output" default n diff --git a/examples/smart/Make.defs b/testing/nxffs/Make.defs similarity index 94% rename from examples/smart/Make.defs rename to testing/nxffs/Make.defs index d62a0f021..869a9dcb8 100644 --- a/examples/smart/Make.defs +++ b/testing/nxffs/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# apps/examples/smart/Make.defs +# apps/testing/nxffs/Make.defs # Adds selected applications to apps/ build # # Copyright (C) 2015 Gregory Nutt. All rights reserved. @@ -34,6 +34,6 @@ # ############################################################################ -ifneq ($(CONFIG_EXAMPLES_SMART),) -CONFIGURED_APPS += examples/smart +ifneq ($(CONFIG_TESTING_NXFFS),) +CONFIGURED_APPS += testing/nxffs endif diff --git a/examples/nxffs/Makefile b/testing/nxffs/Makefile similarity index 96% rename from examples/nxffs/Makefile rename to testing/nxffs/Makefile index 3f54db825..1e3a59153 100644 --- a/examples/nxffs/Makefile +++ b/testing/nxffs/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# apps/examples/nxffs/Makefile +# apps/testing/nxffs/Makefile # # Copyright (C) 2011-2012, 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt @@ -46,6 +46,6 @@ MAINSRC = nxffs_main.c CONFIG_XYZ_PROGNAME ?= nxffs$(EXEEXT) PROGNAME = $(CONFIG_XYZ_PROGNAME) -MODULE = CONFIG_EXAMPLES_NXFFS +MODULE = CONFIG_TESTING_NXFFS include $(APPDIR)/Application.mk diff --git a/testing/nxffs/README.txt b/testing/nxffs/README.txt new file mode 100644 index 000000000..eb755da35 --- /dev/null +++ b/testing/nxffs/README.txt @@ -0,0 +1,7 @@ +README +====== + + This is a test of the NuttX NXFFS FLASH file system. This is an NXFFS + stress test and beats on the file system very hard. It should only + be used in a simulation environment! Putting this NXFFS test on real + hardware will most likely destroy your FLASH. You have been warned. diff --git a/examples/nxffs/nxffs_main.c b/testing/nxffs/nxffs_main.c similarity index 89% rename from examples/nxffs/nxffs_main.c rename to testing/nxffs/nxffs_main.c index 93d85b84d..189401ce8 100644 --- a/examples/nxffs/nxffs_main.c +++ b/testing/nxffs/nxffs_main.c @@ -1,5 +1,5 @@ /**************************************************************************** - * examples/nxffs/nxffs_main.c + * testing/nxffs/nxffs_main.c * * Copyright (C) 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -61,11 +61,11 @@ /* Configuration ************************************************************/ /* The default is to use the RAM MTD device at drivers/mtd/rammtd.c. But * an architecture-specific MTD driver can be used instead by defining - * CONFIG_EXAMPLES_NXFFS_ARCHINIT. In this case, the initialization logic + * CONFIG_TESTING_NXFFS_ARCHINIT. In this case, the initialization logic * will call nxffs_archinitialize() to obtain the MTD driver instance. */ -#ifndef CONFIG_EXAMPLES_NXFFS_ARCHINIT +#ifndef CONFIG_TESTING_NXFFS_ARCHINIT /* This must exactly match the default configuration in drivers/mtd/rammtd.c */ @@ -73,45 +73,45 @@ # define CONFIG_RAMMTD_ERASESIZE 4096 # endif -# ifndef CONFIG_EXAMPLES_NXFFS_NEBLOCKS -# define CONFIG_EXAMPLES_NXFFS_NEBLOCKS (32) +# ifndef CONFIG_TESTING_NXFFS_NEBLOCKS +# define CONFIG_TESTING_NXFFS_NEBLOCKS (32) # endif -# define EXAMPLES_NXFFS_BUFSIZE \ - (CONFIG_RAMMTD_ERASESIZE * CONFIG_EXAMPLES_NXFFS_NEBLOCKS) +# define TESTING_NXFFS_BUFSIZE \ + (CONFIG_RAMMTD_ERASESIZE * CONFIG_TESTING_NXFFS_NEBLOCKS) #endif -#ifndef CONFIG_EXAMPLES_NXFFS_MAXNAME -# define CONFIG_EXAMPLES_NXFFS_MAXNAME 128 +#ifndef CONFIG_TESTING_NXFFS_MAXNAME +# define CONFIG_TESTING_NXFFS_MAXNAME 128 #endif -#if CONFIG_EXAMPLES_NXFFS_MAXNAME > 255 -# undef CONFIG_EXAMPLES_NXFFS_MAXNAME -# define CONFIG_EXAMPLES_NXFFS_MAXNAME 255 +#if CONFIG_TESTING_NXFFS_MAXNAME > 255 +# undef CONFIG_TESTING_NXFFS_MAXNAME +# define CONFIG_TESTING_NXFFS_MAXNAME 255 #endif -#ifndef CONFIG_EXAMPLES_NXFFS_MAXFILE -# define CONFIG_EXAMPLES_NXFFS_MAXFILE 8192 +#ifndef CONFIG_TESTING_NXFFS_MAXFILE +# define CONFIG_TESTING_NXFFS_MAXFILE 8192 #endif -#ifndef CONFIG_EXAMPLES_NXFFS_MAXIO -# define CONFIG_EXAMPLES_NXFFS_MAXIO 347 +#ifndef CONFIG_TESTING_NXFFS_MAXIO +# define CONFIG_TESTING_NXFFS_MAXIO 347 #endif -#ifndef CONFIG_EXAMPLES_NXFFS_MAXOPEN -# define CONFIG_EXAMPLES_NXFFS_MAXOPEN 512 +#ifndef CONFIG_TESTING_NXFFS_MAXOPEN +# define CONFIG_TESTING_NXFFS_MAXOPEN 512 #endif -#ifndef CONFIG_EXAMPLES_NXFFS_MOUNTPT -# define CONFIG_EXAMPLES_NXFFS_MOUNTPT "/mnt/nxffs" +#ifndef CONFIG_TESTING_NXFFS_MOUNTPT +# define CONFIG_TESTING_NXFFS_MOUNTPT "/mnt/nxffs" #endif -#ifndef CONFIG_EXAMPLES_NXFFS_NLOOPS -# define CONFIG_EXAMPLES_NXFFS_NLOOPS 100 +#ifndef CONFIG_TESTING_NXFFS_NLOOPS +# define CONFIG_TESTING_NXFFS_NLOOPS 100 #endif -#ifndef CONFIG_EXAMPLES_NXFFS_VERBOSE -# define CONFIG_EXAMPLES_NXFFS_VERBOSE 0 +#ifndef CONFIG_TESTING_NXFFS_VERBOSE +# define CONFIG_TESTING_NXFFS_VERBOSE 0 #endif /**************************************************************************** @@ -131,13 +131,13 @@ struct nxffs_filedesc_s ****************************************************************************/ /* Pre-allocated simulated flash */ -#ifndef CONFIG_EXAMPLES_NXFFS_ARCHINIT -static uint8_t g_simflash[EXAMPLES_NXFFS_BUFSIZE]; +#ifndef CONFIG_TESTING_NXFFS_ARCHINIT +static uint8_t g_simflash[TESTING_NXFFS_BUFSIZE]; #endif -static uint8_t g_fileimage[CONFIG_EXAMPLES_NXFFS_MAXFILE]; -static struct nxffs_filedesc_s g_files[CONFIG_EXAMPLES_NXFFS_MAXOPEN]; -static const char g_mountdir[] = CONFIG_EXAMPLES_NXFFS_MOUNTPT "/"; +static uint8_t g_fileimage[CONFIG_TESTING_NXFFS_MAXFILE]; +static struct nxffs_filedesc_s g_files[CONFIG_TESTING_NXFFS_MAXOPEN]; +static const char g_mountdir[] = CONFIG_TESTING_NXFFS_MOUNTPT "/"; static int g_nfiles; static int g_ndeleted; @@ -149,7 +149,7 @@ static struct mallinfo g_mmafter; * External Functions ****************************************************************************/ -#ifdef CONFIG_EXAMPLES_NXFFS_ARCHINIT +#ifdef CONFIG_TESTING_NXFFS_ARCHINIT extern FAR struct mtd_dev_s *nxffs_archinitialize(void); #endif @@ -254,7 +254,7 @@ static inline void nxffs_randname(FAR struct nxffs_filedesc_s *file) int i; dirlen = strlen(g_mountdir); - maxname = CONFIG_EXAMPLES_NXFFS_MAXNAME - dirlen; + maxname = CONFIG_TESTING_NXFFS_MAXNAME - dirlen; namelen = (rand() % maxname) + 1; alloclen = namelen + dirlen; @@ -283,7 +283,7 @@ static inline void nxffs_randfile(FAR struct nxffs_filedesc_s *file) { int i; - file->len = (rand() % CONFIG_EXAMPLES_NXFFS_MAXFILE) + 1; + file->len = (rand() % CONFIG_TESTING_NXFFS_MAXFILE) + 1; for (i = 0; i < file->len; i++) { g_fileimage[i] = nxffs_randchar(); @@ -339,7 +339,7 @@ static inline int nxffs_wrfile(FAR struct nxffs_filedesc_s *file) for (offset = 0; offset < file->len; ) { - size_t maxio = (rand() % CONFIG_EXAMPLES_NXFFS_MAXIO) + 1; + size_t maxio = (rand() % CONFIG_TESTING_NXFFS_MAXIO) + 1; size_t nbytestowrite = file->len - offset; ssize_t nbyteswritten; @@ -378,7 +378,7 @@ static inline int nxffs_wrfile(FAR struct nxffs_filedesc_s *file) } else { -#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 +#if CONFIG_TESTING_NXFFS_VERBOSE != 0 printf(" Successfully removed partial file\n"); #endif } @@ -415,7 +415,7 @@ static int nxffs_fillfs(void) /* Create a file for each unused file structure */ - for (i = 0; i < CONFIG_EXAMPLES_NXFFS_MAXOPEN; i++) + for (i = 0; i < CONFIG_TESTING_NXFFS_MAXOPEN; i++) { file = &g_files[i]; if (file->name == NULL) @@ -423,13 +423,13 @@ static int nxffs_fillfs(void) ret = nxffs_wrfile(file); if (ret < 0) { -#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 +#if CONFIG_TESTING_NXFFS_VERBOSE != 0 printf("ERROR: Failed to write file %d\n", i); #endif return ERROR; } -#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 +#if CONFIG_TESTING_NXFFS_VERBOSE != 0 printf(" Created file %s\n", file->name); #endif g_nfiles++; @@ -446,7 +446,7 @@ static int nxffs_fillfs(void) static ssize_t nxffs_rdblock(int fd, FAR struct nxffs_filedesc_s *file, size_t offset, size_t len) { - size_t maxio = (rand() % CONFIG_EXAMPLES_NXFFS_MAXIO) + 1; + size_t maxio = (rand() % CONFIG_TESTING_NXFFS_MAXIO) + 1; ssize_t nbytesread; if (len > maxio) @@ -568,7 +568,7 @@ static int nxffs_verifyfs(void) /* Create a file for each unused file structure */ - for (i = 0; i < CONFIG_EXAMPLES_NXFFS_MAXOPEN; i++) + for (i = 0; i < CONFIG_TESTING_NXFFS_MAXOPEN; i++) { file = &g_files[i]; if (file->name != NULL) @@ -578,7 +578,7 @@ static int nxffs_verifyfs(void) { if (file->deleted) { -#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 +#if CONFIG_TESTING_NXFFS_VERBOSE != 0 printf("Deleted file %d OK\n", i); #endif nxffs_freefile(file); @@ -597,7 +597,7 @@ static int nxffs_verifyfs(void) { if (file->deleted) { -#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 +#if CONFIG_TESTING_NXFFS_VERBOSE != 0 printf("Succesffully read a deleted file\n"); printf(" File name: %s\n", file->name); printf(" File size: %d\n", file->len); @@ -609,7 +609,7 @@ static int nxffs_verifyfs(void) } else { -#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 +#if CONFIG_TESTING_NXFFS_VERBOSE != 0 printf(" Verifed file %s\n", file->name); #endif } @@ -660,7 +660,7 @@ static int nxffs_delfiles(void) { /* Test for wrap-around */ - if (j >= CONFIG_EXAMPLES_NXFFS_MAXOPEN) + if (j >= CONFIG_TESTING_NXFFS_MAXOPEN) { j = 0; } @@ -678,7 +678,7 @@ static int nxffs_delfiles(void) } else { -#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 +#if CONFIG_TESTING_NXFFS_VERBOSE != 0 printf(" Deleted file %s\n", file->name); #endif file->deleted = true; @@ -702,7 +702,7 @@ static int nxffs_delallfiles(void) int ret; int i; - for (i = 0; i < CONFIG_EXAMPLES_NXFFS_MAXOPEN; i++) + for (i = 0; i < CONFIG_TESTING_NXFFS_MAXOPEN; i++) { file = &g_files[i]; if (file->name) @@ -717,7 +717,7 @@ static int nxffs_delallfiles(void) } else { -#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 +#if CONFIG_TESTING_NXFFS_VERBOSE != 0 printf(" Deleted file %s\n", file->name); #endif nxffs_freefile(file); @@ -742,14 +742,14 @@ static int nxffs_directory(void) /* Open the directory */ - dirp = opendir(CONFIG_EXAMPLES_NXFFS_MOUNTPT); + dirp = opendir(CONFIG_TESTING_NXFFS_MOUNTPT); if (!dirp) { /* Failed to open the directory */ printf("ERROR: Failed to open directory '%s': %d\n", - CONFIG_EXAMPLES_NXFFS_MOUNTPT, errno); + CONFIG_TESTING_NXFFS_MOUNTPT, errno); return ERROR; } @@ -799,10 +799,10 @@ int nxffs_main(int argc, char *argv[]) /* Create and initialize a RAM MTD device instance */ -#ifdef CONFIG_EXAMPLES_NXFFS_ARCHINIT +#ifdef CONFIG_TESTING_NXFFS_ARCHINIT mtd = nxffs_archinitialize(); #else - mtd = rammtd_initialize(g_simflash, EXAMPLES_NXFFS_BUFSIZE); + mtd = rammtd_initialize(g_simflash, TESTING_NXFFS_BUFSIZE); #endif if (!mtd) { @@ -823,7 +823,7 @@ int nxffs_main(int argc, char *argv[]) /* Mount the file system */ - ret = mount(NULL, CONFIG_EXAMPLES_NXFFS_MOUNTPT, "nxffs", 0, NULL); + ret = mount(NULL, CONFIG_TESTING_NXFFS_MOUNTPT, "nxffs", 0, NULL); if (ret < 0) { printf("ERROR: Failed to mount the NXFFS volume: %d\n", errno); @@ -846,10 +846,10 @@ int nxffs_main(int argc, char *argv[]) * delete, etc. This beats the FLASH very hard! */ -#if CONFIG_EXAMPLES_NXFFS_NLOOPS == 0 +#if CONFIG_TESTING_NXFFS_NLOOPS == 0 for (i = 0; ; i++) #else - for (i = 1; i <= CONFIG_EXAMPLES_NXFFS_NLOOPS; i++) + for (i = 1; i <= CONFIG_TESTING_NXFFS_NLOOPS; i++) #endif { /* Write a files to the NXFFS file system until either (1) all of the @@ -862,7 +862,7 @@ int nxffs_main(int argc, char *argv[]) printf("Filled file system\n"); printf(" Number of files: %d\n", g_nfiles); printf(" Number deleted: %d\n", g_ndeleted); - nxffs_dump(mtd, CONFIG_EXAMPLES_NXFFS_VERBOSE); + nxffs_dump(mtd, CONFIG_TESTING_NXFFS_VERBOSE); /* Directory listing */ @@ -879,7 +879,7 @@ int nxffs_main(int argc, char *argv[]) } else { -#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 +#if CONFIG_TESTING_NXFFS_VERBOSE != 0 printf("Verified!\n"); printf(" Number of files: %d\n", g_nfiles); printf(" Number deleted: %d\n", g_ndeleted); @@ -902,7 +902,7 @@ int nxffs_main(int argc, char *argv[]) printf(" Number of files: %d\n", g_nfiles); printf(" Number deleted: %d\n", g_ndeleted); } - nxffs_dump(mtd, CONFIG_EXAMPLES_NXFFS_VERBOSE); + nxffs_dump(mtd, CONFIG_TESTING_NXFFS_VERBOSE); /* Directory listing */ @@ -919,7 +919,7 @@ int nxffs_main(int argc, char *argv[]) } else { -#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 +#if CONFIG_TESTING_NXFFS_VERBOSE != 0 printf("Verified!\n"); printf(" Number of files: %d\n", g_nfiles); printf(" Number deleted: %d\n", g_ndeleted); diff --git a/examples/smart/.gitignore b/testing/smart/.gitignore similarity index 100% rename from examples/smart/.gitignore rename to testing/smart/.gitignore diff --git a/examples/smart/Kconfig b/testing/smart/Kconfig similarity index 70% rename from examples/smart/Kconfig rename to testing/smart/Kconfig index 7b3b4968b..d19f73796 100644 --- a/examples/smart/Kconfig +++ b/testing/smart/Kconfig @@ -3,68 +3,68 @@ # see the file kconfig-language.txt in the NuttX tools repository. # -config EXAMPLES_SMART +config TESTING_SMART tristate "SMART file system example" default n ---help--- Enable the SMART file system example -if EXAMPLES_SMART +if TESTING_SMART -config EXAMPLES_SMART_ARCHINIT +config TESTING_SMART_ARCHINIT bool "Architecture-specific initialization" default n ---help--- The default is to use the RAM MTD device at drivers/mtd/rammtd.c. But an architecture-specific MTD driver can be used instead by - defining EXAMPLES_SMART_ARCHINIT. In this case, the + defining TESTING_SMART_ARCHINIT. In this case, the initialization logic will call smart_archinitialize() to obtain the MTD driver instance. -config EXAMPLES_SMART_NEBLOCKS +config TESTING_SMART_NEBLOCKS int "Number of erase blocks (simulated)" default 32 - depends on !EXAMPLES_SMART_ARCHINIT + depends on !TESTING_SMART_ARCHINIT ---help--- - When EXAMPLES_SMART_ARCHINIT is not defined, this test will use + When TESTING_SMART_ARCHINIT is not defined, this test will use the RAM MTD device at drivers/mtd/rammtd.c to simulate FLASH. In this case, this value must be provided to give the nubmer of erase blocks in MTD RAM device. The size of the allocated RAM drive will be: - RAMMTD_ERASESIZE * EXAMPLES_SMART_NEBLOCKS + RAMMTD_ERASESIZE * TESTING_SMART_NEBLOCKS -config EXAMPLES_SMART_MAXNAME +config TESTING_SMART_MAXNAME int "Max name size" default 32 range 1 255 ---help--- Determines the maximum size of names used in the filesystem -config EXAMPLES_SMART_MAXFILE +config TESTING_SMART_MAXFILE int "Max file size" default 8192 ---help--- Determines the maximum size of a file -config EXAMPLES_SMART_MAXIO +config TESTING_SMART_MAXIO int "Max I/O" default 347 -config EXAMPLES_SMART_MAXOPEN +config TESTING_SMART_MAXOPEN int "Max open files" default 512 -config EXAMPLES_SMART_MOUNTPT +config TESTING_SMART_MOUNTPT string "SMART mountpoint" default "/mnt/nxffs" -config EXAMPLES_SMART_NLOOPS +config TESTING_SMART_NLOOPS int "Number of test loops" default 100 -config EXAMPLES_SMART_VERBOSE +config TESTING_SMART_VERBOSE bool "Verbose output" default n diff --git a/examples/fstest/Make.defs b/testing/smart/Make.defs similarity index 94% rename from examples/fstest/Make.defs rename to testing/smart/Make.defs index 7d3578557..34ba96332 100644 --- a/examples/fstest/Make.defs +++ b/testing/smart/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# apps/examples/fstest/Make.defs +# apps/testing/smart/Make.defs # Adds selected applications to apps/ build # # Copyright (C) 2015 Gregory Nutt. All rights reserved. @@ -34,6 +34,6 @@ # ############################################################################ -ifneq ($(CONFIG_EXAMPLES_FSTEST),) -CONFIGURED_APPS += examples/fstest +ifneq ($(CONFIG_TESTING_SMART),) +CONFIGURED_APPS += testing/smart endif diff --git a/examples/smart/Makefile b/testing/smart/Makefile similarity index 96% rename from examples/smart/Makefile rename to testing/smart/Makefile index 859add7fe..cad3ad726 100644 --- a/examples/smart/Makefile +++ b/testing/smart/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# apps/examples/smart/Makefile +# apps/testing/smart/Makefile # # Copyright (C) 2011-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt @@ -46,6 +46,6 @@ MAINSRC = smart_main.c CONFIG_XYZ_PROGNAME ?= smart$(EXEEXT) PROGNAME = $(CONFIG_XYZ_PROGNAME) -MODULE = CONFIG_EXAMPLES_SMART +MODULE = CONFIG_TESTING_SMART include $(APPDIR)/Application.mk diff --git a/testing/smart/README.txt b/testing/smart/README.txt new file mode 100644 index 000000000..039abebd9 --- /dev/null +++ b/testing/smart/README.txt @@ -0,0 +1,25 @@ +README +====== + + This is a test of the SMART file system that derives from + testing/nxffs. + + * CONFIG_TESTING_SMART: - Enable the SMART file system example + * CONFIG_TESTING_SMART_ARCHINIT: The default is to use the RAM MTD + device at drivers/mtd/rammtd.c. But an architecture-specific MTD + driver can be used instead by defining CONFIG_TESTING_SMART_ARCHINIT. In + this case, the initialization logic will call smart_archinitialize() + to obtain the MTD driver instance. + * CONFIG_TESTING_SMART_NEBLOCKS: When CONFIG_TESTING_SMART_ARCHINIT is not + defined, this test will use the RAM MTD device at drivers/mtd/rammtd.c + to simulate FLASH. In this case, this value must be provided to give + the nubmer of erase blocks in MTD RAM device. The size of the allocated + RAM drive will be: CONFIG_RAMMTD_ERASESIZE * CONFIG_TESTING_SMART_NEBLOCKS + * CONFIG_TESTING_SMART_MAXNAME: Determines the maximum size of names used + in the filesystem + * CONFIG_TESTING_SMART_MAXFILE: Determines the maximum size of a file + * CONFIG_TESTING_SMART_MAXIO: Max I/O, default 347. + * CONFIG_TESTING_SMART_MAXOPEN: Max open files. + * CONFIG_TESTING_SMART_MOUNTPT: SMART mountpoint + * CONFIG_TESTING_SMART_NLOOPS: Number of test loops. default 100 + * CONFIG_TESTING_SMART_VERBOSE: Verbose output diff --git a/examples/smart/smart_main.c b/testing/smart/smart_main.c similarity index 90% rename from examples/smart/smart_main.c rename to testing/smart/smart_main.c index 78770fd20..3cf0df3e0 100644 --- a/examples/smart/smart_main.c +++ b/testing/smart/smart_main.c @@ -1,5 +1,5 @@ /**************************************************************************** - * examples/smart/smart_main.c + * testing/smart/smart_main.c * * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -64,11 +64,11 @@ /* Configuration ************************************************************/ /* The default is to use the RAM MTD device at drivers/mtd/rammtd.c. But * an architecture-specific MTD driver can be used instead by defining - * CONFIG_EXAMPLES_SMART_ARCHINIT. In this case, the initialization logic + * CONFIG_TESTING_SMART_ARCHINIT. In this case, the initialization logic * will call smart_archinitialize() to obtain the MTD driver instance. */ -#ifndef CONFIG_EXAMPLES_SMART_ARCHINIT +#ifndef CONFIG_TESTING_SMART_ARCHINIT /* This must exactly match the default configuration in drivers/mtd/rammtd.c */ @@ -76,45 +76,45 @@ # define CONFIG_RAMMTD_ERASESIZE 4096 # endif -# ifndef CONFIG_EXAMPLES_SMART_NEBLOCKS -# define CONFIG_EXAMPLES_SMART_NEBLOCKS (256) +# ifndef CONFIG_TESTING_SMART_NEBLOCKS +# define CONFIG_TESTING_SMART_NEBLOCKS (256) # endif -# define EXAMPLES_SMART_BUFSIZE \ - (CONFIG_RAMMTD_ERASESIZE * CONFIG_EXAMPLES_SMART_NEBLOCKS) +# define TESTING_SMART_BUFSIZE \ + (CONFIG_RAMMTD_ERASESIZE * CONFIG_TESTING_SMART_NEBLOCKS) #endif -#ifndef CONFIG_EXAMPLES_SMART_MAXNAME -# define CONFIG_EXAMPLES_SMART_MAXNAME 128 +#ifndef CONFIG_TESTING_SMART_MAXNAME +# define CONFIG_TESTING_SMART_MAXNAME 128 #endif -#if CONFIG_EXAMPLES_SMART_MAXNAME > 255 -# undef CONFIG_EXAMPLES_SMART_MAXNAME -# define CONFIG_EXAMPLES_SMART_MAXNAME 255 +#if CONFIG_TESTING_SMART_MAXNAME > 255 +# undef CONFIG_TESTING_SMART_MAXNAME +# define CONFIG_TESTING_SMART_MAXNAME 255 #endif -#ifndef CONFIG_EXAMPLES_SMART_MAXFILE -# define CONFIG_EXAMPLES_SMART_MAXFILE 8192 +#ifndef CONFIG_TESTING_SMART_MAXFILE +# define CONFIG_TESTING_SMART_MAXFILE 8192 #endif -#ifndef CONFIG_EXAMPLES_SMART_MAXIO -# define CONFIG_EXAMPLES_SMART_MAXIO 347 +#ifndef CONFIG_TESTING_SMART_MAXIO +# define CONFIG_TESTING_SMART_MAXIO 347 #endif -#ifndef CONFIG_EXAMPLES_SMART_MAXOPEN -# define CONFIG_EXAMPLES_SMART_MAXOPEN 512 +#ifndef CONFIG_TESTING_SMART_MAXOPEN +# define CONFIG_TESTING_SMART_MAXOPEN 512 #endif -#ifndef CONFIG_EXAMPLES_SMART_MOUNTPT -# define CONFIG_EXAMPLES_SMART_MOUNTPT "/mnt/smart" +#ifndef CONFIG_TESTING_SMART_MOUNTPT +# define CONFIG_TESTING_SMART_MOUNTPT "/mnt/smart" #endif -#ifndef CONFIG_EXAMPLES_SMART_NLOOPS -# define CONFIG_EXAMPLES_SMART_NLOOPS 100 +#ifndef CONFIG_TESTING_SMART_NLOOPS +# define CONFIG_TESTING_SMART_NLOOPS 100 #endif -#ifndef CONFIG_EXAMPLES_SMART_VERBOSE -# define CONFIG_EXAMPLES_SMART_VERBOSE 0 +#ifndef CONFIG_TESTING_SMART_VERBOSE +# define CONFIG_TESTING_SMART_VERBOSE 0 #endif /**************************************************************************** @@ -134,13 +134,13 @@ struct smart_filedesc_s ****************************************************************************/ /* Pre-allocated simulated flash */ -#ifndef CONFIG_EXAMPLES_SMART_ARCHINIT -static uint8_t g_simflash[EXAMPLES_SMART_BUFSIZE]; +#ifndef CONFIG_TESTING_SMART_ARCHINIT +static uint8_t g_simflash[TESTING_SMART_BUFSIZE]; #endif -static uint8_t g_fileimage[CONFIG_EXAMPLES_SMART_MAXFILE]; -static struct smart_filedesc_s g_files[CONFIG_EXAMPLES_SMART_MAXOPEN]; -static const char g_mountdir[] = CONFIG_EXAMPLES_SMART_MOUNTPT "/"; +static uint8_t g_fileimage[CONFIG_TESTING_SMART_MAXFILE]; +static struct smart_filedesc_s g_files[CONFIG_TESTING_SMART_MAXOPEN]; +static const char g_mountdir[] = CONFIG_TESTING_SMART_MOUNTPT "/"; static int g_nfiles; static int g_ndeleted; @@ -152,7 +152,7 @@ static struct mallinfo g_mmafter; * External Functions ****************************************************************************/ -#ifdef CONFIG_EXAMPLES_SMART_ARCHINIT +#ifdef CONFIG_TESTING_SMART_ARCHINIT extern FAR struct mtd_dev_s *smart_archinitialize(void); #endif @@ -257,7 +257,7 @@ static inline void smart_randname(FAR struct smart_filedesc_s *file) int i; dirlen = strlen(g_mountdir); - maxname = CONFIG_EXAMPLES_SMART_MAXNAME - dirlen; + maxname = CONFIG_TESTING_SMART_MAXNAME - dirlen; namelen = (rand() % maxname) + 1; alloclen = namelen + dirlen; @@ -286,7 +286,7 @@ static inline void smart_randfile(FAR struct smart_filedesc_s *file) { int i; - file->len = (rand() % CONFIG_EXAMPLES_SMART_MAXFILE) + 1; + file->len = (rand() % CONFIG_TESTING_SMART_MAXFILE) + 1; for (i = 0; i < file->len; i++) { g_fileimage[i] = smart_randchar(); @@ -345,7 +345,7 @@ static inline int smart_wrfile(FAR struct smart_filedesc_s *file) for (offset = 0; offset < file->len; ) { - size_t maxio = (rand() % CONFIG_EXAMPLES_SMART_MAXIO) + 1; + size_t maxio = (rand() % CONFIG_TESTING_SMART_MAXIO) + 1; size_t nbytestowrite = file->len - offset; ssize_t nbyteswritten; @@ -384,7 +384,7 @@ static inline int smart_wrfile(FAR struct smart_filedesc_s *file) } else { -#if CONFIG_EXAMPLES_SMART_VERBOSE != 0 +#if CONFIG_TESTING_SMART_VERBOSE != 0 printf(" Successfully removed partial file\n"); #endif } @@ -421,7 +421,7 @@ static int smart_fillfs(void) /* Create a file for each unused file structure */ - for (i = 0; i < CONFIG_EXAMPLES_SMART_MAXOPEN; i++) + for (i = 0; i < CONFIG_TESTING_SMART_MAXOPEN; i++) { file = &g_files[i]; if (file->name == NULL) @@ -429,13 +429,13 @@ static int smart_fillfs(void) ret = smart_wrfile(file); if (ret < 0) { -#if CONFIG_EXAMPLES_SMART_VERBOSE != 0 +#if CONFIG_TESTING_SMART_VERBOSE != 0 printf("ERROR: Failed to write file %d\n", i); #endif return ERROR; } -#if CONFIG_EXAMPLES_SMART_VERBOSE != 0 +#if CONFIG_TESTING_SMART_VERBOSE != 0 printf(" Created file %s\n", file->name); #endif g_nfiles++; @@ -452,7 +452,7 @@ static int smart_fillfs(void) static ssize_t smart_rdblock(int fd, FAR struct smart_filedesc_s *file, size_t offset, size_t len) { - size_t maxio = (rand() % CONFIG_EXAMPLES_SMART_MAXIO) + 1; + size_t maxio = (rand() % CONFIG_TESTING_SMART_MAXIO) + 1; ssize_t nbytesread; if (len > maxio) @@ -575,7 +575,7 @@ static int smart_verifyfs(void) /* Create a file for each unused file structure */ - for (i = 0; i < CONFIG_EXAMPLES_SMART_MAXOPEN; i++) + for (i = 0; i < CONFIG_TESTING_SMART_MAXOPEN; i++) { file = &g_files[i]; if (file->name != NULL) @@ -585,7 +585,7 @@ static int smart_verifyfs(void) { if (file->deleted) { -#if CONFIG_EXAMPLES_SMART_VERBOSE != 0 +#if CONFIG_TESTING_SMART_VERBOSE != 0 printf("Deleted file %d OK\n", i); #endif smart_freefile(file); @@ -604,7 +604,7 @@ static int smart_verifyfs(void) { if (file->deleted) { -#if CONFIG_EXAMPLES_SMART_VERBOSE != 0 +#if CONFIG_TESTING_SMART_VERBOSE != 0 printf("Succesffully read a deleted file\n"); printf(" File name: %s\n", file->name); printf(" File size: %d\n", file->len); @@ -616,7 +616,7 @@ static int smart_verifyfs(void) } else { -#if CONFIG_EXAMPLES_SMART_VERBOSE != 0 +#if CONFIG_TESTING_SMART_VERBOSE != 0 printf(" Verifed file %s\n", file->name); #endif } @@ -667,7 +667,7 @@ static int smart_delfiles(void) { /* Test for wrap-around */ - if (j >= CONFIG_EXAMPLES_FSTEST_MAXOPEN) + if (j >= CONFIG_TESTING_FSTEST_MAXOPEN) { j = 0; } @@ -685,7 +685,7 @@ static int smart_delfiles(void) } else { -#if CONFIG_EXAMPLES_SMART_VERBOSE != 0 +#if CONFIG_TESTING_SMART_VERBOSE != 0 printf(" Deleted file %s\n", file->name); #endif file->deleted = true; @@ -709,7 +709,7 @@ static int smart_delallfiles(void) int ret; int i; - for (i = 0; i < CONFIG_EXAMPLES_SMART_MAXOPEN; i++) + for (i = 0; i < CONFIG_TESTING_SMART_MAXOPEN; i++) { file = &g_files[i]; if (file->name) @@ -724,7 +724,7 @@ static int smart_delallfiles(void) } else { -#if CONFIG_EXAMPLES_SMART_VERBOSE != 0 +#if CONFIG_TESTING_SMART_VERBOSE != 0 printf(" Deleted file %s\n", file->name); #endif smart_freefile(file); @@ -749,14 +749,14 @@ static int smart_directory(void) /* Open the directory */ - dirp = opendir(CONFIG_EXAMPLES_SMART_MOUNTPT); + dirp = opendir(CONFIG_TESTING_SMART_MOUNTPT); if (!dirp) { /* Failed to open the directory */ printf("ERROR: Failed to open directory '%s': %d\n", - CONFIG_EXAMPLES_SMART_MOUNTPT, errno); + CONFIG_TESTING_SMART_MOUNTPT, errno); return ERROR; } @@ -807,10 +807,10 @@ int smart_main(int argc, char *argv[]) /* Create and initialize a RAM MTD device instance */ -#ifdef CONFIG_EXAMPLES_SMART_ARCHINIT +#ifdef CONFIG_TESTING_SMART_ARCHINIT mtd = smart_archinitialize(); #else - mtd = rammtd_initialize(g_simflash, EXAMPLES_SMART_BUFSIZE); + mtd = rammtd_initialize(g_simflash, TESTING_SMART_BUFSIZE); #endif if (!mtd) { @@ -840,7 +840,7 @@ int smart_main(int argc, char *argv[]) /* Mount the file system */ - ret = mount("/dev/smart1", CONFIG_EXAMPLES_SMART_MOUNTPT, "smartfs", 0, NULL); + ret = mount("/dev/smart1", CONFIG_TESTING_SMART_MOUNTPT, "smartfs", 0, NULL); if (ret < 0) { printf("ERROR: Failed to mount the SMART volume: %d\n", errno); @@ -863,10 +863,10 @@ int smart_main(int argc, char *argv[]) * delete, etc. This beats the FLASH very hard! */ -#if CONFIG_EXAMPLES_SMART_NLOOPS == 0 +#if CONFIG_TESTING_SMART_NLOOPS == 0 for (i = 0; ; i++) #else - for (i = 1; i <= CONFIG_EXAMPLES_SMART_NLOOPS; i++) + for (i = 1; i <= CONFIG_TESTING_SMART_NLOOPS; i++) #endif { /* Write a files to the SMART file system until either (1) all of the @@ -895,7 +895,7 @@ int smart_main(int argc, char *argv[]) } else { -#if CONFIG_EXAMPLES_SMART_VERBOSE != 0 +#if CONFIG_TESTING_SMART_VERBOSE != 0 printf("Verified!\n"); printf(" Number of files: %d\n", g_nfiles); printf(" Number deleted: %d\n", g_ndeleted); @@ -934,7 +934,7 @@ int smart_main(int argc, char *argv[]) } else { -#if CONFIG_EXAMPLES_SMART_VERBOSE != 0 +#if CONFIG_TESTING_SMART_VERBOSE != 0 printf("Verified!\n"); printf(" Number of files: %d\n", g_nfiles); printf(" Number deleted: %d\n", g_ndeleted); diff --git a/examples/smart_test/.gitignore b/testing/smart_test/.gitignore similarity index 100% rename from examples/smart_test/.gitignore rename to testing/smart_test/.gitignore diff --git a/examples/smart_test/Kconfig b/testing/smart_test/Kconfig similarity index 88% rename from examples/smart_test/Kconfig rename to testing/smart_test/Kconfig index 8a591ee5f..f5db4a810 100644 --- a/examples/smart_test/Kconfig +++ b/testing/smart_test/Kconfig @@ -3,7 +3,7 @@ # see the file kconfig-language.txt in the NuttX tools repository. # -config EXAMPLES_SMART_TEST +config TESTING_SMART_TEST tristate "SMART filesystem test tool" default n depends on NSH_BUILTIN_APPS @@ -12,5 +12,5 @@ config EXAMPLES_SMART_TEST seek, append and seek-with-write operations. This test can be built only as an NSH command -if EXAMPLES_SMART_TEST +if TESTING_SMART_TEST endif diff --git a/examples/smart_test/Make.defs b/testing/smart_test/Make.defs similarity index 93% rename from examples/smart_test/Make.defs rename to testing/smart_test/Make.defs index c1c82da9f..14c4b5012 100644 --- a/examples/smart_test/Make.defs +++ b/testing/smart_test/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# apps/examples/smart_test/Make.defs +# apps/testing/smart_test/Make.defs # Adds selected applications to apps/ build # # Copyright (C) 2015 Gregory Nutt. All rights reserved. @@ -34,6 +34,6 @@ # ############################################################################ -ifneq ($(CONFIG_EXAMPLES_SMART_TEST),) -CONFIGURED_APPS += examples/smart_test +ifneq ($(CONFIG_TESTING_SMART_TEST),) +CONFIGURED_APPS += testing/smart_test endif diff --git a/examples/smart_test/Makefile b/testing/smart_test/Makefile similarity index 98% rename from examples/smart_test/Makefile rename to testing/smart_test/Makefile index 0d27f6789..75e50c69c 100644 --- a/examples/smart_test/Makefile +++ b/testing/smart_test/Makefile @@ -53,6 +53,6 @@ MAINSRC = smart_test.c CONFIG_XYZ_PROGNAME ?= smart_test$(EXEEXT) PROGNAME = $(CONFIG_XYZ_PROGNAME) -MODULE = CONFIG_EXAMPLES_SMART_TEST +MODULE = CONFIG_TESTING_SMART_TEST include $(APPDIR)/Application.mk diff --git a/testing/smart_test/README.txt b/testing/smart_test/README.txt new file mode 100644 index 000000000..390c41fb3 --- /dev/null +++ b/testing/smart_test/README.txt @@ -0,0 +1,27 @@ +README +====== + + Performs a file-based test on a SMART (or any) filesystem. Validates + seek, append and seek-with-write operations. + + * CONFIG_TESTING_SMART_TEST=y + + Dependencies: + + * CONFIG_NSH_BUILTIN_APPS=y: This test can be built only as an NSH + command + + Source: NuttX + Author: Ken Pettit + Date: April 24, 2013 + + Performs a file-based test on a SMART (or any) filesystem. Validates seek, + append and seek-with-write operations. + + Usage: + + flash_test mtdblock_device + + Additional options: + + --force to replace existing installation diff --git a/examples/smart_test/smart_test.c b/testing/smart_test/smart_test.c similarity index 99% rename from examples/smart_test/smart_test.c rename to testing/smart_test/smart_test.c index 34601f3c5..d3f8ee570 100644 --- a/examples/smart_test/smart_test.c +++ b/testing/smart_test/smart_test.c @@ -535,6 +535,7 @@ static int smart_circular_log_test(char *filename) * Description: Displays usage information for the command. * ****************************************************************************/ + static void smart_usage(void) { fprintf(stderr, "usage: smart_test [-c COUNT] [-s SEEKCOUNT] [-w WRITECOUNT] smart_mounted_filename\n\n");