Skip to content

Commit a0cf002

Browse files
usb_device-msd test: improve error handling
1 parent 1bab74b commit a0cf002

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

TESTS/usb_device/msd/main.cpp

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,10 @@ void msd_process(USBMSD *msd)
250250
*/
251251
void storage_init()
252252
{
253-
if (mbed_heap_size >= MIN_HEAP_SIZE) {
254-
FATFileSystem::format(get_heap_block_device());
255-
bool result = prepare_storage(get_heap_block_device(), &heap_fs);
256-
TEST_ASSERT_MESSAGE(result, "heap storage initialisation failed");
257-
} else {
258-
utest_printf("Not enough heap memory for HeapBlockDevice creation. Heap block device init skipped!!!\n");
259-
}
253+
TEST_ASSERT_MESSAGE(mbed_heap_size >= MIN_HEAP_SIZE, "Not enough heap memory for HeapBlockDevice creation");
254+
FATFileSystem::format(get_heap_block_device());
255+
bool result = prepare_storage(get_heap_block_device(), &heap_fs);
256+
TEST_ASSERT_MESSAGE(result, "heap storage initialisation failed");
260257
}
261258

262259
/** Test mass storage device mount and unmount
@@ -428,19 +425,13 @@ void mount_unmount_and_data_test(BlockDevice *bd, FileSystem *fs)
428425

429426
void heap_block_device_mount_unmount_test()
430427
{
431-
if (mbed_heap_size < MIN_HEAP_SIZE) {
432-
TEST_SKIP_MESSAGE("Not enough heap memory for HeapBlockDevice creation");
433-
return;
434-
}
428+
TEST_ASSERT_MESSAGE(mbed_heap_size >= MIN_HEAP_SIZE, "Not enough heap memory for HeapBlockDevice creation");
435429
mount_unmount_test<3>(get_heap_block_device(), &heap_fs);
436430
}
437431

438432
void heap_block_device_mount_unmount_and_data_test()
439433
{
440-
if (mbed_heap_size < MIN_HEAP_SIZE) {
441-
TEST_SKIP_MESSAGE("Not enough heap memory for HeapBlockDevice creation");
442-
return;
443-
}
434+
TEST_ASSERT_MESSAGE(mbed_heap_size >= MIN_HEAP_SIZE, "Not enough heap memory for HeapBlockDevice creation");
444435
mount_unmount_and_data_test(get_heap_block_device(), &heap_fs);
445436
}
446437

0 commit comments

Comments
 (0)