Tests: Create helper macro for COMPAREANDWRITE

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
Ronnie Sahlberg
2016-02-21 08:04:36 -08:00
parent f88bcf61cc
commit f699503f8c
5 changed files with 72 additions and 108 deletions

View File

@@ -78,27 +78,19 @@ test_multipathio_compareandwrite(void)
/* write data is the second half, wrap around */
memset(scratch + io_bl * block_size, path + 1,
io_bl * block_size);
ret = compareandwrite(mp_sds[path], i,
scratch, 2 * io_bl * block_size,
block_size, 0, 0, 0, 0,
EXPECT_STATUS_GOOD);
if (ret == -2) {
CU_PASS("[SKIPPED] Target does not support "
"COMPARE_AND_WRITE. Skipping test");
return;
}
CU_ASSERT_EQUAL(ret, 0);
COMPAREANDWRITE(mp_sds[path], i,
scratch, 2 * io_bl * block_size,
block_size, 0, 0, 0, 0,
EXPECT_STATUS_GOOD);
logging(LOG_VERBOSE,
"Test bad COMPARE_AND_WRITE(%d->%d)",
path, path + 1);
ret = compareandwrite(mp_sds[path], i,
scratch, 2 * io_bl * block_size,
block_size, 0, 0, 0, 0,
EXPECT_MISCOMPARE);
CU_ASSERT_EQUAL(ret, 0);
COMPAREANDWRITE(mp_sds[path], i,
scratch, 2 * io_bl * block_size,
block_size, 0, 0, 0, 0,
EXPECT_MISCOMPARE);
}
}
}