test/ioat: ioat_perf app will exit with error code

This change will make sure that ioat_perf application
exits with error code 1 whenever there was
no test performed.

Mainly by checking number of ioat channels available.
Other changes made to align with returning 1 on error.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Id94fa947fd097d5085285d3348aeb41ff280e731
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1672
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
Tomasz Zawadzki 2020-04-03 03:46:11 -04:00
parent 5a48cd9690
commit 454ff1726b

View File

@ -164,7 +164,7 @@ register_workers(void)
worker = calloc(1, sizeof(*worker));
if (worker == NULL) {
fprintf(stderr, "Unable to allocate worker\n");
return -1;
return 1;
}
worker->core = i;
@ -341,7 +341,7 @@ submit_xfers(struct ioat_chan_entry *ioat_chan_entry, uint64_t queue_depth)
ioat_task = spdk_mempool_get(ioat_chan_entry->task_pool);
if (!ioat_task) {
fprintf(stderr, "Unable to get ioat_task\n");
return -1;
return 1;
}
submit_single_xfer(ioat_chan_entry, ioat_task, dst, src);
@ -365,8 +365,8 @@ work_fn(void *arg)
/* begin to submit transfers */
t->waiting_for_flush = 0;
t->flush_threshold = g_user_config.queue_depth / 2;
if (submit_xfers(t, g_user_config.queue_depth) < 0) {
return -1;
if (submit_xfers(t, g_user_config.queue_depth) != 0) {
return 1;
}
t = t->next;
}
@ -403,7 +403,7 @@ init(void)
opts.name = "ioat_perf";
opts.core_mask = g_user_config.core_mask;
if (spdk_env_init(&opts) < 0) {
return -1;
return 1;
}
return 0;
@ -478,7 +478,7 @@ associate_workers_with_chan(void)
while (chan != NULL) {
t = calloc(1, sizeof(struct ioat_chan_entry));
if (!t) {
return -1;
return 1;
}
t->ioat_chan_id = i;
@ -534,18 +534,18 @@ main(int argc, char **argv)
}
if (register_workers() != 0) {
rc = -1;
rc = 1;
goto cleanup;
}
if (ioat_init() != 0) {
rc = -1;
rc = 1;
goto cleanup;
}
if (g_ioat_chan_num == 0) {
printf("No channels found\n");
rc = 0;
rc = 1;
goto cleanup;
}
@ -560,7 +560,7 @@ main(int argc, char **argv)
dump_user_config(&g_user_config);
if (associate_workers_with_chan() != 0) {
rc = -1;
rc = 1;
goto cleanup;
}
@ -580,7 +580,7 @@ main(int argc, char **argv)
assert(master_worker != NULL);
rc = work_fn(master_worker);
if (rc < 0) {
if (rc != 0) {
goto cleanup;
}