test-tool: Improve reliability of status_is_invalid_opcode()

The test_report_supported_opcodes_one_command() sends SCSI commands
to the target for which the target has to reply with ILLEGAL REQUEST
/ INVALID FIELD IN CDB. Avoid that such a reply is misinterpret as
"command not supported" by checking the field offset in the sense
descriptor. See also patch "test tool: Detect unsupported opcodes
correctly" (commit ID fe9620092c).

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
This commit is contained in:
Bart Van Assche
2015-04-21 14:14:11 +02:00
committed by Ronnie Sahlberg
parent 8435f9722e
commit 52a57d26f2

View File

@@ -135,7 +135,8 @@ static int status_is_invalid_opcode(struct scsi_task *task)
switch (task->sense.ascq) {
case SCSI_SENSE_ASCQ_INVALID_FIELD_IN_CDB:
case SCSI_SENSE_ASCQ_INVALID_FIELD_IN_PARAMETER_LIST:
return 1;
return !task->sense.sense_specific ||
task->sense.field_pointer == 1;
}
}
}