test-tool: Fix a few sporadic crashes

Avoid that Valgrind reports complaints similar to the following:

Conditional jump or move depends on uninitialised value(s)
   at 0x405097: send_scsi_command (iscsi-support.c:240)
   by 0x40904B: reserve6_conflict (iscsi-support.c:1915)
   by 0x42231C: test_reserve6_logout (test_reserve6_logout.c:63)
   by 0x503EC99: ??? (in /usr/lib/libcunit.so.1.0.1)
   by 0x503EF27: ??? (in /usr/lib/libcunit.so.1.0.1)
   by 0x503F2A5: CU_run_all_tests (in /usr/lib/libcunit.so.1.0.1)
   by 0x404B43: main (iscsi-test-cu.c:1292)

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
This commit is contained in:
Bart Van Assche
2015-04-03 13:52:05 +02:00
committed by Ronnie Sahlberg
parent 1a0897ae10
commit dbc4e33db2
7 changed files with 7 additions and 0 deletions

View File

@@ -59,6 +59,7 @@ test_preventallow_2_itnexuses(void)
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Create a second connection to the target");
memset(&sd2, 0, sizeof(sd2));
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd->iscsi_lun);
if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target");

View File

@@ -53,6 +53,7 @@ test_reserve6_itnexus_loss(void)
logging(LOG_VERBOSE, "Create a second connection to the target");
memset(&sd2, 0, sizeof(sd2));
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target");

View File

@@ -53,6 +53,7 @@ test_reserve6_logout(void)
logging(LOG_VERBOSE, "Create a second connection to the target");
memset(&sd2, 0, sizeof(sd2));
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target");

View File

@@ -64,6 +64,7 @@ test_reserve6_lun_reset(void)
logging(LOG_VERBOSE, "Create a second connection to the target");
memset(&sd2, 0, sizeof(sd2));
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target");

View File

@@ -63,6 +63,7 @@ test_reserve6_target_cold_reset(void)
sleep(3);
logging(LOG_VERBOSE, "Create a second connection to the target");
memset(&sd2, 0, sizeof(sd2));
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target");

View File

@@ -64,6 +64,7 @@ test_reserve6_target_warm_reset(void)
logging(LOG_VERBOSE, "Create a second connection to the target");
memset(&sd2, 0, sizeof(sd2));
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target");

View File

@@ -49,6 +49,7 @@ test_sanitize_reservations(void)
}
logging(LOG_VERBOSE, "Create a second connection to the target");
memset(&sd2, 0, sizeof(sd2));
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target");