TESTS: convert compareandwrite to new api

Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
This commit is contained in:
Ronnie Sahlberg
2014-09-17 14:38:40 -07:00
committed by Ronnie Sahlberg
parent 44d88e3bc6
commit 46eaa7dcc3
6 changed files with 54 additions and 153 deletions

View File

@@ -69,9 +69,10 @@ test_compareandwrite_simple(void)
"BlockLimits.MaximumCompareAndWriteLength(%d). "
"Command should fail with INVALID_FIELD_IN_CDB",
i, maxbl);
ret = compareandwrite_invalidfieldincdb(iscsic, tgt_lun, 0,
buf, 2 * i * block_size, block_size,
0, 0, 0, 0);
ret = compareandwrite(iscsic, tgt_lun, 0,
buf, 2 * i * block_size,
block_size, 0, 0, 0, 0,
EXPECT_INVALID_FIELD_IN_CDB);
if (ret == -2) {
CU_PASS("[SKIPPED] Target does not support "
"COMPARE_AND_WRITE. Skipping test");
@@ -87,8 +88,9 @@ test_compareandwrite_simple(void)
logging(LOG_VERBOSE, "Overwrite %d blocks with 'B' "
"at LBA:0 (if they all contain 'A')", i);
ret = compareandwrite(iscsic, tgt_lun, 0,
buf, 2 * i * block_size, block_size,
0, 0, 0, 0);
buf, 2 * i * 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");
@@ -134,9 +136,10 @@ test_compareandwrite_simple(void)
"BlockLimits.MaximumCompareAndWriteLength(%d). "
"Command should fail with INVALID_FIELD_IN_CDB",
i, maxbl);
ret = compareandwrite_invalidfieldincdb(iscsic, tgt_lun, 0,
buf, 2 * i * block_size, block_size,
0, 0, 0, 0);
ret = compareandwrite(iscsic, tgt_lun, 0,
buf, 2 * i * block_size,
block_size, 0, 0, 0, 0,
EXPECT_INVALID_FIELD_IN_CDB);
CU_ASSERT_EQUAL(ret, 0);
continue;
@@ -147,7 +150,9 @@ test_compareandwrite_simple(void)
"at LBA:%" PRIu64 " (if they all contain 'A')",
i, num_blocks - i);
ret = compareandwrite(iscsic, tgt_lun, num_blocks - i,
buf, 2 * i * block_size, block_size, 0, 0, 0, 0);
buf, 2 * i * block_size, block_size,
0, 0, 0, 0,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Read %d blocks at LBA:%" PRIu64