mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #9650 from offirko/offir_fix_random_block_in_general_bd_test
Multi thread Block Device Tests Fix - Ensure unique block addresspull/9677/head
commit
a12d9bb2a0
|
@ -47,6 +47,11 @@ void basic_erase_program_read_test(SPIFBlockDevice &block_device, bd_size_t bloc
|
|||
{
|
||||
int err = 0;
|
||||
_mutex->lock();
|
||||
|
||||
// Make sure block address per each test is unique
|
||||
static unsigned block_seed = 1;
|
||||
srand(block_seed++);
|
||||
|
||||
// Find a random block
|
||||
bd_addr_t block = (rand() * block_size) % block_device.size();
|
||||
|
||||
|
|
|
@ -187,6 +187,11 @@ void basic_erase_program_read_test(BlockDevice *block_device, bd_size_t block_si
|
|||
{
|
||||
int err = 0;
|
||||
_mutex->lock();
|
||||
|
||||
// Make sure block address per each test is unique
|
||||
static unsigned block_seed = 1;
|
||||
srand(block_seed++);
|
||||
|
||||
// Find a random block
|
||||
bd_addr_t block = (rand() * block_size) % (block_device->size());
|
||||
|
||||
|
|
Loading…
Reference in New Issue