From 3ee39643329bb3d342c8b6f049aec5b40dd54256 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Wed, 17 Sep 2014 14:13:14 -0700 Subject: [PATCH] TESTS: change testunitready to new api Signed-off-by: Ronnie Sahlberg --- test-tool/iscsi-support.c | 121 +++------------------ test-tool/iscsi-support.h | 5 +- test-tool/test_iscsi_cmdsn_toohigh.c | 6 +- test-tool/test_iscsi_cmdsn_toolow.c | 6 +- test-tool/test_mandatory_sbc.c | 3 +- test-tool/test_nomedia_sbc.c | 3 +- test-tool/test_preventallow_2_itnexuses.c | 3 +- test-tool/test_preventallow_cold_reset.c | 8 +- test-tool/test_preventallow_eject.c | 6 +- test-tool/test_preventallow_itnexus_loss.c | 6 +- test-tool/test_preventallow_logout.c | 6 +- test-tool/test_preventallow_lun_reset.c | 8 +- test-tool/test_preventallow_warm_reset.c | 8 +- test-tool/test_sanitize_reset.c | 6 +- test-tool/test_startstopunit_noloej.c | 24 ++-- test-tool/test_startstopunit_pwrcnd.c | 3 +- test-tool/test_startstopunit_simple.c | 12 +- test-tool/test_testunitready_simple.c | 3 +- 18 files changed, 87 insertions(+), 150 deletions(-) diff --git a/test-tool/iscsi-support.c b/test-tool/iscsi-support.c index 09fd025..35d20a4 100644 --- a/test-tool/iscsi-support.c +++ b/test-tool/iscsi-support.c @@ -1377,34 +1377,24 @@ int startstopunit(struct iscsi_context *iscsi, int lun, int immed, int pcm, int } int -testunitready(struct iscsi_context *iscsi, int lun) +testunitready(struct iscsi_context *iscsi, int lun, int status, enum scsi_sense_key key, int *ascq, int num_ascq) { struct scsi_task *task; + int ret; - logging(LOG_VERBOSE, "Send TESTUNITREADY"); - task = iscsi_testunitready_sync(iscsi, lun); - if (task == NULL) { - logging(LOG_NORMAL, - "[FAILED] Failed to send TESTUNITREADY command: %s", - iscsi_get_error(iscsi)); - return -1; - } - if (task->status == SCSI_STATUS_TIMEOUT) { - logging(LOG_NORMAL, - "TESTUNITREADY timed out"); + logging(LOG_VERBOSE, "Send TESTUNITREADY (Expecting %s)", + scsi_status_str(status)); + + task = scsi_cdb_testunitready(); + assert(task != NULL); + + task = iscsi_scsi_command_sync(iscsi, lun, task, NULL); + + ret = check_result("TESTUNITREADY", iscsi, task, status, key, ascq, num_ascq); + if (task) { scsi_free_scsi_task(task); - return -1; } - if (task->status != SCSI_STATUS_GOOD) { - logging(LOG_NORMAL, - "[FAILED] TESTUNITREADY command: failed with sense. %s", - iscsi_get_error(iscsi)); - scsi_free_scsi_task(task); - return -1; - } - scsi_free_scsi_task(task); - logging(LOG_VERBOSE, "[OK] TESTUNITREADY returned SUCCESS."); - return 0; + return ret; } int @@ -1439,91 +1429,6 @@ out: return ret; } -int -testunitready_nomedium(struct iscsi_context *iscsi, int lun) -{ - struct scsi_task *task; - - logging(LOG_VERBOSE, "Send TESTUNITREADY (Expecting MEDIUM_NOT_PRESENT)"); - task = iscsi_testunitready_sync(iscsi, lun); - if (task == NULL) { - logging(LOG_NORMAL, "[FAILED] Failed to send TESTUNITREADY " - "command: %s", iscsi_get_error(iscsi)); - return -1; - } - if (task->status == SCSI_STATUS_GOOD) { - logging(LOG_NORMAL, "[FAILED] TESTUNITREADY command successful. But should have failed with NOT_READY/MEDIUM_NOT_PRESENT*"); - scsi_free_scsi_task(task); - return -1; - } - if (task->status != SCSI_STATUS_CHECK_CONDITION - || task->sense.key != SCSI_SENSE_NOT_READY - || (task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT - && task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_OPEN - && task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_CLOSED)) { - logging(LOG_NORMAL, "[FAILED] TESTUNITREADY Should have failed " - "with NOT_READY/MEDIUM_NOT_PRESENT* But failed " - "with %s", iscsi_get_error(iscsi)); - scsi_free_scsi_task(task); - return -1; - } - scsi_free_scsi_task(task); - logging(LOG_VERBOSE, "[OK] TESTUNITREADY returned MEDIUM_NOT_PRESENT."); - return 0; -} - -int -testunitready_sanitize(struct iscsi_context *iscsi, int lun) -{ - struct scsi_task *task; - - logging(LOG_VERBOSE, "Send TESTUNITREADY (Expecting SANITIZE_IN_PROGRESS)"); - task = iscsi_testunitready_sync(iscsi, lun); - if (task == NULL) { - logging(LOG_NORMAL, "[FAILED] Failed to send TESTUNITREADY " - "command: %s", iscsi_get_error(iscsi)); - return -1; - } - if (task->status == SCSI_STATUS_GOOD) { - logging(LOG_NORMAL, "[FAILED] TESTUNITREADY command successful. But should have failed with NOT_READY/SANITIZE_IN_PROGRESS"); - scsi_free_scsi_task(task); - return -1; - } - if (task->status != SCSI_STATUS_CHECK_CONDITION - || task->sense.key != SCSI_SENSE_NOT_READY - || task->sense.ascq != SCSI_SENSE_ASCQ_SANITIZE_IN_PROGRESS) { - logging(LOG_NORMAL, "[FAILED] TESTUNITREADY Should have failed " - "with NOT_READY/SANITIZE_IN_PROGRESS But failed " - "with %s", iscsi_get_error(iscsi)); - scsi_free_scsi_task(task); - return -1; - } - scsi_free_scsi_task(task); - logging(LOG_VERBOSE, "[OK] TESTUNITREADY returned SANITIZE_IN_PROGRESS."); - return 0; -} - -int -testunitready_conflict(struct iscsi_context *iscsi, int lun) -{ - struct scsi_task *task; - - logging(LOG_VERBOSE, "Send TESTUNITREADY (Expecting RESERVATION_CONFLICT)"); - task = iscsi_testunitready_sync(iscsi, lun); - if (task == NULL) { - logging(LOG_NORMAL, "[FAILED] Failed to send TESTUNITREADY " - "command: %s", iscsi_get_error(iscsi)); - return -1; - } - if (task->status != SCSI_STATUS_RESERVATION_CONFLICT) { - logging(LOG_NORMAL, "[FAILED] Expected RESERVATION CONFLICT"); - return -1; - } - scsi_free_scsi_task(task); - logging(LOG_VERBOSE, "[OK] TESTUNITREADY returned RESERVATION_CONFLICT."); - return 0; -} - /* * Returns -1 if allocating a SCSI task failed or if a communication error * occurred and a SCSI status if a SCSI response has been received. diff --git a/test-tool/iscsi-support.h b/test-tool/iscsi-support.h index cc3b775..52b8c31 100644 --- a/test-tool/iscsi-support.h +++ b/test-tool/iscsi-support.h @@ -289,10 +289,7 @@ int synchronizecache10_nomedium(struct iscsi_context *iscsi, int lun, uint32_t l int synchronizecache16(struct iscsi_context *iscsi, int lun, uint64_t lba, int num_blocks, int sync_nv, int immed); int synchronizecache16_nomedium(struct iscsi_context *iscsi, int lun, uint64_t lba, int num_blocks, int sync_nv, int immed); int testunitready_clear_ua(struct iscsi_context *iscsi, int lun); -int testunitready(struct iscsi_context *iscsi, int lun); -int testunitready_nomedium(struct iscsi_context *iscsi, int lun); -int testunitready_conflict(struct iscsi_context *iscsi, int lun); -int testunitready_sanitize(struct iscsi_context *iscsi, int lun); +int testunitready(struct iscsi_context *iscsi, int lun, int status, enum scsi_sense_key key, int *ascq, int num_ascq); int mode_sense(struct iscsi_context *iscsi, int lun); int unmap(struct iscsi_context *iscsi, int lun, int anchor, struct unmap_list *list, int list_len); int unmap_writeprotected(struct iscsi_context *iscsi, int lun, int anchor, struct unmap_list *list, int list_len); diff --git a/test-tool/test_iscsi_cmdsn_toohigh.c b/test-tool/test_iscsi_cmdsn_toohigh.c index 7d24a1a..f2db7f3 100644 --- a/test-tool/test_iscsi_cmdsn_toohigh.c +++ b/test-tool/test_iscsi_cmdsn_toohigh.c @@ -64,7 +64,8 @@ void test_iscsi_cmdsn_toohigh(void) iscsi_set_noautoreconnect(iscsic, 1); iscsi_set_timeout(iscsic, 3); - ret = testunitready(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, -1); if (ret == -1) { logging(LOG_VERBOSE, "[SUCCESS] We did not receive a reply"); @@ -75,7 +76,8 @@ void test_iscsi_cmdsn_toohigh(void) iscsi_set_noautoreconnect(iscsic, 0); logging(LOG_VERBOSE, "Send a TESTUNITREADY with CMDSN == EXPCMDSN. should work again"); - ret = testunitready(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_iscsi_cmdsn_toolow.c b/test-tool/test_iscsi_cmdsn_toolow.c index 33257ba..a1eaea8 100644 --- a/test-tool/test_iscsi_cmdsn_toolow.c +++ b/test-tool/test_iscsi_cmdsn_toolow.c @@ -64,7 +64,8 @@ void test_iscsi_cmdsn_toolow(void) iscsi_set_noautoreconnect(iscsic, 1); iscsi_set_timeout(iscsic, 3); - ret = testunitready(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, -1); if (ret == -1) { logging(LOG_VERBOSE, "[SUCCESS] We did not receive a reply"); @@ -76,7 +77,8 @@ void test_iscsi_cmdsn_toolow(void) iscsi_set_noautoreconnect(iscsic, 0); logging(LOG_VERBOSE, "Send a TESTUNITREADY with CMDSN == EXPCMDSN. should work again"); - ret = testunitready(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_mandatory_sbc.c b/test-tool/test_mandatory_sbc.c index daa0afe..987ec07 100644 --- a/test-tool/test_mandatory_sbc.c +++ b/test-tool/test_mandatory_sbc.c @@ -65,6 +65,7 @@ test_mandatory_sbc(void) } logging(LOG_VERBOSE, "Test TESTUNITREADY."); - ret = testunitready(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_nomedia_sbc.c b/test-tool/test_nomedia_sbc.c index 6f4a147..a7484a9 100644 --- a/test-tool/test_nomedia_sbc.c +++ b/test-tool/test_nomedia_sbc.c @@ -48,7 +48,8 @@ test_nomedia_sbc(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test TESTUNITREADY when medium is ejected."); - ret = testunitready_nomedium(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_NO_MEDIUM); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test SYNCHRONIZECACHE10 when medium is ejected."); diff --git a/test-tool/test_preventallow_2_itnexuses.c b/test-tool/test_preventallow_2_itnexuses.c index e7a3f31..2b14acc 100644 --- a/test-tool/test_preventallow_2_itnexuses.c +++ b/test-tool/test_preventallow_2_itnexuses.c @@ -45,7 +45,8 @@ test_preventallow_2_itnexuses(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can still access the media."); - ret = testunitready(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Create a second connection to the target"); diff --git a/test-tool/test_preventallow_cold_reset.c b/test-tool/test_preventallow_cold_reset.c index 87ee6f1..a374cdb 100644 --- a/test-tool/test_preventallow_cold_reset.c +++ b/test-tool/test_preventallow_cold_reset.c @@ -45,14 +45,15 @@ test_preventallow_cold_reset(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can still access the media."); - ret = testunitready(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Perform cold reset on target"); ret = iscsi_task_mgmt_target_cold_reset_sync(iscsic); logging(LOG_VERBOSE, "Wait until all unit attentions clear"); - while (testunitready(iscsic, tgt_lun) != 0); + while (testunitready(iscsic, tgt_lun, EXPECT_STATUS_GOOD) != 0); CU_ASSERT_EQUAL(ret, 0); @@ -62,7 +63,8 @@ test_preventallow_cold_reset(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can not access the media."); - ret = testunitready_nomedium(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_NO_MEDIUM); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); diff --git a/test-tool/test_preventallow_eject.c b/test-tool/test_preventallow_eject.c index 7fb6635..d110064 100644 --- a/test-tool/test_preventallow_eject.c +++ b/test-tool/test_preventallow_eject.c @@ -45,7 +45,8 @@ test_preventallow_eject(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can still access the media."); - ret = testunitready(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test we can clear PREVENT flag"); @@ -58,7 +59,8 @@ test_preventallow_eject(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can not access the media."); - ret = testunitready_nomedium(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_NO_MEDIUM); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Set the PREVENT flag"); diff --git a/test-tool/test_preventallow_itnexus_loss.c b/test-tool/test_preventallow_itnexus_loss.c index de9ed18..d649c77 100644 --- a/test-tool/test_preventallow_itnexus_loss.c +++ b/test-tool/test_preventallow_itnexus_loss.c @@ -45,7 +45,8 @@ test_preventallow_itnexus_loss(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can still access the media."); - ret = testunitready(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -65,7 +66,8 @@ test_preventallow_itnexus_loss(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can not access the media."); - ret = testunitready_nomedium(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_NO_MEDIUM); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); diff --git a/test-tool/test_preventallow_logout.c b/test-tool/test_preventallow_logout.c index 607477b..130916d 100644 --- a/test-tool/test_preventallow_logout.c +++ b/test-tool/test_preventallow_logout.c @@ -45,7 +45,8 @@ test_preventallow_logout(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can still access the media."); - ret = testunitready(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -66,7 +67,8 @@ test_preventallow_logout(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can not access the media."); - ret = testunitready_nomedium(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_NO_MEDIUM); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); diff --git a/test-tool/test_preventallow_lun_reset.c b/test-tool/test_preventallow_lun_reset.c index 6ad6fab..625ea1a 100644 --- a/test-tool/test_preventallow_lun_reset.c +++ b/test-tool/test_preventallow_lun_reset.c @@ -45,7 +45,8 @@ test_preventallow_lun_reset(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can still access the media."); - ret = testunitready(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -53,7 +54,7 @@ test_preventallow_lun_reset(void) ret = iscsi_task_mgmt_lun_reset_sync(iscsic, tgt_lun); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Wait until all unit attentions clear"); - while (testunitready(iscsic, tgt_lun) != 0); + while (testunitready(iscsic, tgt_lun, EXPECT_STATUS_GOOD) != 0); logging(LOG_VERBOSE, "Try to eject the medium"); @@ -62,7 +63,8 @@ test_preventallow_lun_reset(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can not access the media."); - ret = testunitready_nomedium(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_NO_MEDIUM); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); diff --git a/test-tool/test_preventallow_warm_reset.c b/test-tool/test_preventallow_warm_reset.c index d39e82a..02cc71b 100644 --- a/test-tool/test_preventallow_warm_reset.c +++ b/test-tool/test_preventallow_warm_reset.c @@ -45,7 +45,8 @@ test_preventallow_warm_reset(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can still access the media."); - ret = testunitready(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -53,7 +54,7 @@ test_preventallow_warm_reset(void) ret = iscsi_task_mgmt_target_warm_reset_sync(iscsic); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Wait until all unit attentions clear"); - while (testunitready(iscsic, tgt_lun) != 0); + while (testunitready(iscsic, tgt_lun, EXPECT_STATUS_GOOD) != 0); logging(LOG_VERBOSE, "Try to eject the medium"); @@ -62,7 +63,8 @@ test_preventallow_warm_reset(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can not access the media."); - ret = testunitready_nomedium(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_NO_MEDIUM); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); diff --git a/test-tool/test_sanitize_reset.c b/test-tool/test_sanitize_reset.c index ff49752..e329472 100644 --- a/test-tool/test_sanitize_reset.c +++ b/test-tool/test_sanitize_reset.c @@ -86,7 +86,8 @@ test_sanitize_reset(void) logging(LOG_VERBOSE, "Verify that the SANITIZE has started and that " "TESTUNITREADY fails with SANITIZE_IN_PROGRESS"); - ret = testunitready_sanitize(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_SANITIZE); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify that STARTSTOPUNIT fails with " @@ -155,7 +156,8 @@ test_sanitize_reset(void) } logging(LOG_VERBOSE, "Verify that the SANITIZE is still going."); - ret = testunitready_sanitize(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_SANITIZE); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Wait until the SANITIZE operation has finished"); diff --git a/test-tool/test_startstopunit_noloej.c b/test-tool/test_startstopunit_noloej.c index eca4f5a..efb4869 100644 --- a/test-tool/test_startstopunit_noloej.c +++ b/test-tool/test_startstopunit_noloej.c @@ -45,7 +45,8 @@ test_startstopunit_noloej(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); - ret = testunitready(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_SANITIZE); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==0 NO_FLUSH==0 START==1"); @@ -55,7 +56,8 @@ test_startstopunit_noloej(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); - ret = testunitready(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_SANITIZE); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==1 NO_FLUSH==0 START==0"); @@ -65,7 +67,8 @@ test_startstopunit_noloej(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); - ret = testunitready(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_SANITIZE); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==1 NO_FLUSH==0 START==1"); @@ -75,7 +78,8 @@ test_startstopunit_noloej(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); - ret = testunitready(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_SANITIZE); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==0 NO_FLUSH==1 START==0"); @@ -85,7 +89,8 @@ test_startstopunit_noloej(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); - ret = testunitready(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_SANITIZE); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==0 NO_FLUSH==1 START==1"); @@ -95,7 +100,8 @@ test_startstopunit_noloej(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); - ret = testunitready(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_SANITIZE); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==1 NO_FLUSH==1 START==0"); @@ -105,7 +111,8 @@ test_startstopunit_noloej(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); - ret = testunitready(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_SANITIZE); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==1 NO_FLUSH==1 START==1"); @@ -115,7 +122,8 @@ test_startstopunit_noloej(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); - ret = testunitready(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_SANITIZE); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_startstopunit_pwrcnd.c b/test-tool/test_startstopunit_pwrcnd.c index 1abf681..f571ce9 100644 --- a/test-tool/test_startstopunit_pwrcnd.c +++ b/test-tool/test_startstopunit_pwrcnd.c @@ -46,7 +46,8 @@ test_startstopunit_pwrcnd(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); - ret = testunitready(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_SANITIZE); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_startstopunit_simple.c b/test-tool/test_startstopunit_simple.c index 7326a39..be391fc 100644 --- a/test-tool/test_startstopunit_simple.c +++ b/test-tool/test_startstopunit_simple.c @@ -52,7 +52,8 @@ test_startstopunit_simple(void) logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is ejected."); - ret = testunitready_nomedium(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_NO_MEDIUM); CU_ASSERT_EQUAL(ret, 0); @@ -63,7 +64,8 @@ test_startstopunit_simple(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can read from the media."); - ret = testunitready(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_SANITIZE); CU_ASSERT_EQUAL(ret, 0); @@ -76,7 +78,8 @@ test_startstopunit_simple(void) logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is ejected."); - ret = testunitready_nomedium(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_NO_MEDIUM); CU_ASSERT_EQUAL(ret, 0); @@ -87,6 +90,7 @@ test_startstopunit_simple(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can access the media again."); - ret = testunitready(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_SANITIZE); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_testunitready_simple.c b/test-tool/test_testunitready_simple.c index d01e521..443949a 100644 --- a/test-tool/test_testunitready_simple.c +++ b/test-tool/test_testunitready_simple.c @@ -30,6 +30,7 @@ test_testunitready_simple(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test TESTUNITREADY"); - ret = testunitready(iscsic, tgt_lun); + ret = testunitready(iscsic, tgt_lun, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); }