From d7606c44e25873bf325427e28f84e67cc479495b Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Sat, 19 Sep 2015 15:24:04 -0700 Subject: [PATCH] TESTS: Update checks for DPUFUA bits in CDB_USAE_DATA fields Signed-off-by: Ronnie Sahlberg --- test-tool/test_compareandwrite_dpofua.c | 32 ++++++++++++++++++------- test-tool/test_orwrite_dpofua.c | 32 ++++++++++++++++++------- test-tool/test_read10_dpofua.c | 32 ++++++++++++++++++------- test-tool/test_read12_dpofua.c | 32 ++++++++++++++++++------- test-tool/test_read16_dpofua.c | 32 ++++++++++++++++++------- test-tool/test_write10_dpofua.c | 32 ++++++++++++++++++------- test-tool/test_write12_dpofua.c | 32 ++++++++++++++++++------- test-tool/test_write16_dpofua.c | 32 ++++++++++++++++++------- test-tool/test_writeatomic16_dpofua.c | 32 ++++++++++++++++++------- 9 files changed, 207 insertions(+), 81 deletions(-) diff --git a/test-tool/test_compareandwrite_dpofua.c b/test-tool/test_compareandwrite_dpofua.c index b3a562f..effff44 100644 --- a/test-tool/test_compareandwrite_dpofua.c +++ b/test-tool/test_compareandwrite_dpofua.c @@ -123,16 +123,30 @@ test_compareandwrite_dpofua(void) } logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); rsoc = scsi_datain_unmarshall(rso_task); - CU_ASSERT_NOT_EQUAL(rsoc, NULL); - usage_data_dpofua = rsoc ? rsoc->cdb_usage_data[1] & 0x18 : -1; - if (dpofua) { - logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags " - "are set in the CDB_USAGE_DATA"); - CU_ASSERT_EQUAL(usage_data_dpofua, 0x18); + 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_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA " - "flags are clear in the CDB_USAGE_DATA"); - CU_ASSERT_EQUAL(usage_data_dpofua, 0x00); + logging(LOG_NORMAL, "[FAILED] Target did not return any data " + "for ReportSupportedOpcodes\n"); + CU_FAIL("Target did not return any data for " + "ReportSupportedOpcodes"); } scsi_free_scsi_task(rso_task); } diff --git a/test-tool/test_orwrite_dpofua.c b/test-tool/test_orwrite_dpofua.c index f845594..d460682 100644 --- a/test-tool/test_orwrite_dpofua.c +++ b/test-tool/test_orwrite_dpofua.c @@ -124,16 +124,30 @@ test_orwrite_dpofua(void) } logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); rsoc = scsi_datain_unmarshall(rso_task); - CU_ASSERT_NOT_EQUAL(rsoc, NULL); - usage_data_dpofua = rsoc ? rsoc->cdb_usage_data[1] & 0x18 : -1; - if (dpofua) { - logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags " - "are set in the CDB_USAGE_DATA"); - CU_ASSERT_EQUAL(usage_data_dpofua, 0x18); + 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_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA " - "flags are clear in the CDB_USAGE_DATA"); - CU_ASSERT_EQUAL(usage_data_dpofua, 0x00); + logging(LOG_NORMAL, "[FAILED] Target did not return any data " + "for ReportSupportedOpcodes\n"); + CU_FAIL("Target did not return any data for " + "ReportSupportedOpcodes"); } scsi_free_scsi_task(rso_task); } diff --git a/test-tool/test_read10_dpofua.c b/test-tool/test_read10_dpofua.c index 5f3b9e2..127e01a 100644 --- a/test-tool/test_read10_dpofua.c +++ b/test-tool/test_read10_dpofua.c @@ -112,16 +112,30 @@ test_read10_dpofua(void) } logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); rsoc = scsi_datain_unmarshall(rso_task); - CU_ASSERT_NOT_EQUAL(rsoc, NULL); - usage_data_dpofua = rsoc ? rsoc->cdb_usage_data[1] & 0x18 : -1; - if (dpofua) { - logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags " - "are set in the CDB_USAGE_DATA"); - CU_ASSERT_EQUAL(usage_data_dpofua, 0x18); + 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_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA " - "flags are clear in the CDB_USAGE_DATA"); - CU_ASSERT_EQUAL(usage_data_dpofua, 0x00); + logging(LOG_NORMAL, "[FAILED] Target did not return any data " + "for ReportSupportedOpcodes\n"); + CU_FAIL("Target did not return any data for " + "ReportSupportedOpcodes"); } scsi_free_scsi_task(rso_task); } diff --git a/test-tool/test_read12_dpofua.c b/test-tool/test_read12_dpofua.c index 74c145d..a401138 100644 --- a/test-tool/test_read12_dpofua.c +++ b/test-tool/test_read12_dpofua.c @@ -111,16 +111,30 @@ test_read12_dpofua(void) } logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); rsoc = scsi_datain_unmarshall(rso_task); - CU_ASSERT_NOT_EQUAL(rsoc, NULL); - usage_data_dpofua = rsoc ? rsoc->cdb_usage_data[1] & 0x18 : -1; - if (dpofua) { - logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags " - "are set in the CDB_USAGE_DATA"); - CU_ASSERT_EQUAL(usage_data_dpofua, 0x18); + 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_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA " - "flags are clear in the CDB_USAGE_DATA"); - CU_ASSERT_EQUAL(usage_data_dpofua, 0x00); + logging(LOG_NORMAL, "[FAILED] Target did not return any data " + "for ReportSupportedOpcodes\n"); + CU_FAIL("Target did not return any data for " + "ReportSupportedOpcodes"); } scsi_free_scsi_task(rso_task); } diff --git a/test-tool/test_read16_dpofua.c b/test-tool/test_read16_dpofua.c index 31daea7..c649158 100644 --- a/test-tool/test_read16_dpofua.c +++ b/test-tool/test_read16_dpofua.c @@ -112,16 +112,30 @@ test_read16_dpofua(void) } logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); rsoc = scsi_datain_unmarshall(rso_task); - CU_ASSERT_NOT_EQUAL(rsoc, NULL); - usage_data_dpofua = rsoc ? rsoc->cdb_usage_data[1] & 0x18 : -1; - if (dpofua) { - logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags " - "are set in the CDB_USAGE_DATA"); - CU_ASSERT_EQUAL(usage_data_dpofua, 0x18); + 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_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA " - "flags are clear in the CDB_USAGE_DATA"); - CU_ASSERT_EQUAL(usage_data_dpofua, 0x00); + logging(LOG_NORMAL, "[FAILED] Target did not return any data " + "for ReportSupportedOpcodes\n"); + CU_FAIL("Target did not return any data for " + "ReportSupportedOpcodes"); } scsi_free_scsi_task(rso_task); } diff --git a/test-tool/test_write10_dpofua.c b/test-tool/test_write10_dpofua.c index 23ee387..870feff 100644 --- a/test-tool/test_write10_dpofua.c +++ b/test-tool/test_write10_dpofua.c @@ -115,16 +115,30 @@ test_write10_dpofua(void) } logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); rsoc = scsi_datain_unmarshall(rso_task); - CU_ASSERT_NOT_EQUAL(rsoc, NULL); - usage_data_dpofua = rsoc ? rsoc->cdb_usage_data[1] & 0x18 : -1; - if (dpofua) { - logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags " - "are set in the CDB_USAGE_DATA"); - CU_ASSERT_EQUAL(usage_data_dpofua, 0x18); + 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_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA " - "flags are clear in the CDB_USAGE_DATA"); - CU_ASSERT_EQUAL(usage_data_dpofua, 0x00); + logging(LOG_NORMAL, "[FAILED] Target did not return any data " + "for ReportSupportedOpcodes\n"); + CU_FAIL("Target did not return any data for " + "ReportSupportedOpcodes"); } scsi_free_scsi_task(rso_task); } diff --git a/test-tool/test_write12_dpofua.c b/test-tool/test_write12_dpofua.c index 91e3585..05f0511 100644 --- a/test-tool/test_write12_dpofua.c +++ b/test-tool/test_write12_dpofua.c @@ -125,16 +125,30 @@ test_write12_dpofua(void) } logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); rsoc = scsi_datain_unmarshall(rso_task); - CU_ASSERT_NOT_EQUAL(rsoc, NULL); - usage_data_dpofua = rsoc ? rsoc->cdb_usage_data[1] & 0x18 : -1; - if (dpofua) { - logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags " - "are set in the CDB_USAGE_DATA"); - CU_ASSERT_EQUAL(usage_data_dpofua, 0x18); + 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_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA " - "flags are clear in the CDB_USAGE_DATA"); - CU_ASSERT_EQUAL(usage_data_dpofua, 0x00); + logging(LOG_NORMAL, "[FAILED] Target did not return any data " + "for ReportSupportedOpcodes\n"); + CU_FAIL("Target did not return any data for " + "ReportSupportedOpcodes"); } scsi_free_scsi_task(rso_task); } diff --git a/test-tool/test_write16_dpofua.c b/test-tool/test_write16_dpofua.c index e0e93f2..4d2c5a0 100644 --- a/test-tool/test_write16_dpofua.c +++ b/test-tool/test_write16_dpofua.c @@ -125,16 +125,30 @@ test_write16_dpofua(void) } logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); rsoc = scsi_datain_unmarshall(rso_task); - CU_ASSERT_NOT_EQUAL(rsoc, NULL); - usage_data_dpofua = rsoc ? rsoc->cdb_usage_data[1] & 0x18 : -1; - if (dpofua) { - logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags " - "are set in the CDB_USAGE_DATA"); - CU_ASSERT_EQUAL(usage_data_dpofua, 0x18); + 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_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA " - "flags are clear in the CDB_USAGE_DATA"); - CU_ASSERT_EQUAL(usage_data_dpofua, 0x00); + logging(LOG_NORMAL, "[FAILED] Target did not return any data " + "for ReportSupportedOpcodes\n"); + CU_FAIL("Target did not return any data for " + "ReportSupportedOpcodes"); } scsi_free_scsi_task(rso_task); } diff --git a/test-tool/test_writeatomic16_dpofua.c b/test-tool/test_writeatomic16_dpofua.c index d555863..c2b9ae6 100644 --- a/test-tool/test_writeatomic16_dpofua.c +++ b/test-tool/test_writeatomic16_dpofua.c @@ -128,16 +128,30 @@ test_writeatomic16_dpofua(void) } logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); rsoc = scsi_datain_unmarshall(rso_task); - CU_ASSERT_NOT_EQUAL(rsoc, NULL); - usage_data_dpofua = rsoc ? rsoc->cdb_usage_data[1] & 0x18 : -1; - if (dpofua) { - logging(LOG_VERBOSE, "DPOFUA is set. Verify the DPO/FUA flags " - "are set in the CDB_USAGE_DATA"); - CU_ASSERT_EQUAL(usage_data_dpofua, 0x18); + 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_VERBOSE, "DPOFUA is clear. Verify the DPO/FUA " - "flags are clear in the CDB_USAGE_DATA"); - CU_ASSERT_EQUAL(usage_data_dpofua, 0x00); + logging(LOG_NORMAL, "[FAILED] Target did not return any data " + "for ReportSupportedOpcodes\n"); + CU_FAIL("Target did not return any data for " + "ReportSupportedOpcodes"); } scsi_free_scsi_task(rso_task); }