mirror of https://github.com/ARMmbed/mbed-os.git
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
parent
b52575bc65
commit
47684d89a5
|
@ -24,13 +24,12 @@
|
||||||
using namespace utest::v1;
|
using namespace utest::v1;
|
||||||
|
|
||||||
// test configuration
|
// test configuration
|
||||||
#ifndef MBED_TEST_BLOCKDEVICE
|
#ifndef MBED_TEST_SIM_BLOCKDEVICE
|
||||||
#define MBED_TEST_BLOCKDEVICE HeapBlockDevice
|
#error [NOT_SUPPORTED] Simulation block device required for resilience tests
|
||||||
#define MBED_TEST_BLOCKDEVICE_DECL MBED_TEST_BLOCKDEVICE bd(MBED_TEST_BLOCK_COUNT*512, 1, 1, 512)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MBED_TEST_BLOCKDEVICE_DECL
|
#ifndef MBED_TEST_SIM_BLOCKDEVICE_DECL
|
||||||
#define MBED_TEST_BLOCKDEVICE_DECL MBED_TEST_BLOCKDEVICE bd
|
#define MBED_TEST_SIM_BLOCKDEVICE_DECL MBED_TEST_SIM_BLOCKDEVICE bd(MBED_TEST_BLOCK_COUNT*512, 1, 1, 512)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MBED_TEST_BLOCK_COUNT
|
#ifndef MBED_TEST_BLOCK_COUNT
|
||||||
|
@ -50,7 +49,7 @@ using namespace utest::v1;
|
||||||
#define STRINGIZE2(x) #x
|
#define STRINGIZE2(x) #x
|
||||||
#define INCLUDE(x) STRINGIZE(x.h)
|
#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()
|
void test_resilience()
|
||||||
{
|
{
|
||||||
MBED_TEST_BLOCKDEVICE_DECL;
|
MBED_TEST_SIM_BLOCKDEVICE_DECL;
|
||||||
|
|
||||||
// bring up to get block size
|
// bring up to get block size
|
||||||
bd.init();
|
bd.init();
|
||||||
|
|
|
@ -25,13 +25,12 @@
|
||||||
using namespace utest::v1;
|
using namespace utest::v1;
|
||||||
|
|
||||||
// test configuration
|
// test configuration
|
||||||
#ifndef MBED_TEST_BLOCKDEVICE
|
#ifndef MBED_TEST_SIM_BLOCKDEVICE
|
||||||
#define MBED_TEST_BLOCKDEVICE HeapBlockDevice
|
#error [NOT_SUPPORTED] Simulation block device required for wear leveling tests
|
||||||
#define MBED_TEST_BLOCKDEVICE_DECL MBED_TEST_BLOCKDEVICE bd(MBED_TEST_BLOCK_COUNT*512, 1, 1, 512)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MBED_TEST_BLOCKDEVICE_DECL
|
#ifndef MBED_TEST_SIM_BLOCKDEVICE_DECL
|
||||||
#define MBED_TEST_BLOCKDEVICE_DECL MBED_TEST_BLOCKDEVICE bd
|
#define MBED_TEST_SIM_BLOCKDEVICE_DECL MBED_TEST_SIM_BLOCKDEVICE bd(MBED_TEST_BLOCK_COUNT*512, 1, 1, 512)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MBED_TEST_BLOCK_COUNT
|
#ifndef MBED_TEST_BLOCK_COUNT
|
||||||
|
@ -51,12 +50,12 @@ using namespace utest::v1;
|
||||||
#define STRINGIZE2(x) #x
|
#define STRINGIZE2(x) #x
|
||||||
#define INCLUDE(x) STRINGIZE(x.h)
|
#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)
|
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
|
// bring up to get block size
|
||||||
bd.init();
|
bd.init();
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"config": {
|
||||||
|
"sim-blockdevice": {
|
||||||
|
"help": "Simulated block device, requires sufficient heap",
|
||||||
|
"macro_name": "MBED_TEST_SIM_BLOCKDEVICE",
|
||||||
|
"value": "HeapBlockDevice"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,6 +22,11 @@
|
||||||
"tcp-echo-prefix" : {
|
"tcp-echo-prefix" : {
|
||||||
"help" : "Some servers send a prefix before echoed message",
|
"help" : "Some servers send a prefix before echoed message",
|
||||||
"value" : "\"u-blox AG TCP/UDP test service\\n\""
|
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,11 @@
|
||||||
"tcp-echo-prefix" : {
|
"tcp-echo-prefix" : {
|
||||||
"help" : "Some servers send a prefix before echoed message",
|
"help" : "Some servers send a prefix before echoed message",
|
||||||
"value" : "\"u-blox AG TCP/UDP test service\\n\""
|
"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": {
|
"target_overrides": {
|
||||||
|
|
|
@ -22,6 +22,11 @@
|
||||||
"tcp-echo-prefix" : {
|
"tcp-echo-prefix" : {
|
||||||
"help" : "Some servers send a prefix before echoed message",
|
"help" : "Some servers send a prefix before echoed message",
|
||||||
"value" : "\"Realtek Ameba TCP/UDP test service\\n\""
|
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
{
|
{
|
||||||
"ETHERNET" : "EthernetInterface.json",
|
"ETHERNET" : "EthernetInterface.json",
|
||||||
|
"HEAPBLOCKDEVICE": "HeapBlockDevice.json",
|
||||||
|
"HEAPBLOCKDEVICE_AND_ETHERNET": "HeapBlockDeviceAndEthernetInterface.json",
|
||||||
"ODIN_WIFI" : "OdinInterface.json",
|
"ODIN_WIFI" : "OdinInterface.json",
|
||||||
"ODIN_ETHERNET" : "Odin_EthernetInterface.json",
|
"ODIN_ETHERNET" : "Odin_EthernetInterface.json",
|
||||||
"REALTEK_WIFI" : "RealtekInterface.json"
|
"REALTEK_WIFI" : "RealtekInterface.json"
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,5 +6,13 @@
|
||||||
"REALTEK_RTL8195AM": {
|
"REALTEK_RTL8195AM": {
|
||||||
"default_test_configuration": "NONE",
|
"default_test_configuration": "NONE",
|
||||||
"test_configurations": ["REALTEK_WIFI"]
|
"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"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue