Added test config for simulated block devices

Not all devices have enough heap to fit a simulated heap block device,
however using a simulated heap block device is preferred if available
(reduced flash wear, faster testing).

Added MBED_TEST_SIM_BLOCKDEVICE for tests that only need a simulated
block device (wear_leveling + resilience), and added support for targets
that are known to have enough heap.
pull/5538/head
Christopher Haster 2017-11-27 10:30:00 -06:00
parent b52575bc65
commit 47684d89a5
9 changed files with 79 additions and 15 deletions

View File

@ -24,13 +24,12 @@
using namespace utest::v1;
// test configuration
#ifndef MBED_TEST_BLOCKDEVICE
#define MBED_TEST_BLOCKDEVICE HeapBlockDevice
#define MBED_TEST_BLOCKDEVICE_DECL MBED_TEST_BLOCKDEVICE bd(MBED_TEST_BLOCK_COUNT*512, 1, 1, 512)
#ifndef MBED_TEST_SIM_BLOCKDEVICE
#error [NOT_SUPPORTED] Simulation block device required for resilience tests
#endif
#ifndef MBED_TEST_BLOCKDEVICE_DECL
#define MBED_TEST_BLOCKDEVICE_DECL MBED_TEST_BLOCKDEVICE bd
#ifndef MBED_TEST_SIM_BLOCKDEVICE_DECL
#define MBED_TEST_SIM_BLOCKDEVICE_DECL MBED_TEST_SIM_BLOCKDEVICE bd(MBED_TEST_BLOCK_COUNT*512, 1, 1, 512)
#endif
#ifndef MBED_TEST_BLOCK_COUNT
@ -50,7 +49,7 @@ using namespace utest::v1;
#define STRINGIZE2(x) #x
#define INCLUDE(x) STRINGIZE(x.h)
#include INCLUDE(MBED_TEST_BLOCKDEVICE)
#include INCLUDE(MBED_TEST_SIM_BLOCKDEVICE)
/**
@ -62,7 +61,7 @@ using namespace utest::v1;
*/
void test_resilience()
{
MBED_TEST_BLOCKDEVICE_DECL;
MBED_TEST_SIM_BLOCKDEVICE_DECL;
// bring up to get block size
bd.init();

View File

@ -25,13 +25,12 @@
using namespace utest::v1;
// test configuration
#ifndef MBED_TEST_BLOCKDEVICE
#define MBED_TEST_BLOCKDEVICE HeapBlockDevice
#define MBED_TEST_BLOCKDEVICE_DECL MBED_TEST_BLOCKDEVICE bd(MBED_TEST_BLOCK_COUNT*512, 1, 1, 512)
#ifndef MBED_TEST_SIM_BLOCKDEVICE
#error [NOT_SUPPORTED] Simulation block device required for wear leveling tests
#endif
#ifndef MBED_TEST_BLOCKDEVICE_DECL
#define MBED_TEST_BLOCKDEVICE_DECL MBED_TEST_BLOCKDEVICE bd
#ifndef MBED_TEST_SIM_BLOCKDEVICE_DECL
#define MBED_TEST_SIM_BLOCKDEVICE_DECL MBED_TEST_SIM_BLOCKDEVICE bd(MBED_TEST_BLOCK_COUNT*512, 1, 1, 512)
#endif
#ifndef MBED_TEST_BLOCK_COUNT
@ -51,12 +50,12 @@ using namespace utest::v1;
#define STRINGIZE2(x) #x
#define INCLUDE(x) STRINGIZE(x.h)
#include INCLUDE(MBED_TEST_BLOCKDEVICE)
#include INCLUDE(MBED_TEST_SIM_BLOCKDEVICE)
static uint32_t test_wear_leveling_size(uint32_t block_count)
{
MBED_TEST_BLOCKDEVICE_DECL;
MBED_TEST_SIM_BLOCKDEVICE_DECL;
// bring up to get block size
bd.init();

View File

@ -0,0 +1,9 @@
{
"config": {
"sim-blockdevice": {
"help": "Simulated block device, requires sufficient heap",
"macro_name": "MBED_TEST_SIM_BLOCKDEVICE",
"value": "HeapBlockDevice"
}
}
}

View File

@ -0,0 +1,32 @@
{
"config": {
"header-file": {
"help" : "String for including your driver header file",
"value" : "\"EthernetInterface.h\""
},
"object-construction" : {
"value" : "new EthernetInterface()"
},
"connect-statement" : {
"help" : "Must use 'net' variable name",
"value" : "((EthernetInterface *)net)->connect()"
},
"echo-server-addr" : {
"help" : "IP address of echo server",
"value" : "\"195.34.89.241\""
},
"echo-server-port" : {
"help" : "Port of echo server",
"value" : "7"
},
"tcp-echo-prefix" : {
"help" : "Some servers send a prefix before echoed message",
"value" : "\"u-blox AG TCP/UDP test service\\n\""
},
"sim-blockdevice": {
"help": "Simulated block device, requires sufficient heap",
"macro_name": "MBED_TEST_SIM_BLOCKDEVICE",
"value": "HeapBlockDevice"
}
}
}

View File

@ -22,6 +22,11 @@
"tcp-echo-prefix" : {
"help" : "Some servers send a prefix before echoed message",
"value" : "\"u-blox AG TCP/UDP test service\\n\""
},
"sim-blockdevice": {
"help": "Simulated block device, requires sufficient heap",
"macro_name": "MBED_TEST_SIM_BLOCKDEVICE",
"value": "HeapBlockDevice"
}
}
}

View File

@ -22,6 +22,11 @@
"tcp-echo-prefix" : {
"help" : "Some servers send a prefix before echoed message",
"value" : "\"u-blox AG TCP/UDP test service\\n\""
},
"sim-blockdevice": {
"help": "Simulated block device, requires sufficient heap",
"macro_name": "MBED_TEST_SIM_BLOCKDEVICE",
"value": "HeapBlockDevice"
}
},
"target_overrides": {

View File

@ -22,6 +22,11 @@
"tcp-echo-prefix" : {
"help" : "Some servers send a prefix before echoed message",
"value" : "\"Realtek Ameba TCP/UDP test service\\n\""
},
"sim-blockdevice": {
"help": "Simulated block device, requires sufficient heap",
"macro_name": "MBED_TEST_SIM_BLOCKDEVICE",
"value": "HeapBlockDevice"
}
}
}

View File

@ -1,6 +1,8 @@
{
"ETHERNET" : "EthernetInterface.json",
"HEAPBLOCKDEVICE": "HeapBlockDevice.json",
"HEAPBLOCKDEVICE_AND_ETHERNET": "HeapBlockDeviceAndEthernetInterface.json",
"ODIN_WIFI" : "OdinInterface.json",
"ODIN_ETHERNET" : "Odin_EthernetInterface.json",
"REALTEK_WIFI" : "RealtekInterface.json"
"REALTEK_WIFI" : "RealtekInterface.json"
}

View File

@ -6,5 +6,13 @@
"REALTEK_RTL8195AM": {
"default_test_configuration": "NONE",
"test_configurations": ["REALTEK_WIFI"]
},
"K64F": {
"default_test_configuration": "HEAPBLOCKDEVICE_AND_ETHERNET",
"test_configurations": ["HEAPBLOCKDEVICE_AND_ETHERNET"]
},
"NUCLEO_F429ZI": {
"default_test_configuration": "HEAPBLOCKDEVICE_AND_ETHERNET",
"test_configurations": ["HEAPBLOCKDEVICE_AND_ETHERNET"]
}
}