TESTS: *protect field set to non-zero are only guaranteed to fail if the device does not support protection information

This commit is contained in:
Ronnie Sahlberg
2013-05-11 17:27:35 -07:00
parent 5135836ee5
commit 67676d4756
15 changed files with 220 additions and 149 deletions

View File

@@ -40,17 +40,22 @@ test_writesame10_wrprotect(void)
*/
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITESAME10 with non-zero WRPROTECT");
buf = malloc(block_size);
for (i = 1; i < 8; i++) {
ret = writesame10_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, 1,
0, 0, i, 0, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] WRITESAME10 is not implemented.");
CU_PASS("WRITESAME10 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
buf = malloc(block_size);
for (i = 1; i < 8; i++) {
ret = writesame10_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, 1,
0, 0, i, 0, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] WRITESAME10 is not implemented.");
CU_PASS("WRITESAME10 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
}
free(buf);
}
free(buf);
}