mirror of https://github.com/ARMmbed/mbed-os.git
Ensure unique block address for multi threaded test.
The addresses dont have to change each run, just be unique. Because address seeds repeat themselves each run, rand() will produce repeating results that should not collide between different threads.pull/9650/head
parent
4bbc2cdc5b
commit
be1c887477
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue