accel_perf: update program exit code to reflect non-fatal errors

For use by test scripts to know when there was a non-fatal error.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I1c5e37edb13570aec1e186fe534ed6780a6de0c5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6324
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
paul luse 2021-02-08 12:19:29 -05:00 committed by Tomasz Zawadzki
parent 445fe74ef5
commit 9b18966796

View File

@ -47,6 +47,7 @@
static uint64_t g_tsc_rate; static uint64_t g_tsc_rate;
static uint64_t g_tsc_us_rate; static uint64_t g_tsc_us_rate;
static uint64_t g_tsc_end; static uint64_t g_tsc_end;
static int g_rc;
static int g_xfer_size_bytes = 4096; static int g_xfer_size_bytes = 4096;
static int g_queue_depth = 32; static int g_queue_depth = 32;
static int g_ops_per_batch = 0; static int g_ops_per_batch = 0;
@ -218,7 +219,7 @@ unregister_worker(void *arg1)
assert(g_num_workers >= 1); assert(g_num_workers >= 1);
if (--g_num_workers == 0) { if (--g_num_workers == 0) {
pthread_mutex_unlock(&g_workers_lock); pthread_mutex_unlock(&g_workers_lock);
dump_result(); g_rc = dump_result();
spdk_app_stop(0); spdk_app_stop(0);
} }
pthread_mutex_unlock(&g_workers_lock); pthread_mutex_unlock(&g_workers_lock);
@ -904,14 +905,13 @@ main(int argc, char **argv)
{ {
struct spdk_app_opts opts = {}; struct spdk_app_opts opts = {};
struct worker_thread *worker, *tmp; struct worker_thread *worker, *tmp;
int rc = 0;
pthread_mutex_init(&g_workers_lock, NULL); pthread_mutex_init(&g_workers_lock, NULL);
spdk_app_opts_init(&opts, sizeof(opts)); spdk_app_opts_init(&opts, sizeof(opts));
opts.reactor_mask = "0x1"; opts.reactor_mask = "0x1";
if (spdk_app_parse_args(argc, argv, &opts, "o:q:t:yw:P:f:b:T:", NULL, parse_args, if (spdk_app_parse_args(argc, argv, &opts, "o:q:t:yw:P:f:b:T:", NULL, parse_args,
usage) != SPDK_APP_PARSE_ARGS_SUCCESS) { usage) != SPDK_APP_PARSE_ARGS_SUCCESS) {
rc = -1; g_rc = -1;
goto cleanup; goto cleanup;
} }
@ -921,20 +921,20 @@ main(int argc, char **argv)
(g_workload_selection != ACCEL_COMPARE) && (g_workload_selection != ACCEL_COMPARE) &&
(g_workload_selection != ACCEL_DUALCAST)) { (g_workload_selection != ACCEL_DUALCAST)) {
usage(); usage();
rc = -1; g_rc = -1;
goto cleanup; goto cleanup;
} }
if (g_ops_per_batch > 0 && (g_queue_depth % g_ops_per_batch > 0)) { if (g_ops_per_batch > 0 && (g_queue_depth % g_ops_per_batch > 0)) {
fprintf(stdout, "batch size must be a multiple of queue depth\n"); fprintf(stdout, "batch size must be a multiple of queue depth\n");
usage(); usage();
rc = -1; g_rc = -1;
goto cleanup; goto cleanup;
} }
dump_user_config(&opts); dump_user_config(&opts);
rc = spdk_app_start(&opts, accel_perf_start, NULL); g_rc = spdk_app_start(&opts, accel_perf_start, NULL);
if (rc) { if (g_rc) {
SPDK_ERRLOG("ERROR starting application\n"); SPDK_ERRLOG("ERROR starting application\n");
} }
@ -948,5 +948,5 @@ main(int argc, char **argv)
} }
cleanup: cleanup:
spdk_app_fini(); spdk_app_fini();
return rc; return g_rc;
} }