Tests: add helper macro for REPORT_SUPPORTED_OPCODES

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
Ronnie Sahlberg
2016-02-21 08:30:37 -08:00
parent f699503f8c
commit 4d1e3aecd0
20 changed files with 360 additions and 587 deletions

View File

@@ -195,6 +195,21 @@ do { \
CU_ASSERT_EQUAL(_r, 0); \ CU_ASSERT_EQUAL(_r, 0); \
} while (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(...) \ #define VERIFY10(...) \
do { \ do { \
int _r; \ int _r; \

View File

@@ -104,45 +104,34 @@ test_compareandwrite_dpofua(void)
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES " logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
"for COMPAREANDWRITE"); "for COMPAREANDWRITE");
ret = report_supported_opcodes(sd, &rso_task, REPORT_SUPPORTED_OPCODES(sd, &rso_task,
0, SCSI_REPORT_SUPPORTING_OPCODE, 0, SCSI_REPORT_SUPPORTING_OPCODE,
SCSI_OPCODE_COMPARE_AND_WRITE, SCSI_OPCODE_COMPARE_AND_WRITE,
0, 0,
65535, 65535,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test");
goto out;
}
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
if (rsoc) { CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
if (dpofua) { usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
logging(LOG_VERBOSE, "DPOFUA is set. Verify the " if (dpofua) {
"DPO/FUA flags are set in the CDB_USAGE_DATA"); logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
if (!usage_data_dpofua) { "DPO/FUA flags are set in the CDB_USAGE_DATA");
logging(LOG_NORMAL, "[FAILED] DpoFua not set " if (!usage_data_dpofua) {
"in CDB_USAGE_DATE"); logging(LOG_NORMAL, "[FAILED] DpoFua not set "
CU_FAIL("DpoFua not set in CDB_USAGE_DATE"); "in CDB_USAGE_DATE");
} CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
} else { }
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the " } else {
"DPO/FUA flags are clear in the CDB_USAGE_DATA"); logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
if (usage_data_dpofua) { "DPO/FUA flags are clear in the CDB_USAGE_DATA");
logging(LOG_NORMAL, "[FAILED] DpoFua not clear " if (usage_data_dpofua) {
"in CDB_USAGE_DATE"); logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE"); "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");
}
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -111,45 +111,34 @@ test_orwrite_dpofua(void)
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES " logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
"for ORWRITE"); "for ORWRITE");
ret = report_supported_opcodes(sd, &rso_task, REPORT_SUPPORTED_OPCODES(sd, &rso_task,
0, SCSI_REPORT_SUPPORTING_OPCODE, 0, SCSI_REPORT_SUPPORTING_OPCODE,
SCSI_OPCODE_ORWRITE, SCSI_OPCODE_ORWRITE,
0, 0,
65535, 65535,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test");
goto out;
}
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
if (rsoc) { CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
if (dpofua) { usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
logging(LOG_VERBOSE, "DPOFUA is set. Verify the " if (dpofua) {
"DPO/FUA flags are set in the CDB_USAGE_DATA"); logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
if (!usage_data_dpofua) { "DPO/FUA flags are set in the CDB_USAGE_DATA");
logging(LOG_NORMAL, "[FAILED] DpoFua not set " if (!usage_data_dpofua) {
"in CDB_USAGE_DATE"); logging(LOG_NORMAL, "[FAILED] DpoFua not set "
CU_FAIL("DpoFua not set in CDB_USAGE_DATE"); "in CDB_USAGE_DATE");
} CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
} else { }
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the " } else {
"DPO/FUA flags are clear in the CDB_USAGE_DATA"); logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
if (usage_data_dpofua) { "DPO/FUA flags are clear in the CDB_USAGE_DATA");
logging(LOG_NORMAL, "[FAILED] DpoFua not clear " if (usage_data_dpofua) {
"in CDB_USAGE_DATE"); logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE"); "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");
}
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -100,45 +100,34 @@ test_read10_dpofua(void)
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES " logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
"for READ10"); "for READ10");
ret = report_supported_opcodes(sd, &rso_task, REPORT_SUPPORTED_OPCODES(sd, &rso_task,
0, SCSI_REPORT_SUPPORTING_OPCODE, 0, SCSI_REPORT_SUPPORTING_OPCODE,
SCSI_OPCODE_READ10, SCSI_OPCODE_READ10,
0, 0,
65535, 65535,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test");
goto out;
}
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
if (rsoc) { CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
if (dpofua) { usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
logging(LOG_VERBOSE, "DPOFUA is set. Verify the " if (dpofua) {
"DPO/FUA flags are set in the CDB_USAGE_DATA"); logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
if (!usage_data_dpofua) { "DPO/FUA flags are set in the CDB_USAGE_DATA");
logging(LOG_NORMAL, "[FAILED] DpoFua not set " if (!usage_data_dpofua) {
"in CDB_USAGE_DATE"); logging(LOG_NORMAL, "[FAILED] DpoFua not set "
CU_FAIL("DpoFua not set in CDB_USAGE_DATE"); "in CDB_USAGE_DATE");
} CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
} else { }
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the " } else {
"DPO/FUA flags are clear in the CDB_USAGE_DATA"); logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
if (usage_data_dpofua) { "DPO/FUA flags are clear in the CDB_USAGE_DATA");
logging(LOG_NORMAL, "[FAILED] DpoFua not clear " if (usage_data_dpofua) {
"in CDB_USAGE_DATE"); logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE"); "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");
}
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -99,45 +99,34 @@ test_read12_dpofua(void)
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES " logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
"for READ12"); "for READ12");
ret = report_supported_opcodes(sd, &rso_task, REPORT_SUPPORTED_OPCODES(sd, &rso_task,
0, SCSI_REPORT_SUPPORTING_OPCODE, 0, SCSI_REPORT_SUPPORTING_OPCODE,
SCSI_OPCODE_READ12, SCSI_OPCODE_READ12,
0, 0,
65535, 65535,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test");
goto out;
}
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
if (rsoc) { CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
if (dpofua) { usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
logging(LOG_VERBOSE, "DPOFUA is set. Verify the " if (dpofua) {
"DPO/FUA flags are set in the CDB_USAGE_DATA"); logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
if (!usage_data_dpofua) { "DPO/FUA flags are set in the CDB_USAGE_DATA");
logging(LOG_NORMAL, "[FAILED] DpoFua not set " if (!usage_data_dpofua) {
"in CDB_USAGE_DATE"); logging(LOG_NORMAL, "[FAILED] DpoFua not set "
CU_FAIL("DpoFua not set in CDB_USAGE_DATE"); "in CDB_USAGE_DATE");
} CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
} else { }
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the " } else {
"DPO/FUA flags are clear in the CDB_USAGE_DATA"); logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
if (usage_data_dpofua) { "DPO/FUA flags are clear in the CDB_USAGE_DATA");
logging(LOG_NORMAL, "[FAILED] DpoFua not clear " if (usage_data_dpofua) {
"in CDB_USAGE_DATE"); logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE"); "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");
}
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -100,45 +100,34 @@ test_read16_dpofua(void)
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES " logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
"for READ16"); "for READ16");
ret = report_supported_opcodes(sd, &rso_task, REPORT_SUPPORTED_OPCODES(sd, &rso_task,
0, SCSI_REPORT_SUPPORTING_OPCODE, 0, SCSI_REPORT_SUPPORTING_OPCODE,
SCSI_OPCODE_READ16, SCSI_OPCODE_READ16,
0, 0,
65535, 65535,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test");
goto out;
}
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
if (rsoc) { CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
if (dpofua) { usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
logging(LOG_VERBOSE, "DPOFUA is set. Verify the " if (dpofua) {
"DPO/FUA flags are set in the CDB_USAGE_DATA"); logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
if (!usage_data_dpofua) { "DPO/FUA flags are set in the CDB_USAGE_DATA");
logging(LOG_NORMAL, "[FAILED] DpoFua not set " if (!usage_data_dpofua) {
"in CDB_USAGE_DATE"); logging(LOG_NORMAL, "[FAILED] DpoFua not set "
CU_FAIL("DpoFua not set in CDB_USAGE_DATE"); "in CDB_USAGE_DATE");
} CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
} else { }
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the " } else {
"DPO/FUA flags are clear in the CDB_USAGE_DATA"); logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
if (usage_data_dpofua) { "DPO/FUA flags are clear in the CDB_USAGE_DATA");
logging(LOG_NORMAL, "[FAILED] DpoFua not clear " if (usage_data_dpofua) {
"in CDB_USAGE_DATE"); logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE"); "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");
}
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -29,7 +29,7 @@
void void
test_report_supported_opcodes_one_command(void) test_report_supported_opcodes_one_command(void)
{ {
int i, ret; int i;
struct scsi_task *rso_task; struct scsi_task *rso_task;
struct scsi_task *one_task; struct scsi_task *one_task;
struct scsi_report_supported_op_codes *rsoc; 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, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test READ_SUPPORTED_OPCODES reading one-command"); logging(LOG_VERBOSE, "Test READ_SUPPORTED_OPCODES reading one-command");
logging(LOG_VERBOSE, "Fetch list of all supported opcodes"); logging(LOG_VERBOSE, "Fetch list of all supported opcodes");
ret = report_supported_opcodes(sd, &rso_task, REPORT_SUPPORTED_OPCODES(sd, &rso_task,
0, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, SCSI_REPORT_SUPPORTING_OPS_ALL,
0, 0, 65535, 0, 0, 65535,
EXPECT_STATUS_GOOD); 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"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
CU_ASSERT_NOT_EQUAL(rsoc, NULL); CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
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;
}
logging(LOG_VERBOSE, "Verify read one-command works for all supported " logging(LOG_VERBOSE, "Verify read one-command works for all supported "
"opcodes"); "opcodes");
@@ -74,86 +57,43 @@ test_report_supported_opcodes_one_command(void)
if (rsoc->descriptors[i].servactv) { if (rsoc->descriptors[i].servactv) {
logging(LOG_VERBOSE, "This opcode has service actions. " logging(LOG_VERBOSE, "This opcode has service actions. "
"Reporting Options 001b should fail"); "Reporting Options 001b should fail");
ret = report_supported_opcodes(sd, NULL, REPORT_SUPPORTED_OPCODES(sd, NULL, 0,
0, SCSI_REPORT_SUPPORTING_OPCODE, SCSI_REPORT_SUPPORTING_OPCODE,
rsoc->descriptors[i].opcode, rsoc->descriptors[i].opcode,
rsoc->descriptors[i].sa, rsoc->descriptors[i].sa,
65535, 65535,
EXPECT_INVALID_FIELD_IN_CDB); EXPECT_INVALID_FIELD_IN_CDB);
} else { } else {
logging(LOG_VERBOSE, "This opcode does not have " logging(LOG_VERBOSE, "This opcode does not have "
"service actions. Reporting Options 001b " "service actions. Reporting Options 001b "
"should work"); "should work");
ret = report_supported_opcodes( REPORT_SUPPORTED_OPCODES(sd, NULL, 0,
sd, NULL, SCSI_REPORT_SUPPORTING_OPCODE,
0, SCSI_REPORT_SUPPORTING_OPCODE, rsoc->descriptors[i].opcode,
rsoc->descriptors[i].opcode, rsoc->descriptors[i].sa,
rsoc->descriptors[i].sa, 65535,
65535, EXPECT_STATUS_GOOD);
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);
} }
if (rsoc->descriptors[i].servactv) { if (rsoc->descriptors[i].servactv) {
logging(LOG_VERBOSE, "This opcode has service actions. " logging(LOG_VERBOSE, "This opcode has service actions. "
"Reporting Options 002b should work"); "Reporting Options 002b should work");
ret = report_supported_opcodes( REPORT_SUPPORTED_OPCODES(sd, NULL, 0,
sd, NULL, SCSI_REPORT_SUPPORTING_SERVICEACTION,
0, SCSI_REPORT_SUPPORTING_SERVICEACTION, rsoc->descriptors[i].opcode,
rsoc->descriptors[i].opcode, rsoc->descriptors[i].sa,
rsoc->descriptors[i].sa, 65535,
65535, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
} else { } else {
logging(LOG_VERBOSE, "This opcode does not have " logging(LOG_VERBOSE, "This opcode does not have "
"service actions. Reporting Options 002b " "service actions. Reporting Options 002b "
"should fail"); "should fail");
ret = report_supported_opcodes( REPORT_SUPPORTED_OPCODES(sd, NULL, 0,
sd, NULL, SCSI_REPORT_SUPPORTING_SERVICEACTION,
0, SCSI_REPORT_SUPPORTING_SERVICEACTION, rsoc->descriptors[i].opcode,
rsoc->descriptors[i].opcode, rsoc->descriptors[i].sa,
rsoc->descriptors[i].sa, 65535,
65535, EXPECT_INVALID_FIELD_IN_CDB);
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);
} }
} }
@@ -164,19 +104,18 @@ test_report_supported_opcodes_one_command(void)
"ServiceAction:0x%02x", "ServiceAction:0x%02x",
rsoc->descriptors[i].opcode, rsoc->descriptors[i].opcode,
rsoc->descriptors[i].sa); rsoc->descriptors[i].sa);
ret = report_supported_opcodes( REPORT_SUPPORTED_OPCODES(sd, &one_task, 0,
sd, &one_task, 0, rsoc->descriptors[i].servactv ?
rsoc->descriptors[i].servactv ? SCSI_REPORT_SUPPORTING_SERVICEACTION :
SCSI_REPORT_SUPPORTING_SERVICEACTION : SCSI_REPORT_SUPPORTING_OPCODE,
SCSI_REPORT_SUPPORTING_OPCODE, rsoc->descriptors[i].opcode,
rsoc->descriptors[i].opcode, rsoc->descriptors[i].sa,
rsoc->descriptors[i].sa, 65535,
65535, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc_one = scsi_datain_unmarshall(one_task); 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"); logging(LOG_VERBOSE, "Verify CDB length is not 0");
CU_ASSERT_NOT_EQUAL(rsoc_one->cdb_length, 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); scsi_free_scsi_task(one_task);
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -29,41 +29,23 @@
void void
test_report_supported_opcodes_rctd(void) test_report_supported_opcodes_rctd(void)
{ {
int i, ret; int i;
struct scsi_task *rso_task; struct scsi_task *rso_task;
struct scsi_report_supported_op_codes *rsoc; struct scsi_report_supported_op_codes *rsoc;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test READ_SUPPORTED_OPCODES RCTD flag"); logging(LOG_VERBOSE, "Test READ_SUPPORTED_OPCODES RCTD flag");
logging(LOG_VERBOSE, "Test READ_SUPPORTED_OPCODES report ALL opcodes " logging(LOG_VERBOSE, "Test READ_SUPPORTED_OPCODES report ALL opcodes "
"without timeout descriptors. RCTD==0"); "without timeout descriptors. RCTD==0");
ret = report_supported_opcodes( REPORT_SUPPORTED_OPCODES(sd, &rso_task,
sd, &rso_task, 0, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0,
0, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0, 65535,
65535, EXPECT_STATUS_GOOD);
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"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
CU_ASSERT_NOT_EQUAL(rsoc, NULL); CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
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;
}
logging(LOG_VERBOSE, "Verify that all returned command descriptors " logging(LOG_VERBOSE, "Verify that all returned command descriptors "
"lack timeout description"); "lack timeout description");
@@ -75,20 +57,15 @@ test_report_supported_opcodes_rctd(void)
"CTDP set"); "CTDP set");
} }
} }
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
logging(LOG_VERBOSE, "Test READ_SUPPORTED_OPCODES report ALL opcodes " logging(LOG_VERBOSE, "Test READ_SUPPORTED_OPCODES report ALL opcodes "
"with timeout descriptors. RCTD==1"); "with timeout descriptors. RCTD==1");
ret = report_supported_opcodes( REPORT_SUPPORTED_OPCODES(sd, &rso_task,
sd, &rso_task, 1, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0,
1, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0, 65535,
65535, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
if (ret != 0)
goto out;
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
@@ -117,6 +94,5 @@ test_report_supported_opcodes_rctd(void)
} }
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -29,40 +29,21 @@
void void
test_report_supported_opcodes_servactv(void) test_report_supported_opcodes_servactv(void)
{ {
int i, ret; int i;
struct scsi_task *rso_task; struct scsi_task *rso_task;
struct scsi_report_supported_op_codes *rsoc; struct scsi_report_supported_op_codes *rsoc;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test READ_SUPPORTED_OPCODES SERVACTV flag"); logging(LOG_VERBOSE, "Test READ_SUPPORTED_OPCODES SERVACTV flag");
REPORT_SUPPORTED_OPCODES(sd, &rso_task,
ret = report_supported_opcodes( 0, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0,
sd, &rso_task, 65535,
0, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0, EXPECT_STATUS_GOOD);
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"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
CU_ASSERT_NOT_EQUAL(rsoc, NULL); CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
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;
}
logging(LOG_VERBOSE, "Verify that when SERVACTV is clear then " logging(LOG_VERBOSE, "Verify that when SERVACTV is clear then "
"ServiceAction must be zero."); "ServiceAction must be zero.");
@@ -75,6 +56,5 @@ test_report_supported_opcodes_servactv(void)
} }
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -29,21 +29,11 @@
void void
test_report_supported_opcodes_simple(void) test_report_supported_opcodes_simple(void)
{ {
int ret;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test basic READ_SUPPORTED_OPCODES"); logging(LOG_VERBOSE, "Test basic READ_SUPPORTED_OPCODES");
ret = report_supported_opcodes( REPORT_SUPPORTED_OPCODES(sd, NULL,
sd, NULL, 0, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0,
0, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0, 1024,
1024, EXPECT_STATUS_GOOD);
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);
} }

View File

@@ -74,20 +74,15 @@ test_verify10_dpo(void)
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES " logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
"for VERIFY10"); "for VERIFY10");
ret = report_supported_opcodes(sd, &rso_task, REPORT_SUPPORTED_OPCODES(sd, &rso_task,
0, SCSI_REPORT_SUPPORTING_OPCODE, 0, SCSI_REPORT_SUPPORTING_OPCODE,
SCSI_OPCODE_VERIFY10, SCSI_OPCODE_VERIFY10,
0, 0,
65535, 65535,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test");
goto out;
}
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); 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; usage_data_dpo = rsoc ? rsoc->cdb_usage_data[1] & 0x10 : -1;
if (dpofua) { if (dpofua) {
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO flag " 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); CU_ASSERT_EQUAL(usage_data_dpo, 0x00);
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -74,20 +74,15 @@ test_verify12_dpo(void)
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES " logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
"for VERIFY12"); "for VERIFY12");
ret = report_supported_opcodes(sd, &rso_task, REPORT_SUPPORTED_OPCODES(sd, &rso_task,
0, SCSI_REPORT_SUPPORTING_OPCODE, 0, SCSI_REPORT_SUPPORTING_OPCODE,
SCSI_OPCODE_VERIFY12, SCSI_OPCODE_VERIFY12,
0, 0,
65535, 65535,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test");
goto out;
}
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); 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; usage_data_dpo = rsoc ? rsoc->cdb_usage_data[1] & 0x10 : -1;
if (dpofua) { if (dpofua) {
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO flag " 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); CU_ASSERT_EQUAL(usage_data_dpo, 0x00);
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -74,20 +74,16 @@ test_verify16_dpo(void)
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES " logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
"for VERIFY16"); "for VERIFY16");
ret = report_supported_opcodes(sd, &rso_task, REPORT_SUPPORTED_OPCODES(sd, &rso_task,
0, SCSI_REPORT_SUPPORTING_OPCODE, 0, SCSI_REPORT_SUPPORTING_OPCODE,
SCSI_OPCODE_VERIFY16, SCSI_OPCODE_VERIFY16,
0, 0,
65535, 65535,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test");
goto out;
}
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); 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; usage_data_dpo = rsoc ? rsoc->cdb_usage_data[1] & 0x10 : -1;
if (dpofua) { if (dpofua) {
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO flag " 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); CU_ASSERT_EQUAL(usage_data_dpo, 0x00);
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -91,45 +91,35 @@ test_write10_dpofua(void)
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES " logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
"for WRITE10"); "for WRITE10");
ret = report_supported_opcodes(sd, &rso_task, REPORT_SUPPORTED_OPCODES(sd, &rso_task,
0, SCSI_REPORT_SUPPORTING_OPCODE, 0, SCSI_REPORT_SUPPORTING_OPCODE,
SCSI_OPCODE_WRITE10, SCSI_OPCODE_WRITE10,
0, 0,
65535, 65535,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test");
goto out;
}
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
if (rsoc) { CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
if (dpofua) { usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
logging(LOG_VERBOSE, "DPOFUA is set. Verify the " if (dpofua) {
"DPO/FUA flags are set in the CDB_USAGE_DATA"); logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
if (!usage_data_dpofua) { "DPO/FUA flags are set in the CDB_USAGE_DATA");
logging(LOG_NORMAL, "[FAILED] DpoFua not set " if (!usage_data_dpofua) {
"in CDB_USAGE_DATE"); logging(LOG_NORMAL, "[FAILED] DpoFua not set "
CU_FAIL("DpoFua not set in CDB_USAGE_DATE"); "in CDB_USAGE_DATE");
} CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
} else { }
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the " } else {
"DPO/FUA flags are clear in the CDB_USAGE_DATA"); logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
if (usage_data_dpofua) { "DPO/FUA flags are clear in the CDB_USAGE_DATA");
logging(LOG_NORMAL, "[FAILED] DpoFua not clear " if (usage_data_dpofua) {
"in CDB_USAGE_DATE"); logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE"); "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");
}
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -90,45 +90,35 @@ test_write12_dpofua(void)
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES " logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
"for WRITE12"); "for WRITE12");
ret = report_supported_opcodes(sd, &rso_task, REPORT_SUPPORTED_OPCODES(sd, &rso_task,
0, SCSI_REPORT_SUPPORTING_OPCODE, 0, SCSI_REPORT_SUPPORTING_OPCODE,
SCSI_OPCODE_WRITE12, SCSI_OPCODE_WRITE12,
0, 0,
65535, 65535,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test");
goto out;
}
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
if (rsoc) { CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
if (dpofua) { usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
logging(LOG_VERBOSE, "DPOFUA is set. Verify the " if (dpofua) {
"DPO/FUA flags are set in the CDB_USAGE_DATA"); logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
if (!usage_data_dpofua) { "DPO/FUA flags are set in the CDB_USAGE_DATA");
logging(LOG_NORMAL, "[FAILED] DpoFua not set " if (!usage_data_dpofua) {
"in CDB_USAGE_DATE"); logging(LOG_NORMAL, "[FAILED] DpoFua not set "
CU_FAIL("DpoFua not set in CDB_USAGE_DATE"); "in CDB_USAGE_DATE");
} CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
} else { }
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the " } else {
"DPO/FUA flags are clear in the CDB_USAGE_DATA"); logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
if (usage_data_dpofua) { "DPO/FUA flags are clear in the CDB_USAGE_DATA");
logging(LOG_NORMAL, "[FAILED] DpoFua not clear " if (usage_data_dpofua) {
"in CDB_USAGE_DATE"); logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE"); "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");
}
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -91,45 +91,35 @@ test_write16_dpofua(void)
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES " logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
"for WRITE16"); "for WRITE16");
ret = report_supported_opcodes(sd, &rso_task, REPORT_SUPPORTED_OPCODES(sd, &rso_task,
0, SCSI_REPORT_SUPPORTING_OPCODE, 0, SCSI_REPORT_SUPPORTING_OPCODE,
SCSI_OPCODE_WRITE16, SCSI_OPCODE_WRITE16,
0, 0,
65535, 65535,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test");
goto out;
}
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
if (rsoc) { CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
if (dpofua) { usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
logging(LOG_VERBOSE, "DPOFUA is set. Verify the " if (dpofua) {
"DPO/FUA flags are set in the CDB_USAGE_DATA"); logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
if (!usage_data_dpofua) { "DPO/FUA flags are set in the CDB_USAGE_DATA");
logging(LOG_NORMAL, "[FAILED] DpoFua not set " if (!usage_data_dpofua) {
"in CDB_USAGE_DATE"); logging(LOG_NORMAL, "[FAILED] DpoFua not set "
CU_FAIL("DpoFua not set in CDB_USAGE_DATE"); "in CDB_USAGE_DATE");
} CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
} else { }
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the " } else {
"DPO/FUA flags are clear in the CDB_USAGE_DATA"); logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
if (usage_data_dpofua) { "DPO/FUA flags are clear in the CDB_USAGE_DATA");
logging(LOG_NORMAL, "[FAILED] DpoFua not clear " if (usage_data_dpofua) {
"in CDB_USAGE_DATE"); logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE"); "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");
}
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -119,45 +119,35 @@ test_writeatomic16_dpofua(void)
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES " logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
"for WRITEATOMIC16"); "for WRITEATOMIC16");
ret = report_supported_opcodes(sd, &rso_task, REPORT_SUPPORTED_OPCODES(sd, &rso_task,
0, SCSI_REPORT_SUPPORTING_OPCODE, 0, SCSI_REPORT_SUPPORTING_OPCODE,
SCSI_OPCODE_WRITE_ATOMIC16, SCSI_OPCODE_WRITE_ATOMIC16,
0, 0,
65535, 65535,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test");
goto out;
}
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
if (rsoc) { CU_ASSERT_PTR_NOT_NULL_FATAL(rsoc);
usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
if (dpofua) { usage_data_dpofua = rsoc->cdb_usage_data[1] & 0x18;
logging(LOG_VERBOSE, "DPOFUA is set. Verify the " if (dpofua) {
"DPO/FUA flags are set in the CDB_USAGE_DATA"); logging(LOG_VERBOSE, "DPOFUA is set. Verify the "
if (!usage_data_dpofua) { "DPO/FUA flags are set in the CDB_USAGE_DATA");
logging(LOG_NORMAL, "[FAILED] DpoFua not set " if (!usage_data_dpofua) {
"in CDB_USAGE_DATE"); logging(LOG_NORMAL, "[FAILED] DpoFua not set "
CU_FAIL("DpoFua not set in CDB_USAGE_DATE"); "in CDB_USAGE_DATE");
} CU_FAIL("DpoFua not set in CDB_USAGE_DATE");
} else { }
logging(LOG_VERBOSE, "DPOFUA is clear. Verify the " } else {
"DPO/FUA flags are clear in the CDB_USAGE_DATA"); logging(LOG_VERBOSE, "DPOFUA is clear. Verify the "
if (usage_data_dpofua) { "DPO/FUA flags are clear in the CDB_USAGE_DATA");
logging(LOG_NORMAL, "[FAILED] DpoFua not clear " if (usage_data_dpofua) {
"in CDB_USAGE_DATE"); logging(LOG_NORMAL, "[FAILED] DpoFua not clear "
CU_FAIL("DpoFua not clear in CDB_USAGE_DATE"); "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");
}
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -76,20 +76,17 @@ test_writeverify10_dpo(void)
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES " logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
"for WRITEVERIFY10"); "for WRITEVERIFY10");
ret = report_supported_opcodes(sd, &rso_task, REPORT_SUPPORTED_OPCODES(sd, &rso_task,
0, SCSI_REPORT_SUPPORTING_OPCODE, 0, SCSI_REPORT_SUPPORTING_OPCODE,
SCSI_OPCODE_WRITE_VERIFY10, SCSI_OPCODE_WRITE_VERIFY10,
0, 0,
65535, 65535,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test");
goto out;
}
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); 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; usage_data_dpo = rsoc ? rsoc->cdb_usage_data[1] & 0x10 : -1;
if (dpofua) { if (dpofua) {
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO flag " 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); CU_ASSERT_EQUAL(usage_data_dpo, 0x00);
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -76,20 +76,16 @@ test_writeverify12_dpo(void)
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES " logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
"for WRITEVERIFY12"); "for WRITEVERIFY12");
ret = report_supported_opcodes(sd, &rso_task, REPORT_SUPPORTED_OPCODES(sd, &rso_task,
0, SCSI_REPORT_SUPPORTING_OPCODE, 0, SCSI_REPORT_SUPPORTING_OPCODE,
SCSI_OPCODE_WRITE_VERIFY12, SCSI_OPCODE_WRITE_VERIFY12,
0, 0,
65535, 65535,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test");
goto out;
}
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); 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; usage_data_dpo = rsoc ? rsoc->cdb_usage_data[1] & 0x10 : -1;
if (dpofua) { if (dpofua) {
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO flag " 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); CU_ASSERT_EQUAL(usage_data_dpo, 0x00);
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -75,23 +75,19 @@ test_writeverify16_dpo(void)
EXPECT_INVALID_FIELD_IN_CDB); EXPECT_INVALID_FIELD_IN_CDB);
} }
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES " logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
"for WRITEVERIFY16"); "for WRITEVERIFY16");
ret = report_supported_opcodes(sd, &rso_task, REPORT_SUPPORTED_OPCODES(sd, &rso_task,
0, SCSI_REPORT_SUPPORTING_OPCODE, 0, SCSI_REPORT_SUPPORTING_OPCODE,
SCSI_OPCODE_WRITE_VERIFY16, SCSI_OPCODE_WRITE_VERIFY16,
0, 0,
65535, 65535,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test");
goto out;
}
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); 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; usage_data_dpo = rsoc ? rsoc->cdb_usage_data[1] & 0x10 : -1;
if (dpofua) { if (dpofua) {
logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO flag " 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); CU_ASSERT_EQUAL(usage_data_dpo, 0x00);
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }