Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The introduction of `sanitycheck --list-tests` fails to properly parse the subcases in tests/subsys/fs/nffs_api/ beacause four of them are all packed with #ifdefs in a single src/main.c. So this breaks that testcase in four: - creating a common folder with the code itself - moving the common code in */src/main.c to common/test_nffs.h and adding ../common/*.c to the sources - thinning each testcase.yaml to have only the needed testcase definition - adding zephyr_include_directories(../common) to the cmakefiles so we now produce with --list-tests - filesystem.nffs.basic.append - filesystem.nffs.basic.corrupt_block - filesystem.nffs.basic.corrupt_scratch - filesystem.nffs.basic.fs_mount - filesystem.nffs.basic.gc - filesystem.nffs.basic.gc_on_oom - filesystem.nffs.basic.incomplete_block - filesystem.nffs.basic.large_write - filesystem.nffs.basic.long_filename - filesystem.nffs.basic.lost_found - filesystem.nffs.basic.many_children - filesystem.nffs.basic.mkdir - filesystem.nffs.basic.open - filesystem.nffs.basic.overwrite_many - filesystem.nffs.basic.overwrite_one - filesystem.nffs.basic.overwrite_three - filesystem.nffs.basic.overwrite_two - filesystem.nffs.basic.read - filesystem.nffs.basic.readdir - filesystem.nffs.basic.rename - filesystem.nffs.basic.split_file - filesystem.nffs.basic.unlink - filesystem.nffs.basic.wear_level - filesystem.nffs.cache.cache_large_file - filesystem.nffs.cache.fs_mount - filesystem.nffs.large.fs_mount - filesystem.nffs.large.large_system - filesystem.nffs.large.large_unlink - filesystem.nffs.performance.fs_mount - filesystem.nffs.performance.performance 30 total. vs before, that we did: - filesystem.nffs.basic.append - filesystem.nffs.basic.corrupt_block - filesystem.nffs.basic.corrupt_scratch - filesystem.nffs.basic.fs_mount - filesystem.nffs.basic.gc - filesystem.nffs.basic.gc_on_oom - filesystem.nffs.basic.incomplete_block - filesystem.nffs.basic.large_write - filesystem.nffs.basic.long_filename - filesystem.nffs.basic.lost_found - filesystem.nffs.basic.many_children - filesystem.nffs.basic.mkdir - filesystem.nffs.basic.open - filesystem.nffs.basic.overwrite_many - filesystem.nffs.basic.overwrite_one - filesystem.nffs.basic.overwrite_three - filesystem.nffs.basic.overwrite_two - filesystem.nffs.basic.read - filesystem.nffs.basic.readdir - filesystem.nffs.basic.rename - filesystem.nffs.basic.split_file - filesystem.nffs.basic.unlink - filesystem.nffs.basic.wear_level - filesystem.nffs.cache.append - filesystem.nffs.cache.corrupt_block - filesystem.nffs.cache.corrupt_scratch - filesystem.nffs.cache.fs_mount ... - filesystem.nffs.cache.split_file - filesystem.nffs.cache.unlink - filesystem.nffs.cache.wear_level - filesystem.nffs.large.append - filesystem.nffs.large.corrupt_block - filesystem.nffs.large.corrupt_scratch ... - filesystem.nffs.large.split_file - filesystem.nffs.large.unlink - filesystem.nffs.large.wear_level - filesystem.nffs.performance.append - filesystem.nffs.performance.corrupt_block ... - filesystem.nffs.performance.unlink - filesystem.nffs.performance.wear_level 92 total. (so it was repeating ALL the subcases for eatch main testcase) Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
- Loading branch information
1 parent
d4221f9
commit 14fe272
Showing
55 changed files
with
464 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
if(BOARD STREQUAL nrf51_pca10028) | ||
set(CONF_FILE nrf5x.conf) | ||
elseif(BOARD STREQUAL nrf52_pca10040) | ||
set(CONF_FILE nrf5x.conf) | ||
elseif(BOARD STREQUAL nrf52840_pca10056) | ||
set(CONF_FILE nrf5x.conf) | ||
endif() | ||
|
||
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) | ||
project(NONE) | ||
|
||
if(BOARD STREQUAL qemu_x86) | ||
zephyr_compile_definitions( | ||
-DTEST_FLASH_OFFSET=0 | ||
-DFLASH_AREA_STORAGE_OFFSET=0 | ||
-DFLASH_AREA_STORAGE_SIZE=1048576 | ||
) | ||
elseif(BOARD STREQUAL nrf51_pca10028) | ||
zephyr_compile_definitions( | ||
-DTEST_FLASH_OFFSET=0x20000 | ||
) | ||
elseif(BOARD STREQUAL nrf52_pca10040) | ||
zephyr_compile_definitions( | ||
-DTEST_FLASH_OFFSET=0x20000 | ||
) | ||
elseif(BOARD STREQUAL nrf52840_pca10056) | ||
zephyr_compile_definitions( | ||
-DTEST_FLASH_OFFSET=0x20000 | ||
) | ||
endif() | ||
|
||
if(NOT TEST) | ||
target_compile_definitions(app PRIVATE | ||
-DTEST_basic | ||
) | ||
else() | ||
target_compile_definitions(app PRIVATE | ||
-DTEST_${TEST} | ||
) | ||
endif() | ||
|
||
|
||
zephyr_include_directories(../common) | ||
target_link_libraries(app NFFS) | ||
FILE(GLOB app_sources ../common/*.c src/*.c) | ||
target_sources(app PRIVATE ${app_sources}) |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
common: | ||
tags: nffs filesystem | ||
tests: | ||
filesystem.nffs.basic: | ||
extra_args: TEST=basic | ||
platform_whitelist: qemu_x86 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
if(BOARD STREQUAL nrf51_pca10028) | ||
set(CONF_FILE nrf5x.conf) | ||
elseif(BOARD STREQUAL nrf52_pca10040) | ||
set(CONF_FILE nrf5x.conf) | ||
elseif(BOARD STREQUAL nrf52840_pca10056) | ||
set(CONF_FILE nrf5x.conf) | ||
endif() | ||
|
||
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) | ||
project(NONE) | ||
|
||
if(BOARD STREQUAL qemu_x86) | ||
zephyr_compile_definitions( | ||
-DTEST_FLASH_OFFSET=0 | ||
-DFLASH_AREA_STORAGE_OFFSET=0 | ||
-DFLASH_AREA_STORAGE_SIZE=1048576 | ||
) | ||
elseif(BOARD STREQUAL nrf51_pca10028) | ||
zephyr_compile_definitions( | ||
-DTEST_FLASH_OFFSET=0x20000 | ||
) | ||
elseif(BOARD STREQUAL nrf52_pca10040) | ||
zephyr_compile_definitions( | ||
-DTEST_FLASH_OFFSET=0x20000 | ||
) | ||
elseif(BOARD STREQUAL nrf52840_pca10056) | ||
zephyr_compile_definitions( | ||
-DTEST_FLASH_OFFSET=0x20000 | ||
) | ||
endif() | ||
|
||
if(NOT TEST) | ||
target_compile_definitions(app PRIVATE | ||
-DTEST_basic | ||
) | ||
else() | ||
target_compile_definitions(app PRIVATE | ||
-DTEST_${TEST} | ||
) | ||
endif() | ||
|
||
|
||
zephyr_include_directories(../common) | ||
target_link_libraries(app NFFS) | ||
FILE(GLOB app_sources ../common/*.c src/*.c) | ||
target_sources(app PRIVATE ${app_sources}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
CONFIG_ZTEST=y | ||
CONFIG_ZTEST_STACKSIZE=2048 | ||
CONFIG_MAIN_STACK_SIZE=1024 | ||
CONFIG_HEAP_MEM_POOL_SIZE=1024 | ||
|
||
CONFIG_FLASH=y | ||
CONFIG_SOC_FLASH_NRF_RADIO_SYNC=y | ||
CONFIG_MPU_ALLOW_FLASH_WRITE=y | ||
|
||
CONFIG_FILE_SYSTEM=y | ||
CONFIG_FILE_SYSTEM_NFFS=y | ||
CONFIG_FS_NFFS_FLASH_DEV_NAME="NRF_FLASH_DRV_NAME" | ||
CONFIG_FS_NFFS_NUM_FILES=4 | ||
CONFIG_FS_NFFS_NUM_DIRS=4 | ||
CONFIG_FS_NFFS_NUM_INODES=1024 | ||
CONFIG_FS_NFFS_NUM_BLOCKS=1024 | ||
CONFIG_FS_NFFS_NUM_CACHE_INODES=1 | ||
CONFIG_FS_NFFS_NUM_CACHE_BLOCKS=1 | ||
CONFIG_FILE_SYSTEM_NFFS=y | ||
CONFIG_NFFS_FILESYSTEM_MAX_AREAS=12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
CONFIG_TEST_FLASH_DRIVERS=y | ||
CONFIG_FILE_SYSTEM_NFFS=y | ||
CONFIG_FILE_SYSTEM=y | ||
CONFIG_FLASH_PAGE_LAYOUT=y | ||
CONFIG_FLASH=y | ||
CONFIG_FS_NFFS_FLASH_DEV_NAME="ram_flash_test_drv" | ||
CONFIG_FS_NFFS_NUM_BLOCKS=1024 | ||
CONFIG_FS_NFFS_NUM_CACHE_BLOCKS=1 | ||
CONFIG_FS_NFFS_NUM_CACHE_INODES=1 | ||
CONFIG_FS_NFFS_NUM_DIRS=4 | ||
CONFIG_FS_NFFS_NUM_FILES=4 | ||
CONFIG_FS_NFFS_NUM_INODES=1024 | ||
CONFIG_HEAP_MEM_POOL_SIZE=1024 | ||
CONFIG_MAIN_STACK_SIZE=1024 | ||
CONFIG_NFFS_FILESYSTEM_MAX_AREAS=12 | ||
CONFIG_ZTEST_STACKSIZE=2048 | ||
CONFIG_ZTEST=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright (c) 2017 Codecoup | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <nffs/nffs.h> | ||
#include "test_nffs.h" | ||
|
||
void test_main(void) | ||
{ | ||
ztest_test_suite(nffs_fs_cache_test, | ||
ztest_unit_test_setup_teardown(test_fs_mount, | ||
test_setup, test_teardown), | ||
ztest_unit_test_setup_teardown(test_cache_large_file, | ||
test_setup, test_teardown)); | ||
ztest_run_test_suite(nffs_fs_cache_test); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
common: | ||
tags: nffs filesystem | ||
tests: | ||
filesystem.nffs.cache: | ||
extra_args: TEST=cache | ||
extra_configs: | ||
- CONFIG_FS_NFFS_NUM_CACHE_BLOCKS=64 | ||
- CONFIG_FS_NFFS_NUM_CACHE_INODES=4 | ||
platform_whitelist: qemu_x86 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* Copyright (c) 2017 Codecoup | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <zephyr.h> | ||
#include <ztest.h> | ||
#include <fs.h> | ||
|
||
void test_fs_mount(void); | ||
void test_mkdir(void); | ||
void test_gc_on_oom(void); | ||
void test_incomplete_block(void); | ||
void test_lost_found(void); | ||
void test_readdir(void); | ||
void test_large_system(void); | ||
void test_corrupt_block(void); | ||
void test_split_file(void); | ||
void test_large_unlink(void); | ||
void test_corrupt_scratch(void); | ||
void test_unlink(void); | ||
void test_append(void); | ||
void test_rename(void); | ||
void test_truncate(void); | ||
void test_open(void); | ||
void test_wear_level(void); | ||
void test_long_filename(void); | ||
void test_overwrite_one(void); | ||
void test_many_children(void); | ||
void test_gc(void); | ||
void test_overwrite_many(void); | ||
void test_overwrite_two(void); | ||
void test_overwrite_three(void); | ||
void test_read(void); | ||
void test_cache_large_file(void); | ||
void test_large_write(void); | ||
void test_performance(void); | ||
|
||
#if CONFIG_BOARD_QEMU_X86 | ||
static struct nffs_area_desc nffs_selftest_area_descs[] = { | ||
{ 0x00000000, 16 * 1024 }, | ||
{ 0x00004000, 16 * 1024 }, | ||
{ 0x00008000, 16 * 1024 }, | ||
{ 0x0000c000, 16 * 1024 }, | ||
{ 0x00010000, 64 * 1024 }, | ||
{ 0x00020000, 128 * 1024 }, | ||
{ 0x00040000, 128 * 1024 }, | ||
{ 0x00060000, 128 * 1024 }, | ||
{ 0x00080000, 128 * 1024 }, | ||
{ 0x000a0000, 128 * 1024 }, | ||
{ 0x000c0000, 128 * 1024 }, | ||
{ 0x000e0000, 128 * 1024 }, | ||
{ 0, 0 }, | ||
}; | ||
#else | ||
static struct nffs_area_desc nffs_selftest_area_descs[] = { | ||
{ 0x00020000, 2 * 4096 }, | ||
{ 0x00022000, 2 * 4096 }, | ||
{ 0x00024000, 2 * 4096 }, | ||
{ 0x00026000, 2 * 4096 }, | ||
{ 0x00028000, 2 * 4096 }, | ||
{ 0x0002a000, 2 * 4096 }, | ||
{ 0x0002c000, 2 * 4096 }, | ||
{ 0x00030000, 2 * 4096 }, | ||
{ 0x00032000, 2 * 4096 }, | ||
{ 0x00034000, 2 * 4096 }, | ||
{ 0x00036000, 2 * 4096 }, | ||
{ 0x00038000, 2 * 4096 }, | ||
{ 0, 0 }, | ||
}; | ||
#endif | ||
|
||
static struct nffs_area_desc *save_area_descs; | ||
|
||
static void test_setup(void) | ||
{ | ||
save_area_descs = nffs_current_area_descs; | ||
nffs_current_area_descs = nffs_selftest_area_descs; | ||
} | ||
|
||
static void test_teardown(void) | ||
{ | ||
nffs_current_area_descs = save_area_descs; | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.