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

@@ -31,7 +31,6 @@ void
test_writesame16_unmap_vpd(void)
{
int ret;
unsigned char *buf = alloca(block_size);
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITESAME16 UNMAP availability is "
@@ -43,9 +42,8 @@ test_writesame16_unmap_vpd(void)
logging(LOG_VERBOSE, "Check if WRITESAME16 can be used for UNMAP.");
logging(LOG_VERBOSE, "Unmap 1 block using WRITESAME16");
memset(buf, 0, block_size);
ret = writesame16(sd, 0,
block_size, 1, 0, 1, 0, 0, buf,
memset(scratch, 0, block_size);
ret = writesame16(sd, 0, block_size, 1, 0, 1, 0, 0, scratch,
EXPECT_STATUS_GOOD);
if (ret != 0) {
logging(LOG_VERBOSE, "WRITESAME16 UNMAP is not available. "