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
offirko 2019-02-10 10:49:19 +02:00
parent 4bbc2cdc5b
commit be1c887477
1 changed files with 5 additions and 0 deletions

View File

@ -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();