test-tool/test_async_lu_reset_simple: Move an assert statement
In the test iSCSI.iSCSITMF.LUNResetSimpleAsync CU_ASSERT_EQUAL(reconnect_succeeded, 1) must be called after the async TMF command completes. Hence move that assert into the TMF completion callback. This patch fixes a race condition. [bvanassche: edited commit message]
This commit is contained in:
committed by
Bart Van Assche
parent
b5cd42e103
commit
5553d6bddf
@@ -66,6 +66,7 @@ test_async_reset_cb(struct iscsi_context *iscsi __attribute__((unused)),
|
|||||||
|
|
||||||
/* command_data NULL if a reconnect occured. see iscsi_reconnect_cb() */
|
/* command_data NULL if a reconnect occured. see iscsi_reconnect_cb() */
|
||||||
reconnect_succeeded = command_data != NULL;
|
reconnect_succeeded = command_data != NULL;
|
||||||
|
CU_ASSERT_EQUAL(reconnect_succeeded, 1);
|
||||||
if (!reconnect_succeeded)
|
if (!reconnect_succeeded)
|
||||||
return;
|
return;
|
||||||
tmf_response = *(uint32_t *)command_data;
|
tmf_response = *(uint32_t *)command_data;
|
||||||
@@ -153,9 +154,6 @@ test_async_lu_reset_simple(void)
|
|||||||
0xffffffff, 0,
|
0xffffffff, 0,
|
||||||
test_async_reset_cb, &state);
|
test_async_reset_cb, &state);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
CU_ASSERT_EQUAL(reconnect_succeeded, 1);
|
|
||||||
if (!reconnect_succeeded)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "LU RESET queued");
|
logging(LOG_VERBOSE, "LU RESET queued");
|
||||||
|
|
||||||
@@ -197,8 +195,6 @@ test_async_lu_reset_simple(void)
|
|||||||
CU_FAIL("unexpected WRITE/RESET state");
|
CU_FAIL("unexpected WRITE/RESET state");
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
|
||||||
|
|
||||||
/* Avoid that callbacks get invoked after this test finished */
|
/* Avoid that callbacks get invoked after this test finished */
|
||||||
iscsi_logout_sync(sd->iscsi_ctx);
|
iscsi_logout_sync(sd->iscsi_ctx);
|
||||||
iscsi_destroy_context(sd->iscsi_ctx);
|
iscsi_destroy_context(sd->iscsi_ctx);
|
||||||
|
|||||||
Reference in New Issue
Block a user