Skip to content

Commit fa59351

Browse files
committed
[TESTS] Add memory check for RAM constraint device
1 parent af6afd8 commit fa59351

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

TESTS/mbed_hal/stack_size_unification/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ extern uint32_t mbed_stack_isr_size;
4848

4949
#define EXPECTED_USER_THREAD_DEFAULT_STACK_SIZE (4096)
5050

51+
#if ((MBED_RAM_SIZE - MBED_BOOT_STACK_SIZE) <= (EXPECTED_MAIN_THREAD_STACK_SIZE + EXPECTED_ISR_STACK_SIZE))
52+
#error [NOT_SUPPORTED] Insufficient stack for staci_size_unification tests
53+
#endif
54+
55+
5156
/* Test sizes of ISR stack, main thread stack, default user thread stack.
5257
*
5358
* On some platforms with lower RAM size (e.g. NUCLEO_F070RB - 16 KB RAM) it is impossible

features/storage/TESTS/blockdevice/heap_block_device/main.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,15 @@
2323

2424
using namespace utest::v1;
2525

26-
// TODO HACK, replace with available ram/heap property
27-
#if defined(TARGET_LPC1114)
28-
#error [NOT_SUPPORTED] Insufficient heap for heap block device tests
29-
#else
30-
3126
#define TEST_BLOCK_SIZE 128
3227
#define TEST_BLOCK_DEVICE_SIZE 32*TEST_BLOCK_SIZE
3328
#define TEST_BLOCK_COUNT 10
3429
#define TEST_ERROR_MASK 16
3530

31+
#if ((MBED_RAM_SIZE - MBED_BOOT_STACK_SIZE) <= TEST_BLOCK_DEVICE_SIZE)
32+
#error [NOT_SUPPORTED] Insufficient heap for heap block device tests
33+
#endif
34+
3635
const struct {
3736
const char *name;
3837
bd_size_t (BlockDevice::*method)() const;

features/storage/TESTS/blockdevice/mbr_block_device/main.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,13 @@
2424

2525
using namespace utest::v1;
2626

27-
// TODO HACK, replace with available ram/heap property
28-
#if defined(TARGET_LPC1114)
29-
#error [NOT_SUPPORTED] Insufficient heap for heap block device tests
30-
#else
31-
3227
#define BLOCK_COUNT 16
3328
#define BLOCK_SIZE 512
3429

30+
#if ((MBED_RAM_SIZE - MBED_BOOT_STACK_SIZE) <= (BLOCK_COUNT * BLOCK_SIZE))
31+
#error [NOT_SUPPORTED] Insufficient heap for mbr block device tests
32+
#endif
33+
3534
HeapBlockDevice bd(BLOCK_COUNT *BLOCK_SIZE, BLOCK_SIZE);
3635

3736
// Testing formatting of master boot record

features/storage/TESTS/blockdevice/util_block_device/main.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,13 @@
2626

2727
using namespace utest::v1;
2828

29-
// TODO HACK, replace with available ram/heap property
30-
#if defined(TARGET_LPC1114)
31-
#error [NOT_SUPPORTED] Insufficient heap for heap block device tests
32-
#else
33-
3429
#define BLOCK_COUNT 16
3530
#define BLOCK_SIZE 512
3631

32+
#if ((MBED_RAM_SIZE - MBED_BOOT_STACK_SIZE) <= (BLOCK_COUNT * BLOCK_SIZE))
33+
#error [NOT_SUPPORTED] Insufficient heap for util block device tests
34+
#endif
35+
3736

3837
// Simple test which read/writes blocks on a sliced block device
3938
void test_slicing()

0 commit comments

Comments
 (0)