Tests: Create a global scratch buffer and avoid allocating memory in the tests

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
Ronnie Sahlberg
2016-02-21 07:56:47 -08:00
parent b4e4649ae5
commit f88bcf61cc
89 changed files with 454 additions and 545 deletions

View File

@@ -30,20 +30,19 @@ void
test_writeverify16_beyond_eol(void)
{
int i;
unsigned char *buf = alloca(256 * block_size);
CHECK_FOR_DATALOSS;
CHECK_FOR_SBC;
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITEVERIFY16 1-256 blocks one block beyond the end");
memset(buf, 0xa6, 256 * block_size);
memset(scratch, 0xa6, 256 * block_size);
for (i = 1; i <= 256; i++) {
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
WRITEVERIFY16(sd, num_blocks + 1 - i,
i * block_size, block_size, 0, 0, 0, 0, buf,
i * block_size, block_size, 0, 0, 0, 0, scratch,
EXPECT_LBA_OOB);
}
@@ -53,7 +52,7 @@ test_writeverify16_beyond_eol(void)
break;
}
WRITEVERIFY16(sd, 0x8000000000000000ULL,
i * block_size, block_size, 0, 0, 0, 0, buf,
i * block_size, block_size, 0, 0, 0, 0, scratch,
EXPECT_LBA_OOB);
}
@@ -63,7 +62,7 @@ test_writeverify16_beyond_eol(void)
break;
}
WRITEVERIFY16(sd, -1,
i * block_size, block_size, 0, 0, 0, 0, buf,
i * block_size, block_size, 0, 0, 0, 0, scratch,
EXPECT_LBA_OOB);
}
@@ -73,7 +72,7 @@ test_writeverify16_beyond_eol(void)
break;
}
WRITEVERIFY16(sd, num_blocks - 1,
i * block_size, block_size, 0, 0, 0, 0, buf,
i * block_size, block_size, 0, 0, 0, 0, scratch,
EXPECT_LBA_OOB);
}
}