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:
@@ -320,7 +320,7 @@ do { \
|
||||
} while (0);
|
||||
|
||||
#define READ10(...) \
|
||||
do { \
|
||||
({ \
|
||||
int _r; \
|
||||
_r = read10(__VA_ARGS__); \
|
||||
if (_r == -2) { \
|
||||
@@ -331,7 +331,8 @@ do { \
|
||||
return; \
|
||||
} \
|
||||
CU_ASSERT_EQUAL(_r, 0); \
|
||||
} while (0);
|
||||
_r; \
|
||||
})
|
||||
|
||||
#define READ12(...) \
|
||||
do { \
|
||||
@@ -602,7 +603,7 @@ do { \
|
||||
} while (0);
|
||||
|
||||
#define WRITE10(...) \
|
||||
do { \
|
||||
({ \
|
||||
int _r; \
|
||||
_r = write10(__VA_ARGS__); \
|
||||
if (_r == -2) { \
|
||||
@@ -613,7 +614,8 @@ do { \
|
||||
return; \
|
||||
} \
|
||||
CU_ASSERT_EQUAL(_r, 0); \
|
||||
} while (0);
|
||||
_r; \
|
||||
})
|
||||
|
||||
#define WRITE12(...) \
|
||||
do { \
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user