mirror of https://github.com/ARMmbed/mbed-os.git
STORAGE: fix for heap_block_device and util_block_device test binaries being too large for IAR KL25Z with MBED_STACK_STATS_ENABLED build.
parent
2b96c74f84
commit
0b0fc7d7d1
|
@ -23,7 +23,14 @@
|
||||||
|
|
||||||
using namespace utest::v1;
|
using namespace utest::v1;
|
||||||
|
|
||||||
|
/* It is not possible to build a KL25Z image with IAR including the file system if
|
||||||
|
* stack tracking statistics are enabled. If this is the case, build dummy
|
||||||
|
* tests.
|
||||||
|
*/
|
||||||
|
#if ! defined(TOOLCHAIN_IAR) && ! defined(TARGET_KL25Z) && ! defined(MBED_STACK_STATS_ENABLED)
|
||||||
|
|
||||||
#define BLOCK_SIZE 512
|
#define BLOCK_SIZE 512
|
||||||
|
#define HEAP_BLOCK_DEVICE_TEST_01 test_read_write
|
||||||
uint8_t write_block[BLOCK_SIZE];
|
uint8_t write_block[BLOCK_SIZE];
|
||||||
uint8_t read_block[BLOCK_SIZE];
|
uint8_t read_block[BLOCK_SIZE];
|
||||||
|
|
||||||
|
@ -57,6 +64,21 @@ void test_read_write() {
|
||||||
TEST_ASSERT_EQUAL(0, err);
|
TEST_ASSERT_EQUAL(0, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else /* ! defined(TOOLCHAIN_IAR) && ! defined(TARGET_KL25Z) && ! defined(MBED_STACK_STATS_ENABLED) */
|
||||||
|
|
||||||
|
#define HEAP_BLOCK_DEVICE_TEST_01 heap_block_device_test_dummy
|
||||||
|
|
||||||
|
/** @brief heap_block_device_test_dummy Dummy test case for testing when KL25Z being built with stack statistics enabled.
|
||||||
|
*
|
||||||
|
* @return success always
|
||||||
|
*/
|
||||||
|
static control_t heap_block_device_test_dummy()
|
||||||
|
{
|
||||||
|
printf("Null test\n");
|
||||||
|
return CaseNext;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* ! defined(TOOLCHAIN_IAR) && ! defined(TARGET_KL25Z) && ! defined(MBED_STACK_STATS_ENABLED) */
|
||||||
|
|
||||||
// Test setup
|
// Test setup
|
||||||
utest::v1::status_t test_setup(const size_t number_of_cases) {
|
utest::v1::status_t test_setup(const size_t number_of_cases) {
|
||||||
|
@ -65,7 +87,7 @@ utest::v1::status_t test_setup(const size_t number_of_cases) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Case cases[] = {
|
Case cases[] = {
|
||||||
Case("Testing read write of a block", test_read_write),
|
Case("Testing read write of a block", HEAP_BLOCK_DEVICE_TEST_01),
|
||||||
};
|
};
|
||||||
|
|
||||||
Specification specification(test_setup, cases);
|
Specification specification(test_setup, cases);
|
||||||
|
|
|
@ -25,11 +25,20 @@
|
||||||
|
|
||||||
using namespace utest::v1;
|
using namespace utest::v1;
|
||||||
|
|
||||||
|
/* It is not possible to build a KL25Z image with IAR including the file system if
|
||||||
|
* stack tracking statistics are enabled. If this is the case, build dummy
|
||||||
|
* tests.
|
||||||
|
*/
|
||||||
|
#if ! defined(TOOLCHAIN_IAR) && ! defined(TARGET_KL25Z) && ! defined(MBED_STACK_STATS_ENABLED)
|
||||||
|
|
||||||
#define BLOCK_COUNT 16
|
#define BLOCK_COUNT 16
|
||||||
#define BLOCK_SIZE 512
|
#define BLOCK_SIZE 512
|
||||||
|
#define UTIL_BLOCK_DEVICE_TEST_01 test_slicing
|
||||||
|
#define UTIL_BLOCK_DEVICE_TEST_02 test_chaining
|
||||||
uint8_t write_block[BLOCK_SIZE];
|
uint8_t write_block[BLOCK_SIZE];
|
||||||
uint8_t read_block[BLOCK_SIZE];
|
uint8_t read_block[BLOCK_SIZE];
|
||||||
|
|
||||||
|
|
||||||
// Simple test which read/writes blocks on a sliced block device
|
// Simple test which read/writes blocks on a sliced block device
|
||||||
void test_slicing() {
|
void test_slicing() {
|
||||||
HeapBlockDevice bd(BLOCK_COUNT*BLOCK_SIZE, BLOCK_SIZE);
|
HeapBlockDevice bd(BLOCK_COUNT*BLOCK_SIZE, BLOCK_SIZE);
|
||||||
|
@ -169,6 +178,22 @@ void test_chaining() {
|
||||||
TEST_ASSERT_EQUAL(0, err);
|
TEST_ASSERT_EQUAL(0, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else /* ! defined(TOOLCHAIN_IAR) && ! defined(TARGET_KL25Z) && ! defined(MBED_STACK_STATS_ENABLED) */
|
||||||
|
|
||||||
|
#define UTIL_BLOCK_DEVICE_TEST_01 util_block_device_test_dummy
|
||||||
|
#define UTIL_BLOCK_DEVICE_TEST_02 util_block_device_test_dummy
|
||||||
|
|
||||||
|
/** @brief util_block_device_test_dummy Dummy test case for testing when KL25Z being built with stack statistics enabled.
|
||||||
|
*
|
||||||
|
* @return success always
|
||||||
|
*/
|
||||||
|
static control_t util_block_device_test_dummy()
|
||||||
|
{
|
||||||
|
printf("Null test\n");
|
||||||
|
return CaseNext;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* ! defined(TOOLCHAIN_IAR) && ! defined(TARGET_KL25Z) && ! defined(MBED_STACK_STATS_ENABLED) */
|
||||||
|
|
||||||
// Test setup
|
// Test setup
|
||||||
utest::v1::status_t test_setup(const size_t number_of_cases) {
|
utest::v1::status_t test_setup(const size_t number_of_cases) {
|
||||||
|
@ -177,8 +202,8 @@ utest::v1::status_t test_setup(const size_t number_of_cases) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Case cases[] = {
|
Case cases[] = {
|
||||||
Case("Testing slicing of a block device", test_slicing),
|
Case("Testing slicing of a block device", UTIL_BLOCK_DEVICE_TEST_01),
|
||||||
Case("Testing chaining of block devices", test_chaining),
|
Case("Testing chaining of block devices", UTIL_BLOCK_DEVICE_TEST_02),
|
||||||
};
|
};
|
||||||
|
|
||||||
Specification specification(test_setup, cases);
|
Specification specification(test_setup, cases);
|
||||||
|
|
Loading…
Reference in New Issue