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,7 +30,6 @@ void
test_writesame10_unmap_unaligned(void)
{
int i, ret;
unsigned char *buf = alloca(block_size);
CHECK_FOR_DATALOSS;
CHECK_FOR_THIN_PROVISIONING;
@@ -40,11 +39,11 @@ test_writesame10_unmap_unaligned(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test that unaligned WRITESAME10 Unmap succeeds. LBPPB==%d", lbppb);
memset(buf, 0xa6, block_size);
memset(scratch, 0xa6, block_size);
for (i = 1; i < lbppb; i++) {
logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME10 at LBA:%d", lbppb - i, i);
ret = writesame10(sd, i,
block_size, lbppb - i, 0, 1, 0, 0, buf,
block_size, lbppb - i, 0, 1, 0, 0, scratch,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
}