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,8 +30,6 @@
void
test_write16_flags(void)
{
unsigned char *buf = alloca(block_size);
CHECK_FOR_DATALOSS;
CHECK_FOR_SBC;
@@ -39,23 +37,23 @@ test_write16_flags(void)
logging(LOG_VERBOSE, "Test WRITE16 flags");
logging(LOG_VERBOSE, "Test WRITE16 with DPO==1");
memset(buf, 0xa6, block_size);
WRITE16(sd, 0, block_size, block_size, 0, 1, 0, 0, 0, buf,
memset(scratch, 0xa6, block_size);
WRITE16(sd, 0, block_size, block_size, 0, 1, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD);
logging(LOG_VERBOSE, "Test WRITE16 with FUA==1 FUA_NV==0");
WRITE16(sd, 0, block_size, block_size, 0, 0, 1, 0, 0, buf,
WRITE16(sd, 0, block_size, block_size, 0, 0, 1, 0, 0, scratch,
EXPECT_STATUS_GOOD);
logging(LOG_VERBOSE, "Test WRITE16 with FUA==1 FUA_NV==1");
WRITE16(sd, 0, block_size, block_size, 0, 0, 1, 1, 0, buf,
WRITE16(sd, 0, block_size, block_size, 0, 0, 1, 1, 0, scratch,
EXPECT_STATUS_GOOD);
logging(LOG_VERBOSE, "Test WRITE16 with FUA==0 FUA_NV==1");
WRITE16(sd, 0, block_size, block_size, 0, 0, 0, 1, 0, buf,
WRITE16(sd, 0, block_size, block_size, 0, 0, 0, 1, 0, scratch,
EXPECT_STATUS_GOOD);
logging(LOG_VERBOSE, "Test WRITE16 with DPO==1 FUA==1 FUA_NV==1");
WRITE16(sd, 0, block_size, block_size, 0, 1, 1, 1, 0, buf,
WRITE16(sd, 0, block_size, block_size, 0, 1, 1, 1, 0, scratch,
EXPECT_STATUS_GOOD);
}