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:
@@ -90,7 +90,10 @@ test_write10_residuals(void)
|
||||
iscsi_set_noautoreconnect(sd->iscsi_ctx, 1);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(write10_residuals); i++) {
|
||||
write_residuals_test(&write10_residuals[i]);
|
||||
bool command_is_implemented;
|
||||
|
||||
write_residuals_test(&write10_residuals[i],
|
||||
&command_is_implemented);
|
||||
|
||||
if (!command_is_implemented) {
|
||||
CU_PASS("WRITE10 is not implemented.");
|
||||
|
||||
@@ -90,7 +90,10 @@ test_write12_residuals(void)
|
||||
iscsi_set_noautoreconnect(sd->iscsi_ctx, 1);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(write12_residuals); i++) {
|
||||
write_residuals_test(&write12_residuals[i]);
|
||||
bool command_is_implemented;
|
||||
|
||||
write_residuals_test(&write12_residuals[i],
|
||||
&command_is_implemented);
|
||||
|
||||
if (!command_is_implemented) {
|
||||
CU_PASS("WRITE12 is not implemented.");
|
||||
|
||||
@@ -90,7 +90,10 @@ test_write16_residuals(void)
|
||||
iscsi_set_noautoreconnect(sd->iscsi_ctx, 1);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(write16_residuals); i++) {
|
||||
write_residuals_test(&write16_residuals[i]);
|
||||
bool command_is_implemented;
|
||||
|
||||
write_residuals_test(&write16_residuals[i],
|
||||
&command_is_implemented);
|
||||
|
||||
if (!command_is_implemented) {
|
||||
CU_PASS("WRITE16 is not implemented.");
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -45,7 +45,7 @@ struct task_status {
|
||||
struct scsi_sense sense;
|
||||
};
|
||||
|
||||
extern bool command_is_implemented;
|
||||
extern void write_residuals_test (const struct residuals_test_data *tdata);
|
||||
void write_residuals_test(const struct residuals_test_data *tdata,
|
||||
bool *command_is_implemented);
|
||||
|
||||
#endif /* _ISCSI_TESTS_WRITE_RESIDUALS_H_ */
|
||||
|
||||
Reference in New Issue
Block a user