Skip to content

Commit f7a6d25

Browse files
author
Deepika
committed
rand() by default does increment of 1, randomizing more
Random number generation in case of IAR 8, requires TLS support. Thread local storage is not part of Mbed OS, test is updated to have random numbers sparse, but in future random number creation should be moved to main thread, or use some other logic for randomization instead of rand() call.
1 parent 270827b commit f7a6d25

File tree

2 files changed

+6
-4
lines changed
  • components/storage/blockdevice/COMPONENT_SPIF/TESTS/block_device/spif
  • features/storage/TESTS/blockdevice/general_block_device

2 files changed

+6
-4
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ void basic_erase_program_read_test(SPIFBlockDevice &block_device, bd_size_t bloc
4949
_mutex->lock();
5050

5151
// Make sure block address per each test is unique
52-
static unsigned block_seed = 1;
53-
srand(block_seed++);
52+
static unsigned block_seed = SPIF_TEST_NUM_OF_THREADS;
53+
srand(block_seed);
54+
block_seed += 2;
5455

5556
// Find a random block
5657
bd_addr_t block = (rand() * block_size) % block_device.size();

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,9 @@ void basic_erase_program_read_test(BlockDevice *block_device, bd_size_t block_si
189189
_mutex->lock();
190190

191191
// Make sure block address per each test is unique
192-
static unsigned block_seed = 1;
193-
srand(block_seed++);
192+
static unsigned block_seed = TEST_NUM_OF_THREADS;
193+
srand(block_seed);
194+
block_seed += 2;
194195

195196
// Find a random block
196197
bd_addr_t block = (rand() * block_size) % (block_device->size());

0 commit comments

Comments
 (0)