Skip to content

Commit a12d9bb

Browse files
author
Cruz Monrreal
authored
Merge pull request #9650 from offirko/offir_fix_random_block_in_general_bd_test
Multi thread Block Device Tests Fix - Ensure unique block address
2 parents 87a9d7c + be1c887 commit a12d9bb

File tree

2 files changed

+10
-0
lines changed
  • components/storage/blockdevice/COMPONENT_SPIF/TESTS/block_device/spif
  • features/storage/TESTS/blockdevice/general_block_device

2 files changed

+10
-0
lines changed

components/storage/blockdevice/COMPONENT_SPIF/TESTS/block_device/spif/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ void basic_erase_program_read_test(SPIFBlockDevice &block_device, bd_size_t bloc
4747
{
4848
int err = 0;
4949
_mutex->lock();
50+
51+
// Make sure block address per each test is unique
52+
static unsigned block_seed = 1;
53+
srand(block_seed++);
54+
5055
// Find a random block
5156
bd_addr_t block = (rand() * block_size) % block_device.size();
5257

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ void basic_erase_program_read_test(BlockDevice *block_device, bd_size_t block_si
187187
{
188188
int err = 0;
189189
_mutex->lock();
190+
191+
// Make sure block address per each test is unique
192+
static unsigned block_seed = 1;
193+
srand(block_seed++);
194+
190195
// Find a random block
191196
bd_addr_t block = (rand() * block_size) % (block_device->size());
192197

0 commit comments

Comments
 (0)