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:
@@ -59,7 +59,6 @@ static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu
|
||||
void test_iscsi_datasn_invalid(void)
|
||||
{
|
||||
int ret;
|
||||
unsigned char *buf = alloca(2 * block_size);
|
||||
|
||||
CHECK_FOR_DATALOSS;
|
||||
|
||||
@@ -83,10 +82,10 @@ void test_iscsi_datasn_invalid(void)
|
||||
iscsi_set_noautoreconnect(sd->iscsi_ctx, 1);
|
||||
iscsi_set_timeout(sd->iscsi_ctx, 3);
|
||||
|
||||
memset(buf, 0xa6, 2 * block_size);
|
||||
memset(scratch, 0xa6, 2 * block_size);
|
||||
|
||||
ret = write10(sd, 100, 2 * block_size,
|
||||
block_size, 0, 0, 0, 0, 0, buf,
|
||||
block_size, 0, 0, 0, 0, 0, scratch,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
||||
@@ -109,7 +108,7 @@ void test_iscsi_datasn_invalid(void)
|
||||
iscsi_set_timeout(sd->iscsi_ctx, 3);
|
||||
|
||||
ret = write10(sd, 100, block_size,
|
||||
block_size, 0, 0, 0, 0, 0, buf,
|
||||
block_size, 0, 0, 0, 0, 0, scratch,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
||||
@@ -132,7 +131,7 @@ void test_iscsi_datasn_invalid(void)
|
||||
iscsi_set_timeout(sd->iscsi_ctx, 3);
|
||||
|
||||
ret = write10(sd, 100, block_size,
|
||||
block_size, 0, 0, 0, 0, 0, buf,
|
||||
block_size, 0, 0, 0, 0, 0, scratch,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
||||
@@ -156,7 +155,7 @@ void test_iscsi_datasn_invalid(void)
|
||||
iscsi_set_timeout(sd->iscsi_ctx, 3);
|
||||
|
||||
ret = write10(sd, 100, 2 * block_size,
|
||||
block_size, 0, 0, 0, 0, 0, buf,
|
||||
block_size, 0, 0, 0, 0, 0, scratch,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
||||
|
||||
Reference in New Issue
Block a user