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
+2 -3
View File
@@ -32,7 +32,6 @@ test_modesense6_control_swp(void)
struct scsi_task *ms_task = NULL;
struct scsi_mode_sense *ms;
struct scsi_mode_page *page;
unsigned char *buf = alloca(block_size);
int ret;
CHECK_FOR_DATALOSS;
@@ -90,13 +89,13 @@ test_modesense6_control_swp(void)
logging(LOG_VERBOSE, "Read a block from the now Read-Only device");
ret = read10(sd, NULL, 0, block_size,
block_size, 0, 0, 0, 0, 0, buf,
block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Try to write a block to the Read-Only device");
ret = write10(sd, 0, block_size,
block_size, 0, 0, 0, 0, 0, buf,
block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_WRITE_PROTECTED);
CU_ASSERT_EQUAL(ret, 0);