test-tool: Change command_is_implemented from a global variable into an argument

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
This commit is contained in:
Bart Van Assche
2021-02-08 19:01:31 -08:00
parent c7a9f51d23
commit f87a5adaa0
5 changed files with 19 additions and 9 deletions

View File

@@ -29,10 +29,9 @@
#include "iscsi-test-cu.h"
#include "test_write_residuals.h"
bool command_is_implemented = true;
void
write_residuals_test(const struct residuals_test_data *tdata)
write_residuals_test(const struct residuals_test_data *tdata,
bool *command_is_implemented)
{
struct iscsi_data data;
struct scsi_task *task_ret;
@@ -49,6 +48,8 @@ write_residuals_test(const struct residuals_test_data *tdata)
logging(LOG_VERBOSE, "\n%s", tdata->description);
*command_is_implemented = true;
switch (tdata->cdb_size) {
case 10:
scsi_opcode_write = SCSI_OPCODE_WRITE10;
@@ -122,7 +123,7 @@ write_residuals_test(const struct residuals_test_data *tdata)
task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST &&
task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
logging(LOG_NORMAL, "[SKIPPED] WRITE%zu is not implemented.", tdata->cdb_size);
command_is_implemented = false;
*command_is_implemented = false;
scsi_free_scsi_task(task);
task = NULL;
return;