Skip to content

Commit ee42f87

Browse files
author
Rohit Grover
committed
programDataWithMultipleProgramUnits: skip test if N_UNITS causes required range to exceed buffer size
1 parent a3c79a9 commit ee42f87

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

TESTS/storage_abstraction/basicAPI/basicAPI.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,11 @@ control_t test_programDataWithMultipleProgramUnits(const size_t call_count)
869869
return CaseNext; /* first block isn't large enough for the intended operation */
870870
}
871871

872+
if (rangeNeededForTest > BUFFER_SIZE) {
873+
printf("buffer (%u) not large enough; rangeNeededForTest: %u\n", BUFFER_SIZE, rangeNeededForTest);
874+
return CaseNext;
875+
}
876+
872877
// printf("erasing %u bytes at addr %lu\n", rangeNeededForTest, (uint32_t)firstBlock.addr);
873878
rc = drv->Erase(firstBlock.addr, rangeNeededForTest);
874879
TEST_ASSERT(rc >= 0);
@@ -878,8 +883,6 @@ control_t test_programDataWithMultipleProgramUnits(const size_t call_count)
878883
} else {
879884
TEST_ASSERT_EQUAL(rangeNeededForTest, rc);
880885

881-
TEST_ASSERT((N_UNITS * info.program_unit) <= BUFFER_SIZE);
882-
883886
/* setup byte pattern in buffer */
884887
static const uint32_t BYTE_PATTERN = 0xABCDEF00;
885888
if (info.program_unit >= sizeof(BYTE_PATTERN)) {

0 commit comments

Comments
 (0)