@@ -132,11 +132,14 @@ static void white_box_test()
132
132
} else {
133
133
test_bd = &heap_bd;
134
134
// We need to skip the test if we don't have enough memory for the heap block device.
135
- // However, this device allocates the erase units on the fly, so "erase" it via the flash
136
- // simulator. A failure here means we haven't got enough memory.
137
- heap_bd.init ();
138
- result = heap_bd.erase (0 , heap_bd.size ());
139
- TEST_SKIP_UNLESS_MESSAGE (!result, " Not enough heap to run test" );
135
+ // However, this device allocates the blocks on the fly when programmed. A failure
136
+ // here means we haven't got enough memory.
137
+ result = heap_bd.init ();
138
+ TEST_SKIP_UNLESS_MESSAGE (result == BD_ERROR_OK, " Not enough heap to run test" )
139
+ for (bd_addr_t addr = 0 ; addr < heap_bd.size (); addr += heap_bd.get_program_size ()) {
140
+ result = heap_bd.program (dummy, addr, heap_bd.get_program_size ());
141
+ TEST_SKIP_UNLESS_MESSAGE (result == BD_ERROR_OK, " Not enough heap to run test" )
142
+ }
140
143
heap_bd.deinit ();
141
144
}
142
145
@@ -345,11 +348,14 @@ static void multi_set_test()
345
348
346
349
#ifdef USE_HEAP_BD
347
350
// We need to skip the test if we don't have enough memory for the heap block device.
348
- // However, this device allocates the erase units on the fly, so "erase" it via the flash
349
- // simulator. A failure here means we haven't got enough memory.
350
- flash_bd.init ();
351
- result = flash_bd.erase (0 , flash_bd.size ());
352
- TEST_SKIP_UNLESS_MESSAGE (!result, " Not enough heap to run test" );
351
+ // However, this device allocates the blocks on the fly when programmed. A failure
352
+ // here means we haven't got enough memory.
353
+ result = flash_bd.init ();
354
+ TEST_SKIP_UNLESS_MESSAGE (result == BD_ERROR_OK, " Not enough heap to run test" )
355
+ for (bd_addr_t addr = 0 ; addr < flash_bd.size (); addr += flash_bd.get_program_size ()) {
356
+ result = flash_bd.program (dummy, addr, flash_bd.get_program_size ());
357
+ TEST_SKIP_UNLESS_MESSAGE (result == BD_ERROR_OK, " Not enough heap to run test" )
358
+ }
353
359
flash_bd.deinit ();
354
360
#endif
355
361
0 commit comments