Merge pull request #171 from rodrigc/fix2
test_modesense6_control_swp: skip test if target cannot change swp
This commit is contained in:
@@ -2407,7 +2407,9 @@ int set_swp(struct scsi_device *sdev)
|
|||||||
struct scsi_mode_page *mp;
|
struct scsi_mode_page *mp;
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Read CONTROL page");
|
logging(LOG_VERBOSE, "Read CONTROL page");
|
||||||
ret = modesense6(sdev, &sense_task, 1, SCSI_MODESENSE_PC_CURRENT,
|
|
||||||
|
/* see if we can even change swp */
|
||||||
|
ret = modesense6(sdev, &sense_task, 1, SCSI_MODESENSE_PC_CHANGEABLE,
|
||||||
SCSI_MODEPAGE_CONTROL, 0, 255,
|
SCSI_MODEPAGE_CONTROL, 0, 255,
|
||||||
EXPECT_STATUS_GOOD);
|
EXPECT_STATUS_GOOD);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
@@ -2423,6 +2425,12 @@ int set_swp(struct scsi_device *sdev)
|
|||||||
ret = -1;
|
ret = -1;
|
||||||
goto finished;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
/* if we cannot change swp, we are done here */
|
||||||
|
if (ms->pages->control.swp == 0) {
|
||||||
|
logging(LOG_NORMAL, "SWP is not changeable");
|
||||||
|
ret = -2;
|
||||||
|
goto finished;
|
||||||
|
}
|
||||||
mp = scsi_modesense_get_page(ms, SCSI_MODEPAGE_CONTROL, 0);
|
mp = scsi_modesense_get_page(ms, SCSI_MODEPAGE_CONTROL, 0);
|
||||||
if (mp == NULL) {
|
if (mp == NULL) {
|
||||||
logging(LOG_NORMAL, "failed to read control mode page");
|
logging(LOG_NORMAL, "failed to read control mode page");
|
||||||
|
|||||||
@@ -43,6 +43,10 @@ test_modesense6_control_swp(void)
|
|||||||
|
|
||||||
logging(LOG_VERBOSE, "Set SWP to enable write protect");
|
logging(LOG_VERBOSE, "Set SWP to enable write protect");
|
||||||
ret = set_swp(sd);
|
ret = set_swp(sd);
|
||||||
|
if (ret == -2) {
|
||||||
|
CU_PASS("[SKIPPED] Target does not support changing SWP");
|
||||||
|
return;
|
||||||
|
}
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
goto finished;
|
goto finished;
|
||||||
|
|||||||
Reference in New Issue
Block a user