diff --git a/storage/blockdevice/tests/TESTS/blockdevice/general_block_device/main.cpp b/storage/blockdevice/tests/TESTS/blockdevice/general_block_device/main.cpp index 6ec35c5679..93e898d395 100644 --- a/storage/blockdevice/tests/TESTS/blockdevice/general_block_device/main.cpp +++ b/storage/blockdevice/tests/TESTS/blockdevice/general_block_device/main.cpp @@ -549,8 +549,15 @@ void test_contiguous_erase_write_read() utest_printf("contiguous_erase_size=0x%" PRIx64 "\n", contiguous_erase_size); bd_size_t write_read_buf_size = program_size; - if (contiguous_erase_size / program_size > 8 && contiguous_erase_size % (program_size * 8) == 0) { - write_read_buf_size = program_size * 8; + + // Reading/writing in larger chunks reduces the number of operations, + // helping to avoid test timeouts. Try 256-byte chunks if contiguous_erase_size + // (which should be a power of 2) is greater than that. If it's less than + // that, the test finishes quickly anyway... + if ((program_size < 256) && (256 % program_size == 0) + && (contiguous_erase_size >= 256) && (contiguous_erase_size % 256 == 0)) { + utest_printf("using 256-byte write/read buffer\n"); + write_read_buf_size = 256; } // Allocate write/read buffer