diff --git a/test-tool/iscsi-support.c b/test-tool/iscsi-support.c index 61ff4de..97b9ad9 100644 --- a/test-tool/iscsi-support.c +++ b/test-tool/iscsi-support.c @@ -65,6 +65,9 @@ int write_protect_ascqs[1] = { int sanitize_ascqs[1] = { SCSI_SENSE_ASCQ_SANITIZE_IN_PROGRESS }; +int removal_ascqs[1] = { + SCSI_SENSE_ASCQ_MEDIUM_REMOVAL_PREVENTED +}; struct scsi_inquiry_standard *inq; struct scsi_inquiry_logical_block_provisioning *inq_lbp; @@ -1347,101 +1350,27 @@ int sanitize_writeprotected(struct iscsi_context *iscsi, int lun, int immed, int return 0; } -int startstopunit(struct iscsi_context *iscsi, int lun, int immed, int pcm, int pc, int no_flush, int loej, int start) +int startstopunit(struct iscsi_context *iscsi, int lun, int immed, int pcm, int pc, int no_flush, int loej, int start, int status, enum scsi_sense_key key, int *ascq, int num_ascq) { struct scsi_task *task; + int ret; - logging(LOG_VERBOSE, "Send STARTSTOPUNIT IMMED:%d PCM:%d PC:%d NO_FLUSH:%d LOEJ:%d START:%d", immed, pcm, pc, no_flush, loej, start); - task = iscsi_startstopunit_sync(iscsi, lun, immed, pcm, pc, no_flush, - loej, start); - if (task == NULL) { - logging(LOG_NORMAL, - "[FAILED] Failed to send STARTSTOPUNIT command: %s", - iscsi_get_error(iscsi)); - return -1; - } - if (task->status != SCSI_STATUS_GOOD) { - logging(LOG_NORMAL, - "[FAILED] STARTSTOPUNIT 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] STARTSTOPUNIT returned SUCCESS."); - return 0; -} - -int startstopunit_preventremoval(struct iscsi_context *iscsi, int lun, int immed, int pcm, int pc, int no_flush, int loej, int start) -{ - struct scsi_task *task; - - logging(LOG_VERBOSE, "Send STARTSTOPUNIT (Expecting MEDIUM_REMOVAL_PREVENTED) " - "IMMED:%d PCM:%d PC:%d NO_FLUSH:%d LOEJ:%d START:%d", + logging(LOG_VERBOSE, "Send STARTSTOPUNIT (Expecting %s) IMMED:%d " + "PCM:%d PC:%d NO_FLUSH:%d LOEJ:%d START:%d", + scsi_status_str(status), immed, pcm, pc, no_flush, loej, start); - task = iscsi_startstopunit_sync(iscsi, lun, immed, pcm, pc, no_flush, - loej, start); - if (task == NULL) { - logging(LOG_NORMAL, - "[FAILED] Failed to send STARTSTOPUNIT command: %s", - iscsi_get_error(iscsi)); - return -1; - } - if (task->status == SCSI_STATUS_GOOD) { - logging(LOG_NORMAL, - "[FAILED] STARTSTOPUNIT successful but should have failed with ILLEGAL_REQUEST/MEDIUM_REMOVAL_PREVENTED"); - scsi_free_scsi_task(task); - return -1; - } - if (task->status != SCSI_STATUS_CHECK_CONDITION - || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST - || task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_REMOVAL_PREVENTED) { - logging(LOG_NORMAL, "[FAILED] STARTSTOPUNIT Should have failed " - "with ILLEGAL_REQUEST/MEDIUM_REMOVAL_PREVENTED But failed " - "with %s", iscsi_get_error(iscsi)); - scsi_free_scsi_task(task); - return -1; - } - scsi_free_scsi_task(task); - logging(LOG_VERBOSE, "[OK] STARTSTOPUNIT returned MEDIUM_REMOVAL_PREVENTED."); - return 0; -} + task = scsi_cdb_startstopunit(immed, pcm, pc, no_flush, loej, start); + assert(task != NULL); -int startstopunit_sanitize(struct iscsi_context *iscsi, int lun, int immed, int pcm, int pc, int no_flush, int loej, int start) -{ - struct scsi_task *task; + task = iscsi_scsi_command_sync(iscsi, lun, task, NULL); - logging(LOG_VERBOSE, "Send STARTSTOPUNIT (Expecting SANITIZE_IN_PROGRESS) " - "IMMED:%d PCM:%d PC:%d NO_FLUSH:%d LOEJ:%d START:%d", - immed, pcm, pc, no_flush, loej, start); - - task = iscsi_startstopunit_sync(iscsi, lun, immed, pcm, pc, no_flush, - loej, start); - if (task == NULL) { - logging(LOG_NORMAL, - "[FAILED] Failed to send STARTSTOPUNIT command: %s", - iscsi_get_error(iscsi)); - return -1; - } - if (task->status == SCSI_STATUS_GOOD) { - logging(LOG_NORMAL, - "[FAILED] STARTSTOPUNIT successful but should have failed with NOT_READY/SANITIZE_IN_PROGRESS"); + ret = check_result("STARTSTOPUNIT", iscsi, task, status, key, ascq, + num_ascq); + if (task) { 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] STARTSTOPUNIT 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] STARTSTOPUNIT returned SANITIZE_IN_PROGRESS."); - return 0; + return ret; } int diff --git a/test-tool/iscsi-support.h b/test-tool/iscsi-support.h index db36c19..9662e55 100644 --- a/test-tool/iscsi-support.h +++ b/test-tool/iscsi-support.h @@ -36,12 +36,14 @@ extern const char *tgt_url; #define EXPECT_MISCOMPARE SCSI_STATUS_CHECK_CONDITION, SCSI_SENSE_MISCOMPARE, 0, 0 #define EXPECT_WRITE_PROTECTED SCSI_STATUS_CHECK_CONDITION, SCSI_SENSE_DATA_PROTECTION, write_protect_ascqs, 1 #define EXPECT_SANITIZE SCSI_STATUS_CHECK_CONDITION, SCSI_SENSE_NOT_READY, sanitize_ascqs, 1 +#define EXPECT_REMOVAL_PREVENTED SCSI_STATUS_CHECK_CONDITION, SCSI_SENSE_ILLEGAL_REQUEST, removal_ascqs, 1 int no_medium_ascqs[3]; int lba_oob_ascqs[1]; int invalid_cdb_ascqs[1]; int write_protect_ascqs[1]; int sanitize_ascqs[1]; +int removal_ascqs[1]; extern int loglevel; #define LOG_SILENT 0 @@ -280,9 +282,7 @@ int sanitize(struct iscsi_context *iscsi, int lun, int immed, int ause, int sa, int sanitize_conflict(struct iscsi_context *iscsi, int lun, int immed, int ause, int sa, int param_len, struct iscsi_data *data); int sanitize_invalidfieldincdb(struct iscsi_context *iscsi, int lun, int immed, int ause, int sa, int param_len, struct iscsi_data *data); int sanitize_writeprotected(struct iscsi_context *iscsi, int lun, int immed, int ause, int sa, int param_len, struct iscsi_data *data); -int startstopunit(struct iscsi_context *iscsi, int lun, int immed, int pcm, int pc, int no_flush, int loej, int start); -int startstopunit_sanitize(struct iscsi_context *iscsi, int lun, int immed, int pcm, int pc, int no_flush, int loej, int start); -int startstopunit_preventremoval(struct iscsi_context *iscsi, int lun, int immed, int pcm, int pc, int no_flush, int loej, int start); +int startstopunit(struct iscsi_context *iscsi, int lun, int immed, int pcm, int pc, int no_flush, int loej, int start, int status, enum scsi_sense_key key, int *ascq, int num_ascq); int synchronizecache10(struct iscsi_context *iscsi, int lun, uint32_t lba, int num_blocks, int sync_nv, int immed); int synchronizecache10_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba, int num_blocks, int sync_nv, int immed); int synchronizecache16(struct iscsi_context *iscsi, int lun, uint64_t lba, int num_blocks, int sync_nv, int immed); diff --git a/test-tool/test_nomedia_sbc.c b/test-tool/test_nomedia_sbc.c index 47f63ec..6f4a147 100644 --- a/test-tool/test_nomedia_sbc.c +++ b/test-tool/test_nomedia_sbc.c @@ -43,7 +43,8 @@ test_nomedia_sbc(void) } logging(LOG_VERBOSE, "Eject the medium."); - ret = startstopunit(iscsic, tgt_lun, 1, 0, 0, 0, 1, 0); + ret = startstopunit(iscsic, tgt_lun, 1, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test TESTUNITREADY when medium is ejected."); @@ -270,6 +271,7 @@ test_nomedia_sbc(void) finished: logging(LOG_VERBOSE, "Load the medium again."); - ret = startstopunit(iscsic, tgt_lun, 1, 0, 0, 0, 1, 1); + ret = startstopunit(iscsic, tgt_lun, 1, 0, 0, 0, 1, 1, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_preventallow_2_itnexuses.c b/test-tool/test_preventallow_2_itnexuses.c index 49af325..e7a3f31 100644 --- a/test-tool/test_preventallow_2_itnexuses.c +++ b/test-tool/test_preventallow_2_itnexuses.c @@ -40,7 +40,8 @@ test_preventallow_2_itnexuses(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit_preventremoval(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + EXPECT_REMOVAL_PREVENTED); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can still access the media."); @@ -55,7 +56,8 @@ test_preventallow_2_itnexuses(void) } logging(LOG_VERBOSE, "Try to eject the medium on the second connection"); - ret = startstopunit_preventremoval(iscsic2, tgt_lun, 0, 0, 0, 0, 1, 0); + ret = startstopunit(iscsic2, tgt_lun, 0, 0, 0, 0, 1, 0, + EXPECT_REMOVAL_PREVENTED); CU_ASSERT_EQUAL(ret, 0); @@ -71,7 +73,8 @@ test_preventallow_2_itnexuses(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 1); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 1, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_preventallow_cold_reset.c b/test-tool/test_preventallow_cold_reset.c index 817b841..87ee6f1 100644 --- a/test-tool/test_preventallow_cold_reset.c +++ b/test-tool/test_preventallow_cold_reset.c @@ -40,7 +40,8 @@ test_preventallow_cold_reset(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit_preventremoval(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + EXPECT_REMOVAL_PREVENTED); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can still access the media."); @@ -56,7 +57,8 @@ test_preventallow_cold_reset(void) logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can not access the media."); @@ -64,7 +66,8 @@ test_preventallow_cold_reset(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -74,7 +77,8 @@ test_preventallow_cold_reset(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 1); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 1, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_preventallow_eject.c b/test-tool/test_preventallow_eject.c index 26da530..7fb6635 100644 --- a/test-tool/test_preventallow_eject.c +++ b/test-tool/test_preventallow_eject.c @@ -40,7 +40,8 @@ test_preventallow_eject(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit_preventremoval(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + EXPECT_REMOVAL_PREVENTED); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can still access the media."); @@ -52,7 +53,8 @@ test_preventallow_eject(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can not access the media."); @@ -64,7 +66,8 @@ test_preventallow_eject(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Try to load the medium"); - ret = startstopunit_preventremoval(iscsic, tgt_lun, 0, 0, 0, 0, 1, 1); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 1, + EXPECT_REMOVAL_PREVENTED); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Clear PREVENT flag"); @@ -72,7 +75,8 @@ test_preventallow_eject(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium again"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 1); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 1, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_preventallow_itnexus_loss.c b/test-tool/test_preventallow_itnexus_loss.c index 3c108a8..de9ed18 100644 --- a/test-tool/test_preventallow_itnexus_loss.c +++ b/test-tool/test_preventallow_itnexus_loss.c @@ -40,7 +40,8 @@ test_preventallow_itnexus_loss(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit_preventremoval(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + EXPECT_REMOVAL_PREVENTED); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can still access the media."); @@ -59,7 +60,8 @@ test_preventallow_itnexus_loss(void) } logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can not access the media."); @@ -67,7 +69,8 @@ test_preventallow_itnexus_loss(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -77,7 +80,8 @@ test_preventallow_itnexus_loss(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 1); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 1, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_preventallow_logout.c b/test-tool/test_preventallow_logout.c index e5cc02a..607477b 100644 --- a/test-tool/test_preventallow_logout.c +++ b/test-tool/test_preventallow_logout.c @@ -40,7 +40,8 @@ test_preventallow_logout(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit_preventremoval(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + EXPECT_REMOVAL_PREVENTED); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can still access the media."); @@ -60,7 +61,8 @@ test_preventallow_logout(void) } logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can not access the media."); @@ -68,7 +70,8 @@ test_preventallow_logout(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -78,7 +81,8 @@ test_preventallow_logout(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 1); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 1, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_preventallow_lun_reset.c b/test-tool/test_preventallow_lun_reset.c index fa1aa03..6ad6fab 100644 --- a/test-tool/test_preventallow_lun_reset.c +++ b/test-tool/test_preventallow_lun_reset.c @@ -40,7 +40,8 @@ test_preventallow_lun_reset(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit_preventremoval(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + EXPECT_REMOVAL_PREVENTED); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can still access the media."); @@ -56,7 +57,8 @@ test_preventallow_lun_reset(void) logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can not access the media."); @@ -64,7 +66,8 @@ test_preventallow_lun_reset(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -74,7 +77,7 @@ test_preventallow_lun_reset(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 1); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 1, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); - } diff --git a/test-tool/test_preventallow_warm_reset.c b/test-tool/test_preventallow_warm_reset.c index 7f9edc3..d39e82a 100644 --- a/test-tool/test_preventallow_warm_reset.c +++ b/test-tool/test_preventallow_warm_reset.c @@ -40,7 +40,8 @@ test_preventallow_warm_reset(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit_preventremoval(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + EXPECT_REMOVAL_PREVENTED); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can still access the media."); @@ -56,7 +57,8 @@ test_preventallow_warm_reset(void) logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can not access the media."); @@ -64,7 +66,8 @@ test_preventallow_warm_reset(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -74,7 +77,8 @@ test_preventallow_warm_reset(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 1); + ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 1, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_sanitize_reset.c b/test-tool/test_sanitize_reset.c index d8c5808..ff49752 100644 --- a/test-tool/test_sanitize_reset.c +++ b/test-tool/test_sanitize_reset.c @@ -91,7 +91,8 @@ test_sanitize_reset(void) logging(LOG_VERBOSE, "Verify that STARTSTOPUNIT fails with " "SANITIZE_IN_PROGRESS"); - ret = startstopunit_sanitize(iscsic, tgt_lun, 1, 0, 1, 0, 1, 0); + ret = startstopunit(iscsic, tgt_lun, 1, 0, 1, 0, 1, 0, + EXPECT_SANITIZE); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify that READ16 fails with " diff --git a/test-tool/test_startstopunit_noloej.c b/test-tool/test_startstopunit_noloej.c index 475e4ce..eca4f5a 100644 --- a/test-tool/test_startstopunit_noloej.c +++ b/test-tool/test_startstopunit_noloej.c @@ -40,7 +40,8 @@ test_startstopunit_noloej(void) logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==0 NO_FLUSH==0 START==0"); ret = startstopunit(iscsic, tgt_lun, - 0, 0, 0, 0, 0, 0); + 0, 0, 0, 0, 0, 0, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); @@ -49,7 +50,8 @@ test_startstopunit_noloej(void) logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==0 NO_FLUSH==0 START==1"); ret = startstopunit(iscsic, tgt_lun, - 0, 0, 0, 0, 0, 1); + 0, 0, 0, 0, 0, 1, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); @@ -58,7 +60,8 @@ test_startstopunit_noloej(void) logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==1 NO_FLUSH==0 START==0"); ret = startstopunit(iscsic, tgt_lun, - 1, 0, 0, 0, 0, 0); + 1, 0, 0, 0, 0, 0, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); @@ -67,7 +70,8 @@ test_startstopunit_noloej(void) logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==1 NO_FLUSH==0 START==1"); ret = startstopunit(iscsic, tgt_lun, - 1, 0, 0, 0, 0, 1); + 1, 0, 0, 0, 0, 1, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); @@ -76,7 +80,8 @@ test_startstopunit_noloej(void) logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==0 NO_FLUSH==1 START==0"); ret = startstopunit(iscsic, tgt_lun, - 0, 0, 0, 1, 0, 0); + 0, 0, 0, 1, 0, 0, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); @@ -85,7 +90,8 @@ test_startstopunit_noloej(void) logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==0 NO_FLUSH==1 START==1"); ret = startstopunit(iscsic, tgt_lun, - 0, 0, 0, 1, 0, 1); + 0, 0, 0, 1, 0, 1, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); @@ -94,7 +100,8 @@ test_startstopunit_noloej(void) logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==1 NO_FLUSH==1 START==0"); ret = startstopunit(iscsic, tgt_lun, - 1, 0, 0, 1, 0, 0); + 1, 0, 0, 1, 0, 0, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); @@ -103,7 +110,8 @@ test_startstopunit_noloej(void) logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==1 NO_FLUSH==1 START==1"); ret = startstopunit(iscsic, tgt_lun, - 1, 0, 0, 1, 0, 1); + 1, 0, 0, 1, 0, 1, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); @@ -112,5 +120,6 @@ test_startstopunit_noloej(void) logging(LOG_VERBOSE, "In case the target did eject the medium, load it again."); - startstopunit(iscsic, tgt_lun, 1, 0, 0, 0, 1, 1); + startstopunit(iscsic, tgt_lun, 1, 0, 0, 0, 1, 1, + EXPECT_STATUS_GOOD); } diff --git a/test-tool/test_startstopunit_pwrcnd.c b/test-tool/test_startstopunit_pwrcnd.c index f6a9342..1abf681 100644 --- a/test-tool/test_startstopunit_pwrcnd.c +++ b/test-tool/test_startstopunit_pwrcnd.c @@ -41,7 +41,8 @@ test_startstopunit_pwrcnd(void) logging(LOG_VERBOSE, "Test that media is not ejected when PC!=0"); for (i = 1; i < 16; i++) { ret = startstopunit(iscsic, tgt_lun, - 1, 0, i, 0, 1, 0); + 1, 0, i, 0, 1, 0, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected."); @@ -50,5 +51,6 @@ test_startstopunit_pwrcnd(void) } logging(LOG_VERBOSE, "In case the target did eject the medium, load it again."); - startstopunit(iscsic, tgt_lun, 1, 0, 0, 0, 1, 1); + startstopunit(iscsic, tgt_lun, 1, 0, 0, 0, 1, 1, + EXPECT_STATUS_GOOD); } diff --git a/test-tool/test_startstopunit_simple.c b/test-tool/test_startstopunit_simple.c index c7774fb..7326a39 100644 --- a/test-tool/test_startstopunit_simple.c +++ b/test-tool/test_startstopunit_simple.c @@ -42,7 +42,8 @@ test_startstopunit_simple(void) } ret = startstopunit(iscsic, tgt_lun, - 1, 0, 0, 0, 1, 0); + 1, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); if (!inq->rmb) { CU_ASSERT_NOT_EQUAL(ret, 0); return; @@ -57,7 +58,8 @@ test_startstopunit_simple(void) logging(LOG_VERBOSE, "Test we can load the removable the media with IMMED==1"); ret = startstopunit(iscsic, tgt_lun, - 1, 0, 0, 0, 1, 1); + 1, 0, 0, 0, 1, 1, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can read from the media."); @@ -68,7 +70,8 @@ test_startstopunit_simple(void) logging(LOG_VERBOSE, "Test we can eject removable the media with IMMED==1"); ret = startstopunit(iscsic, tgt_lun, - 0, 0, 0, 0, 1, 0); + 0, 0, 0, 0, 1, 0, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -79,7 +82,8 @@ test_startstopunit_simple(void) logging(LOG_VERBOSE, "Test we can load the removable the media with IMMED==1"); ret = startstopunit(iscsic, tgt_lun, - 0, 0, 0, 0, 1, 1); + 0, 0, 0, 0, 1, 1, + EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify we can access the media again.");