tests/pkg_littlefs*: make use hardware MTD optional

This commit is contained in:
Alexandre Abadie 2021-02-25 10:13:50 +01:00
parent 43c84c616b
commit a8be37bbf0
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
2 changed files with 12 additions and 6 deletions

View File

@ -23,8 +23,11 @@
#include "embUnit.h" #include "embUnit.h"
/* Define MTD_0 in board.h to use the board mtd if any */ /* Define MTD_0 in board.h to use the board mtd if any and if
#ifdef MTD_0 * CONFIG_USE_HARDWARE_MTD is defined (add CFLAGS=-DCONFIG_USE_HARDWARE_MTD to
* the command line to enable it */
#if defined(MTD_0) && IS_ACTIVE(CONFIG_USE_HARDWARE_MTD)
#define USE_MTD_0
#define _dev (MTD_0) #define _dev (MTD_0)
#else #else
/* Test mock object implementing a simple RAM-based mtd */ /* Test mock object implementing a simple RAM-based mtd */
@ -404,7 +407,7 @@ static void tests_littlefs_statvfs(void)
Test *tests_littlefs(void) Test *tests_littlefs(void)
{ {
#ifndef MTD_0 #ifndef USE_MTD_0
memset(dummy_memory, 0xff, sizeof(dummy_memory)); memset(dummy_memory, 0xff, sizeof(dummy_memory));
#endif #endif

View File

@ -23,8 +23,11 @@
#include "embUnit.h" #include "embUnit.h"
/* Define MTD_0 in board.h to use the board mtd if any */ /* Define MTD_0 in board.h to use the board mtd if any and if
#ifdef MTD_0 * CONFIG_USE_HARDWARE_MTD is defined (add CFLAGS=-DCONFIG_USE_HARDWARE_MTD to
* the command line to enable it */
#if defined(MTD_0) && IS_ACTIVE(CONFIG_USE_HARDWARE_MTD)
#define USE_MTD_0
#define _dev (MTD_0) #define _dev (MTD_0)
#else #else
/* Test mock object implementing a simple RAM-based mtd */ /* Test mock object implementing a simple RAM-based mtd */
@ -406,7 +409,7 @@ static void tests_littlefs_statvfs(void)
Test *tests_littlefs(void) Test *tests_littlefs(void)
{ {
#ifndef MTD_0 #ifndef USE_MTD_0
memset(dummy_memory, 0xff, sizeof(dummy_memory)); memset(dummy_memory, 0xff, sizeof(dummy_memory));
#endif #endif