diff --git a/test-tool/iscsi-support.h b/test-tool/iscsi-support.h index 3830f9e..b301b6f 100644 --- a/test-tool/iscsi-support.h +++ b/test-tool/iscsi-support.h @@ -418,7 +418,7 @@ do { \ } while (0); #define RECEIVE_COPY_RESULTS(...) \ - do { \ + ({ \ int _r; \ _r = receive_copy_results(__VA_ARGS__); \ if (_r == -2) { \ @@ -429,7 +429,8 @@ do { \ return; \ } \ CU_ASSERT_EQUAL(_r, 0); \ - } while (0); + _r; \ + }) #define RELEASE6(...) \ do { \ diff --git a/test-tool/test_async_read.c b/test-tool/test_async_read.c index 5d0e155..45850ac 100644 --- a/test-tool/test_async_read.c +++ b/test-tool/test_async_read.c @@ -60,27 +60,29 @@ test_async_read(void) { int i, ret; struct tests_async_read_state state = { 0, 0, 0 }; - int blocksize = 512; - int blocks_per_io = 8; - int num_ios = 1000; + const int blocksize = 512; + const int blocks_per_io = 8; + const int num_ios = 1000; /* IOs in flight concurrently, so need a buffer large enough for all */ - unsigned char buf[blocksize * blocks_per_io * num_ios]; + unsigned char *buf = calloc(blocksize * blocks_per_io, num_ios); + + CU_ASSERT_NOT_EQUAL(buf, NULL); + if (!buf) + goto out; CHECK_FOR_DATALOSS; CHECK_FOR_SBC; if (sd->iscsi_ctx == NULL) { CU_PASS("[SKIPPED] Non-iSCSI"); - return; + goto out; } if (maximum_transfer_length && (maximum_transfer_length < (blocks_per_io * num_ios))) { CU_PASS("[SKIPPED] device too small for async_read test"); - return; + goto out; } - memset(buf, 0, blocksize * blocks_per_io * num_ios); - for (i = 0; i < num_ios; i++) { uint32_t lba = i * blocks_per_io; struct scsi_task *atask; @@ -116,4 +118,7 @@ test_async_read(void) ret = iscsi_service(sd->iscsi_ctx, pfd.revents); CU_ASSERT_EQUAL(ret, 0); } + +out: + free(buf); } diff --git a/test-tool/test_receive_copy_results_op_params.c b/test-tool/test_receive_copy_results_op_params.c index 2ee0b99..6d1e76a 100644 --- a/test-tool/test_receive_copy_results_op_params.c +++ b/test-tool/test_receive_copy_results_op_params.c @@ -32,14 +32,16 @@ test_receive_copy_results_op_params(void) { struct scsi_task *op_task = NULL; struct scsi_copy_results_op_params *opp; + int ret; logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test RECEIVE COPY RESULTS, OPERATING PARAMS"); - RECEIVE_COPY_RESULTS(&op_task, sd, SCSI_COPY_RESULTS_OP_PARAMS, 0, - (void **)&opp, EXPECT_STATUS_GOOD); + ret = RECEIVE_COPY_RESULTS(&op_task, sd, SCSI_COPY_RESULTS_OP_PARAMS, 0, + (void **)&opp, EXPECT_STATUS_GOOD); - logging(LOG_NORMAL, + if (ret == 0) + logging(LOG_NORMAL, "max_target_desc=%d, max_seg_desc=%d", opp->max_target_desc_count, opp->max_segment_desc_count); diff --git a/test-tool/test_reserve6_itnexus_loss.c b/test-tool/test_reserve6_itnexus_loss.c index 17239fe..1b55236 100644 --- a/test-tool/test_reserve6_itnexus_loss.c +++ b/test-tool/test_reserve6_itnexus_loss.c @@ -59,7 +59,7 @@ test_reserve6_itnexus_loss(void) logging(LOG_VERBOSE, "Disconnect from the target."); iscsi_destroy_context(sd->iscsi_ctx); - logging(LOG_VERBOSE, "Sleep for three seconds incase the target is slow to reset"); + logging(LOG_VERBOSE, "Sleep for three seconds in case the target is slow to reset"); sleep(3); logging(LOG_VERBOSE, "Reconnect to target"); diff --git a/test-tool/test_reserve6_lun_reset.c b/test-tool/test_reserve6_lun_reset.c index 3d6b6ea..a645960 100644 --- a/test-tool/test_reserve6_lun_reset.c +++ b/test-tool/test_reserve6_lun_reset.c @@ -53,7 +53,7 @@ test_reserve6_lun_reset(void) } CU_ASSERT_EQUAL(ret, 0); - logging(LOG_VERBOSE, "Sleep for three seconds incase the target is slow to reset"); + logging(LOG_VERBOSE, "Sleep for three seconds in case the target is slow to reset"); sleep(3); diff --git a/test-tool/test_reserve6_target_cold_reset.c b/test-tool/test_reserve6_target_cold_reset.c index 9e38413..29b5021 100644 --- a/test-tool/test_reserve6_target_cold_reset.c +++ b/test-tool/test_reserve6_target_cold_reset.c @@ -56,7 +56,7 @@ test_reserve6_target_cold_reset(void) return; } - logging(LOG_VERBOSE, "Sleep for three seconds incase the target is slow to reset"); + logging(LOG_VERBOSE, "Sleep for three seconds in case the target is slow to reset"); sleep(3); logging(LOG_VERBOSE, "Create a second connection to the target"); diff --git a/test-tool/test_reserve6_target_warm_reset.c b/test-tool/test_reserve6_target_warm_reset.c index 2f58763..346d1ca 100644 --- a/test-tool/test_reserve6_target_warm_reset.c +++ b/test-tool/test_reserve6_target_warm_reset.c @@ -56,10 +56,9 @@ test_reserve6_target_warm_reset(void) return; } - logging(LOG_VERBOSE, "Sleep for three seconds incase the target is slow to reset"); + logging(LOG_VERBOSE, "Sleep for three seconds in case the target is slow to reset"); sleep(3); - logging(LOG_VERBOSE, "Create a second connection to the target"); ret = mpath_sd2_get_or_clone(sd, &sd2); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_sanitize_reset.c b/test-tool/test_sanitize_reset.c index c6199f3..fcbf248 100644 --- a/test-tool/test_sanitize_reset.c +++ b/test-tool/test_sanitize_reset.c @@ -89,7 +89,7 @@ test_sanitize_reset(void) } - logging(LOG_VERBOSE, "Sleep for three seconds incase the target is " + logging(LOG_VERBOSE, "Sleep for three seconds in case the target is " "slow to start the SANITIZE"); sleep(3); @@ -151,7 +151,7 @@ test_sanitize_reset(void) logging(LOG_VERBOSE, "Disconnect from the target."); iscsi_destroy_context(sd->iscsi_ctx); - logging(LOG_VERBOSE, "Sleep for one seconds incase the target is " + logging(LOG_VERBOSE, "Sleep for one seconds in case the target is " "slow to reset"); sleep(1);