Merge pull request #9650 from offirko/offir_fix_random_block_in_general_bd_test

Multi thread Block Device Tests Fix - Ensure unique block address
pull/9677/head
Cruz Monrreal 2019-02-11 18:46:34 -06:00 committed by GitHub
commit a12d9bb2a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 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();

View File

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