Tests: add helper macro for REPORT_SUPPORTED_OPCODES
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
@@ -195,6 +195,21 @@ do { \
|
||||
CU_ASSERT_EQUAL(_r, 0); \
|
||||
} while (0);
|
||||
|
||||
#define REPORT_SUPPORTED_OPCODES(...) \
|
||||
do { \
|
||||
int _r; \
|
||||
_r = report_supported_opcodes(__VA_ARGS__); \
|
||||
if (_r == -2) { \
|
||||
logging(LOG_NORMAL, "[SKIPPED] REPORT_SUPPORTED" \
|
||||
"_OPCODES is not implemented."); \
|
||||
CU_PASS("[SKIPPED] Target does not support " \
|
||||
"REPORT_SUPPORTED_OPCODES. Skipping " \
|
||||
"test"); \
|
||||
return; \
|
||||
} \
|
||||
CU_ASSERT_EQUAL(_r, 0); \
|
||||
} while (0);
|
||||
|
||||
#define VERIFY10(...) \
|
||||
do { \
|
||||
int _r; \
|
||||
|
||||
@@ -104,45 +104,34 @@ test_compareandwrite_dpofua(void)
|
||||
|
||||
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
|
||||
"for COMPAREANDWRITE");
|
||||
ret = report_supported_opcodes(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_COMPARE_AND_WRITE,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
|
||||
"Skipping this part of the test");
|
||||
goto out;
|
||||
}
|
||||
REPORT_SUPPORTED_OPCODES(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_COMPARE_AND_WRITE,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||
rsoc = scsi_datain_unmarshall(rso_task);
|
||||
if (rsoc) {
|
||||
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
|
||||
if (dpofua) {
|
||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
|
||||
"DPO/FUA flags are set in the CDB_USAGE_DATA");
|
||||
if (!usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not set "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
|
||||
}
|
||||
} else {
|
||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
|
||||
"DPO/FUA flags are clear in the CDB_USAGE_DATA");
|
||||
if (usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logging(LOG_NORMAL, "[FAILED] Target did not return any data "
|
||||
"for ReportSupportedOpcodes\n");
|
||||
CU_FAIL("Target did not return any data for "
|
||||
"ReportSupportedOpcodes");
|
||||
}
|
||||
CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
|
||||
|
||||
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
|
||||
if (dpofua) {
|
||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
|
||||
"DPO/FUA flags are set in the CDB_USAGE_DATA");
|
||||
if (!usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not set "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
|
||||
}
|
||||
} else {
|
||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
|
||||
"DPO/FUA flags are clear in the CDB_USAGE_DATA");
|
||||
if (usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE");
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
scsi_free_scsi_task(rso_task);
|
||||
}
|
||||
|
||||
@@ -111,45 +111,34 @@ test_orwrite_dpofua(void)
|
||||
|
||||
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
|
||||
"for ORWRITE");
|
||||
ret = report_supported_opcodes(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_ORWRITE,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
|
||||
"Skipping this part of the test");
|
||||
goto out;
|
||||
}
|
||||
REPORT_SUPPORTED_OPCODES(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_ORWRITE,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||
rsoc = scsi_datain_unmarshall(rso_task);
|
||||
if (rsoc) {
|
||||
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
|
||||
if (dpofua) {
|
||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
|
||||
"DPO/FUA flags are set in the CDB_USAGE_DATA");
|
||||
if (!usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not set "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
|
||||
}
|
||||
} else {
|
||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
|
||||
"DPO/FUA flags are clear in the CDB_USAGE_DATA");
|
||||
if (usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logging(LOG_NORMAL, "[FAILED] Target did not return any data "
|
||||
"for ReportSupportedOpcodes\n");
|
||||
CU_FAIL("Target did not return any data for "
|
||||
"ReportSupportedOpcodes");
|
||||
}
|
||||
CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
|
||||
|
||||
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
|
||||
if (dpofua) {
|
||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
|
||||
"DPO/FUA flags are set in the CDB_USAGE_DATA");
|
||||
if (!usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not set "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
|
||||
}
|
||||
} else {
|
||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
|
||||
"DPO/FUA flags are clear in the CDB_USAGE_DATA");
|
||||
if (usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE");
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
scsi_free_scsi_task(rso_task);
|
||||
}
|
||||
|
||||
@@ -100,45 +100,34 @@ test_read10_dpofua(void)
|
||||
|
||||
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
|
||||
"for READ10");
|
||||
ret = report_supported_opcodes(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_READ10,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
|
||||
"Skipping this part of the test");
|
||||
goto out;
|
||||
}
|
||||
REPORT_SUPPORTED_OPCODES(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_READ10,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||
rsoc = scsi_datain_unmarshall(rso_task);
|
||||
if (rsoc) {
|
||||
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
|
||||
if (dpofua) {
|
||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
|
||||
"DPO/FUA flags are set in the CDB_USAGE_DATA");
|
||||
if (!usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not set "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
|
||||
}
|
||||
} else {
|
||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
|
||||
"DPO/FUA flags are clear in the CDB_USAGE_DATA");
|
||||
if (usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logging(LOG_NORMAL, "[FAILED] Target did not return any data "
|
||||
"for ReportSupportedOpcodes\n");
|
||||
CU_FAIL("Target did not return any data for "
|
||||
"ReportSupportedOpcodes");
|
||||
}
|
||||
CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
|
||||
|
||||
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
|
||||
if (dpofua) {
|
||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
|
||||
"DPO/FUA flags are set in the CDB_USAGE_DATA");
|
||||
if (!usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not set "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
|
||||
}
|
||||
} else {
|
||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
|
||||
"DPO/FUA flags are clear in the CDB_USAGE_DATA");
|
||||
if (usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE");
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
scsi_free_scsi_task(rso_task);
|
||||
}
|
||||
|
||||
@@ -99,45 +99,34 @@ test_read12_dpofua(void)
|
||||
|
||||
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
|
||||
"for READ12");
|
||||
ret = report_supported_opcodes(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_READ12,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
|
||||
"Skipping this part of the test");
|
||||
goto out;
|
||||
}
|
||||
REPORT_SUPPORTED_OPCODES(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_READ12,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||
rsoc = scsi_datain_unmarshall(rso_task);
|
||||
if (rsoc) {
|
||||
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
|
||||
if (dpofua) {
|
||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
|
||||
"DPO/FUA flags are set in the CDB_USAGE_DATA");
|
||||
if (!usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not set "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
|
||||
}
|
||||
} else {
|
||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
|
||||
"DPO/FUA flags are clear in the CDB_USAGE_DATA");
|
||||
if (usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logging(LOG_NORMAL, "[FAILED] Target did not return any data "
|
||||
"for ReportSupportedOpcodes\n");
|
||||
CU_FAIL("Target did not return any data for "
|
||||
"ReportSupportedOpcodes");
|
||||
}
|
||||
CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
|
||||
|
||||
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
|
||||
if (dpofua) {
|
||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
|
||||
"DPO/FUA flags are set in the CDB_USAGE_DATA");
|
||||
if (!usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not set "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
|
||||
}
|
||||
} else {
|
||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
|
||||
"DPO/FUA flags are clear in the CDB_USAGE_DATA");
|
||||
if (usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE");
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
scsi_free_scsi_task(rso_task);
|
||||
}
|
||||
|
||||
@@ -100,45 +100,34 @@ test_read16_dpofua(void)
|
||||
|
||||
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
|
||||
"for READ16");
|
||||
ret = report_supported_opcodes(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_READ16,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
|
||||
"Skipping this part of the test");
|
||||
goto out;
|
||||
}
|
||||
REPORT_SUPPORTED_OPCODES(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_READ16,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||
rsoc = scsi_datain_unmarshall(rso_task);
|
||||
if (rsoc) {
|
||||
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
|
||||
if (dpofua) {
|
||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
|
||||
"DPO/FUA flags are set in the CDB_USAGE_DATA");
|
||||
if (!usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not set "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
|
||||
}
|
||||
} else {
|
||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
|
||||
"DPO/FUA flags are clear in the CDB_USAGE_DATA");
|
||||
if (usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logging(LOG_NORMAL, "[FAILED] Target did not return any data "
|
||||
"for ReportSupportedOpcodes\n");
|
||||
CU_FAIL("Target did not return any data for "
|
||||
"ReportSupportedOpcodes");
|
||||
}
|
||||
CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
|
||||
|
||||
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
|
||||
if (dpofua) {
|
||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
|
||||
"DPO/FUA flags are set in the CDB_USAGE_DATA");
|
||||
if (!usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not set "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
|
||||
}
|
||||
} else {
|
||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
|
||||
"DPO/FUA flags are clear in the CDB_USAGE_DATA");
|
||||
if (usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE");
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
scsi_free_scsi_task(rso_task);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
void
|
||||
test_report_supported_opcodes_one_command(void)
|
||||
{
|
||||
int i, ret;
|
||||
int i;
|
||||
struct scsi_task *rso_task;
|
||||
struct scsi_task *one_task;
|
||||
struct scsi_report_supported_op_codes *rsoc;
|
||||
@@ -38,32 +38,15 @@ test_report_supported_opcodes_one_command(void)
|
||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||
logging(LOG_VERBOSE, "Test READ_SUPPORTED_OPCODES reading one-command");
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Fetch list of all supported opcodes");
|
||||
ret = report_supported_opcodes(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPS_ALL,
|
||||
0, 0, 65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] READ_SUPPORTED_OPCODES is not "
|
||||
"implemented.");
|
||||
CU_PASS("READ_SUPPORTED_OPCODES is not implemented.");
|
||||
goto out;
|
||||
}
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
if (ret != 0)
|
||||
goto out;
|
||||
REPORT_SUPPORTED_OPCODES(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPS_ALL,
|
||||
0, 0, 65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
|
||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||
rsoc = scsi_datain_unmarshall(rso_task);
|
||||
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
||||
if (!rsoc) {
|
||||
logging(LOG_NORMAL, "[FAILED] Target did not return any data "
|
||||
"for ReportSupportedOpcodes\n");
|
||||
CU_FAIL("Target did not return any data for "
|
||||
"ReportSupportedOpcodes");
|
||||
goto out;
|
||||
}
|
||||
CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
|
||||
|
||||
logging(LOG_VERBOSE, "Verify read one-command works for all supported "
|
||||
"opcodes");
|
||||
@@ -74,86 +57,43 @@ test_report_supported_opcodes_one_command(void)
|
||||
if (rsoc->descriptors[i].servactv) {
|
||||
logging(LOG_VERBOSE, "This opcode has service actions. "
|
||||
"Reporting Options 001b should fail");
|
||||
ret = report_supported_opcodes(sd, NULL,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
rsoc->descriptors[i].opcode,
|
||||
rsoc->descriptors[i].sa,
|
||||
65535,
|
||||
EXPECT_INVALID_FIELD_IN_CDB);
|
||||
REPORT_SUPPORTED_OPCODES(sd, NULL, 0,
|
||||
SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
rsoc->descriptors[i].opcode,
|
||||
rsoc->descriptors[i].sa,
|
||||
65535,
|
||||
EXPECT_INVALID_FIELD_IN_CDB);
|
||||
} else {
|
||||
logging(LOG_VERBOSE, "This opcode does not have "
|
||||
"service actions. Reporting Options 001b "
|
||||
"should work");
|
||||
ret = report_supported_opcodes(
|
||||
sd, NULL,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
rsoc->descriptors[i].opcode,
|
||||
rsoc->descriptors[i].sa,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
}
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] SCSI_REPORT_SUPPORTING_OPCODE is not "
|
||||
"implemented.");
|
||||
CU_PASS("SCSI_REPORT_SUPPORTING_OPCODE is not implemented.");
|
||||
} else {
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
if (ret != 0 && ret != -2) {
|
||||
if (rsoc->descriptors[i].servactv)
|
||||
logging(LOG_NORMAL, "[FAILED] Opcode"
|
||||
" %#02x/%#02x: got unexpected response"
|
||||
" for reporting option 001b",
|
||||
rsoc->descriptors[i].opcode,
|
||||
rsoc->descriptors[i].sa);
|
||||
else
|
||||
logging(LOG_NORMAL, "[FAILED] Opcode %#02x: got"
|
||||
" unexpected response for reporting"
|
||||
" option 001b",
|
||||
rsoc->descriptors[i].opcode);
|
||||
REPORT_SUPPORTED_OPCODES(sd, NULL, 0,
|
||||
SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
rsoc->descriptors[i].opcode,
|
||||
rsoc->descriptors[i].sa,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
}
|
||||
|
||||
if (rsoc->descriptors[i].servactv) {
|
||||
logging(LOG_VERBOSE, "This opcode has service actions. "
|
||||
"Reporting Options 002b should work");
|
||||
ret = report_supported_opcodes(
|
||||
sd, NULL,
|
||||
0, SCSI_REPORT_SUPPORTING_SERVICEACTION,
|
||||
rsoc->descriptors[i].opcode,
|
||||
rsoc->descriptors[i].sa,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
REPORT_SUPPORTED_OPCODES(sd, NULL, 0,
|
||||
SCSI_REPORT_SUPPORTING_SERVICEACTION,
|
||||
rsoc->descriptors[i].opcode,
|
||||
rsoc->descriptors[i].sa,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
} else {
|
||||
logging(LOG_VERBOSE, "This opcode does not have "
|
||||
"service actions. Reporting Options 002b "
|
||||
"should fail");
|
||||
ret = report_supported_opcodes(
|
||||
sd, NULL,
|
||||
0, SCSI_REPORT_SUPPORTING_SERVICEACTION,
|
||||
rsoc->descriptors[i].opcode,
|
||||
rsoc->descriptors[i].sa,
|
||||
65535,
|
||||
EXPECT_INVALID_FIELD_IN_CDB);
|
||||
}
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] SCSI_REPORT_SUPPORTING_SERVICEACTION is not "
|
||||
"implemented.");
|
||||
CU_PASS("SCSI_REPORT_SUPPORTING_SERVICEACTION is not implemented.");
|
||||
} else {
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
if (ret != 0 && ret != -2) {
|
||||
if (rsoc->descriptors[i].servactv)
|
||||
logging(LOG_NORMAL, "[FAILED] Opcode"
|
||||
" %#02x/%#02x: got unexpected response"
|
||||
" for reporting option 002b",
|
||||
rsoc->descriptors[i].opcode,
|
||||
rsoc->descriptors[i].sa);
|
||||
else
|
||||
logging(LOG_NORMAL, "[FAILED] Opcode %#02x: got"
|
||||
" unexpected response for reporting"
|
||||
" option 002b",
|
||||
rsoc->descriptors[i].opcode);
|
||||
REPORT_SUPPORTED_OPCODES(sd, NULL, 0,
|
||||
SCSI_REPORT_SUPPORTING_SERVICEACTION,
|
||||
rsoc->descriptors[i].opcode,
|
||||
rsoc->descriptors[i].sa,
|
||||
65535,
|
||||
EXPECT_INVALID_FIELD_IN_CDB);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,19 +104,18 @@ test_report_supported_opcodes_one_command(void)
|
||||
"ServiceAction:0x%02x",
|
||||
rsoc->descriptors[i].opcode,
|
||||
rsoc->descriptors[i].sa);
|
||||
ret = report_supported_opcodes(
|
||||
sd, &one_task, 0,
|
||||
rsoc->descriptors[i].servactv ?
|
||||
SCSI_REPORT_SUPPORTING_SERVICEACTION :
|
||||
SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
rsoc->descriptors[i].opcode,
|
||||
rsoc->descriptors[i].sa,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
REPORT_SUPPORTED_OPCODES(sd, &one_task, 0,
|
||||
rsoc->descriptors[i].servactv ?
|
||||
SCSI_REPORT_SUPPORTING_SERVICEACTION :
|
||||
SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
rsoc->descriptors[i].opcode,
|
||||
rsoc->descriptors[i].sa,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
|
||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||
rsoc_one = scsi_datain_unmarshall(one_task);
|
||||
CU_ASSERT_NOT_EQUAL(rsoc_one, NULL);
|
||||
CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc_one);
|
||||
|
||||
logging(LOG_VERBOSE, "Verify CDB length is not 0");
|
||||
CU_ASSERT_NOT_EQUAL(rsoc_one->cdb_length, 0);
|
||||
@@ -198,6 +137,5 @@ test_report_supported_opcodes_one_command(void)
|
||||
scsi_free_scsi_task(one_task);
|
||||
}
|
||||
|
||||
out:
|
||||
scsi_free_scsi_task(rso_task);
|
||||
}
|
||||
|
||||
@@ -29,41 +29,23 @@
|
||||
void
|
||||
test_report_supported_opcodes_rctd(void)
|
||||
{
|
||||
int i, ret;
|
||||
int i;
|
||||
struct scsi_task *rso_task;
|
||||
struct scsi_report_supported_op_codes *rsoc;
|
||||
|
||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||
logging(LOG_VERBOSE, "Test READ_SUPPORTED_OPCODES RCTD flag");
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Test READ_SUPPORTED_OPCODES report ALL opcodes "
|
||||
"without timeout descriptors. RCTD==0");
|
||||
ret = report_supported_opcodes(
|
||||
sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] READ_SUPPORTED_OPCODES is not "
|
||||
"implemented.");
|
||||
CU_PASS("READ_SUPPORTED_OPCODES is not implemented.");
|
||||
goto out;
|
||||
}
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
if (ret != 0)
|
||||
goto out;
|
||||
REPORT_SUPPORTED_OPCODES(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
|
||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||
rsoc = scsi_datain_unmarshall(rso_task);
|
||||
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
||||
if (!rsoc) {
|
||||
logging(LOG_NORMAL, "[FAILED] Target did not return any data "
|
||||
"for ReportSupportedOpcodes\n");
|
||||
CU_FAIL("Target did not return any data for "
|
||||
"ReportSupportedOpcodes");
|
||||
goto out;
|
||||
}
|
||||
CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
|
||||
|
||||
logging(LOG_VERBOSE, "Verify that all returned command descriptors "
|
||||
"lack timeout description");
|
||||
@@ -75,20 +57,15 @@ test_report_supported_opcodes_rctd(void)
|
||||
"CTDP set");
|
||||
}
|
||||
}
|
||||
|
||||
scsi_free_scsi_task(rso_task);
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Test READ_SUPPORTED_OPCODES report ALL opcodes "
|
||||
"with timeout descriptors. RCTD==1");
|
||||
ret = report_supported_opcodes(
|
||||
sd, &rso_task,
|
||||
1, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
if (ret != 0)
|
||||
goto out;
|
||||
REPORT_SUPPORTED_OPCODES(sd, &rso_task,
|
||||
1, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
|
||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||
rsoc = scsi_datain_unmarshall(rso_task);
|
||||
@@ -117,6 +94,5 @@ test_report_supported_opcodes_rctd(void)
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
scsi_free_scsi_task(rso_task);
|
||||
}
|
||||
|
||||
@@ -29,40 +29,21 @@
|
||||
void
|
||||
test_report_supported_opcodes_servactv(void)
|
||||
{
|
||||
int i, ret;
|
||||
int i;
|
||||
struct scsi_task *rso_task;
|
||||
struct scsi_report_supported_op_codes *rsoc;
|
||||
|
||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||
logging(LOG_VERBOSE, "Test READ_SUPPORTED_OPCODES SERVACTV flag");
|
||||
|
||||
REPORT_SUPPORTED_OPCODES(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
|
||||
ret = report_supported_opcodes(
|
||||
sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] READ_SUPPORTED_OPCODES is not "
|
||||
"implemented.");
|
||||
CU_PASS("READ_SUPPORTED_OPCODES is not implemented.");
|
||||
goto out;
|
||||
}
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
if (ret != 0)
|
||||
goto out;
|
||||
|
||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||
rsoc = scsi_datain_unmarshall(rso_task);
|
||||
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
||||
if (!rsoc) {
|
||||
logging(LOG_NORMAL, "[FAILED] Target did not return any data "
|
||||
"for ReportSupportedOpcodes\n");
|
||||
CU_FAIL("Target did not return any data for "
|
||||
"ReportSupportedOpcodes");
|
||||
goto out;
|
||||
}
|
||||
|
||||
CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
|
||||
|
||||
logging(LOG_VERBOSE, "Verify that when SERVACTV is clear then "
|
||||
"ServiceAction must be zero.");
|
||||
@@ -75,6 +56,5 @@ test_report_supported_opcodes_servactv(void)
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
scsi_free_scsi_task(rso_task);
|
||||
}
|
||||
|
||||
@@ -29,21 +29,11 @@
|
||||
void
|
||||
test_report_supported_opcodes_simple(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||
logging(LOG_VERBOSE, "Test basic READ_SUPPORTED_OPCODES");
|
||||
|
||||
ret = report_supported_opcodes(
|
||||
sd, NULL,
|
||||
0, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0,
|
||||
1024,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] READ_SUPPORTED_OPCODES is not "
|
||||
"implemented.");
|
||||
CU_PASS("READ_SUPPORTED_OPCODES is not implemented.");
|
||||
return;
|
||||
}
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
REPORT_SUPPORTED_OPCODES(sd, NULL,
|
||||
0, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0,
|
||||
1024,
|
||||
EXPECT_STATUS_GOOD);
|
||||
}
|
||||
|
||||
@@ -74,20 +74,15 @@ test_verify10_dpo(void)
|
||||
|
||||
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
|
||||
"for VERIFY10");
|
||||
ret = report_supported_opcodes(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_VERIFY10,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
|
||||
"Skipping this part of the test");
|
||||
goto out;
|
||||
}
|
||||
REPORT_SUPPORTED_OPCODES(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_VERIFY10,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||
rsoc = scsi_datain_unmarshall(rso_task);
|
||||
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
||||
CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
|
||||
usage_data_dpo = rsoc ? rsoc->cdb_usage_data[1] & 0x10 : -1;
|
||||
if (dpofua) {
|
||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO flag "
|
||||
@@ -99,6 +94,5 @@ test_verify10_dpo(void)
|
||||
CU_ASSERT_EQUAL(usage_data_dpo, 0x00);
|
||||
}
|
||||
|
||||
out:
|
||||
scsi_free_scsi_task(rso_task);
|
||||
}
|
||||
|
||||
@@ -74,20 +74,15 @@ test_verify12_dpo(void)
|
||||
|
||||
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
|
||||
"for VERIFY12");
|
||||
ret = report_supported_opcodes(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_VERIFY12,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
|
||||
"Skipping this part of the test");
|
||||
goto out;
|
||||
}
|
||||
REPORT_SUPPORTED_OPCODES(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_VERIFY12,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||
rsoc = scsi_datain_unmarshall(rso_task);
|
||||
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
||||
CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
|
||||
usage_data_dpo = rsoc ? rsoc->cdb_usage_data[1] & 0x10 : -1;
|
||||
if (dpofua) {
|
||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO flag "
|
||||
@@ -99,6 +94,5 @@ test_verify12_dpo(void)
|
||||
CU_ASSERT_EQUAL(usage_data_dpo, 0x00);
|
||||
}
|
||||
|
||||
out:
|
||||
scsi_free_scsi_task(rso_task);
|
||||
}
|
||||
|
||||
@@ -74,20 +74,16 @@ test_verify16_dpo(void)
|
||||
|
||||
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
|
||||
"for VERIFY16");
|
||||
ret = report_supported_opcodes(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_VERIFY16,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
|
||||
"Skipping this part of the test");
|
||||
goto out;
|
||||
}
|
||||
REPORT_SUPPORTED_OPCODES(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_VERIFY16,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||
rsoc = scsi_datain_unmarshall(rso_task);
|
||||
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
||||
CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
|
||||
|
||||
usage_data_dpo = rsoc ? rsoc->cdb_usage_data[1] & 0x10 : -1;
|
||||
if (dpofua) {
|
||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO flag "
|
||||
@@ -99,6 +95,5 @@ test_verify16_dpo(void)
|
||||
CU_ASSERT_EQUAL(usage_data_dpo, 0x00);
|
||||
}
|
||||
|
||||
out:
|
||||
scsi_free_scsi_task(rso_task);
|
||||
}
|
||||
|
||||
@@ -91,45 +91,35 @@ test_write10_dpofua(void)
|
||||
|
||||
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
|
||||
"for WRITE10");
|
||||
ret = report_supported_opcodes(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_WRITE10,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
|
||||
"Skipping this part of the test");
|
||||
goto out;
|
||||
}
|
||||
REPORT_SUPPORTED_OPCODES(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_WRITE10,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
|
||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||
rsoc = scsi_datain_unmarshall(rso_task);
|
||||
if (rsoc) {
|
||||
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
|
||||
if (dpofua) {
|
||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
|
||||
"DPO/FUA flags are set in the CDB_USAGE_DATA");
|
||||
if (!usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not set "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
|
||||
}
|
||||
} else {
|
||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
|
||||
"DPO/FUA flags are clear in the CDB_USAGE_DATA");
|
||||
if (usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logging(LOG_NORMAL, "[FAILED] Target did not return any data "
|
||||
"for ReportSupportedOpcodes\n");
|
||||
CU_FAIL("Target did not return any data for "
|
||||
"ReportSupportedOpcodes");
|
||||
}
|
||||
CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
|
||||
|
||||
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
|
||||
if (dpofua) {
|
||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
|
||||
"DPO/FUA flags are set in the CDB_USAGE_DATA");
|
||||
if (!usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not set "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
|
||||
}
|
||||
} else {
|
||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
|
||||
"DPO/FUA flags are clear in the CDB_USAGE_DATA");
|
||||
if (usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE");
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
scsi_free_scsi_task(rso_task);
|
||||
}
|
||||
|
||||
@@ -90,45 +90,35 @@ test_write12_dpofua(void)
|
||||
|
||||
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
|
||||
"for WRITE12");
|
||||
ret = report_supported_opcodes(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_WRITE12,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
|
||||
"Skipping this part of the test");
|
||||
goto out;
|
||||
}
|
||||
REPORT_SUPPORTED_OPCODES(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_WRITE12,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
|
||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||
rsoc = scsi_datain_unmarshall(rso_task);
|
||||
if (rsoc) {
|
||||
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
|
||||
if (dpofua) {
|
||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
|
||||
"DPO/FUA flags are set in the CDB_USAGE_DATA");
|
||||
if (!usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not set "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
|
||||
}
|
||||
} else {
|
||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
|
||||
"DPO/FUA flags are clear in the CDB_USAGE_DATA");
|
||||
if (usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logging(LOG_NORMAL, "[FAILED] Target did not return any data "
|
||||
"for ReportSupportedOpcodes\n");
|
||||
CU_FAIL("Target did not return any data for "
|
||||
"ReportSupportedOpcodes");
|
||||
}
|
||||
CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
|
||||
|
||||
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
|
||||
if (dpofua) {
|
||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
|
||||
"DPO/FUA flags are set in the CDB_USAGE_DATA");
|
||||
if (!usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not set "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
|
||||
}
|
||||
} else {
|
||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
|
||||
"DPO/FUA flags are clear in the CDB_USAGE_DATA");
|
||||
if (usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE");
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
scsi_free_scsi_task(rso_task);
|
||||
}
|
||||
|
||||
@@ -91,45 +91,35 @@ test_write16_dpofua(void)
|
||||
|
||||
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
|
||||
"for WRITE16");
|
||||
ret = report_supported_opcodes(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_WRITE16,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
|
||||
"Skipping this part of the test");
|
||||
goto out;
|
||||
}
|
||||
REPORT_SUPPORTED_OPCODES(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_WRITE16,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
|
||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||
rsoc = scsi_datain_unmarshall(rso_task);
|
||||
if (rsoc) {
|
||||
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
|
||||
if (dpofua) {
|
||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
|
||||
"DPO/FUA flags are set in the CDB_USAGE_DATA");
|
||||
if (!usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not set "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
|
||||
}
|
||||
} else {
|
||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
|
||||
"DPO/FUA flags are clear in the CDB_USAGE_DATA");
|
||||
if (usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logging(LOG_NORMAL, "[FAILED] Target did not return any data "
|
||||
"for ReportSupportedOpcodes\n");
|
||||
CU_FAIL("Target did not return any data for "
|
||||
"ReportSupportedOpcodes");
|
||||
}
|
||||
CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
|
||||
|
||||
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
|
||||
if (dpofua) {
|
||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
|
||||
"DPO/FUA flags are set in the CDB_USAGE_DATA");
|
||||
if (!usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not set "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
|
||||
}
|
||||
} else {
|
||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
|
||||
"DPO/FUA flags are clear in the CDB_USAGE_DATA");
|
||||
if (usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE");
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
scsi_free_scsi_task(rso_task);
|
||||
}
|
||||
|
||||
@@ -119,45 +119,35 @@ test_writeatomic16_dpofua(void)
|
||||
|
||||
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
|
||||
"for WRITEATOMIC16");
|
||||
ret = report_supported_opcodes(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_WRITE_ATOMIC16,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
|
||||
"Skipping this part of the test");
|
||||
goto out;
|
||||
}
|
||||
REPORT_SUPPORTED_OPCODES(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_WRITE_ATOMIC16,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
|
||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||
rsoc = scsi_datain_unmarshall(rso_task);
|
||||
if (rsoc) {
|
||||
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
|
||||
if (dpofua) {
|
||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
|
||||
"DPO/FUA flags are set in the CDB_USAGE_DATA");
|
||||
if (!usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not set "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
|
||||
}
|
||||
} else {
|
||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
|
||||
"DPO/FUA flags are clear in the CDB_USAGE_DATA");
|
||||
if (usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logging(LOG_NORMAL, "[FAILED] Target did not return any data "
|
||||
"for ReportSupportedOpcodes\n");
|
||||
CU_FAIL("Target did not return any data for "
|
||||
"ReportSupportedOpcodes");
|
||||
}
|
||||
CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
|
||||
|
||||
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
|
||||
if (dpofua) {
|
||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
|
||||
"DPO/FUA flags are set in the CDB_USAGE_DATA");
|
||||
if (!usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not set "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
|
||||
}
|
||||
} else {
|
||||
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
|
||||
"DPO/FUA flags are clear in the CDB_USAGE_DATA");
|
||||
if (usage_data_dpofua) {
|
||||
logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
|
||||
"in CDB_USAGE_DATE");
|
||||
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE");
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
scsi_free_scsi_task(rso_task);
|
||||
}
|
||||
|
||||
@@ -76,20 +76,17 @@ test_writeverify10_dpo(void)
|
||||
|
||||
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
|
||||
"for WRITEVERIFY10");
|
||||
ret = report_supported_opcodes(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_WRITE_VERIFY10,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
|
||||
"Skipping this part of the test");
|
||||
goto out;
|
||||
}
|
||||
REPORT_SUPPORTED_OPCODES(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_WRITE_VERIFY10,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
|
||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||
rsoc = scsi_datain_unmarshall(rso_task);
|
||||
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
||||
CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
|
||||
|
||||
usage_data_dpo = rsoc ? rsoc->cdb_usage_data[1] & 0x10 : -1;
|
||||
if (dpofua) {
|
||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO flag "
|
||||
@@ -101,6 +98,5 @@ test_writeverify10_dpo(void)
|
||||
CU_ASSERT_EQUAL(usage_data_dpo, 0x00);
|
||||
}
|
||||
|
||||
out:
|
||||
scsi_free_scsi_task(rso_task);
|
||||
}
|
||||
|
||||
@@ -76,20 +76,16 @@ test_writeverify12_dpo(void)
|
||||
|
||||
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
|
||||
"for WRITEVERIFY12");
|
||||
ret = report_supported_opcodes(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_WRITE_VERIFY12,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
|
||||
"Skipping this part of the test");
|
||||
goto out;
|
||||
}
|
||||
REPORT_SUPPORTED_OPCODES(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_WRITE_VERIFY12,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||
rsoc = scsi_datain_unmarshall(rso_task);
|
||||
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
||||
CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
|
||||
|
||||
usage_data_dpo = rsoc ? rsoc->cdb_usage_data[1] & 0x10 : -1;
|
||||
if (dpofua) {
|
||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO flag "
|
||||
@@ -101,6 +97,5 @@ test_writeverify12_dpo(void)
|
||||
CU_ASSERT_EQUAL(usage_data_dpo, 0x00);
|
||||
}
|
||||
|
||||
out:
|
||||
scsi_free_scsi_task(rso_task);
|
||||
}
|
||||
|
||||
@@ -75,23 +75,19 @@ test_writeverify16_dpo(void)
|
||||
EXPECT_INVALID_FIELD_IN_CDB);
|
||||
}
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
|
||||
"for WRITEVERIFY16");
|
||||
ret = report_supported_opcodes(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_WRITE_VERIFY16,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
|
||||
"Skipping this part of the test");
|
||||
goto out;
|
||||
}
|
||||
REPORT_SUPPORTED_OPCODES(sd, &rso_task,
|
||||
0, SCSI_REPORT_SUPPORTING_OPCODE,
|
||||
SCSI_OPCODE_WRITE_VERIFY16,
|
||||
0,
|
||||
65535,
|
||||
EXPECT_STATUS_GOOD);
|
||||
|
||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||
rsoc = scsi_datain_unmarshall(rso_task);
|
||||
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
||||
CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
|
||||
|
||||
usage_data_dpo = rsoc ? rsoc->cdb_usage_data[1] & 0x10 : -1;
|
||||
if (dpofua) {
|
||||
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO flag "
|
||||
@@ -103,6 +99,5 @@ test_writeverify16_dpo(void)
|
||||
CU_ASSERT_EQUAL(usage_data_dpo, 0x00);
|
||||
}
|
||||
|
||||
out:
|
||||
scsi_free_scsi_task(rso_task);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user