test_multipathio_simple: Only compare if READ10 succeeded

Since the data in the read buffer is not valid if READ10() failed,
only compare the data in the read buffer if READ10() succeeded.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
This commit is contained in:
Bart Van Assche
2017-02-21 17:10:18 -08:00
committed by Ronnie Sahlberg
parent 0241fe8014
commit e5296920e9
2 changed files with 17 additions and 11 deletions

View File

@@ -34,6 +34,7 @@ test_multipathio_simple(void)
int write_path;
unsigned char *write_buf = alloca(256 * block_size);
unsigned char *read_buf = alloca(256 * block_size);
int ret;
CHECK_FOR_DATALOSS;
CHECK_FOR_SBC;
@@ -58,16 +59,19 @@ test_multipathio_simple(void)
&& maximum_transfer_length < i) {
break;
}
WRITE10(mp_sds[write_path], 0, i * block_size,
ret = WRITE10(mp_sds[write_path], 0, i * block_size,
block_size, 0, 0, 0, 0, 0, write_buf,
EXPECT_STATUS_GOOD);
READ10(mp_sds[read_path], NULL, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, read_buf,
EXPECT_STATUS_GOOD);
if (ret < 0)
continue;
ret = READ10(mp_sds[read_path], NULL, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, read_buf,
EXPECT_STATUS_GOOD);
if (ret < 0)
continue;
/* compare written and read data */
CU_ASSERT_EQUAL(0,
memcmp(write_buf, read_buf, i * block_size));
ret = memcmp(write_buf, read_buf, i * block_size);
CU_ASSERT_EQUAL(0, ret);
}
}