bdevperf: print error message and exit when no bdevs found

While here, don't print out empty performance data if the
test run failed (for example, if no bdevs were found).  Also
remove superfluous "done" message at the end of main - it
really serves no purpose and looks silly especially if the
test failed.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I19c678bee9079f6aa453a4b925819a5ea27f6534

Reviewed-on: https://review.gerrithub.io/414064
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Jim Harris 2018-06-06 03:54:00 -07:00
parent 8cb3341e83
commit 1fd0107026

View File

@ -711,6 +711,12 @@ bdevperf_run(void *arg1, void *arg2)
bdevperf_construct_targets();
if (g_target_count == 0) {
fprintf(stderr, "No valid bdevs found.\n");
spdk_app_stop(1);
return;
}
rc = bdevperf_construct_targets_tasks();
if (rc) {
blockdev_heads_destroy();
@ -980,13 +986,14 @@ main(int argc, char **argv)
}
if (g_time_in_usec) {
performance_dump(g_time_in_usec, 0);
if (!g_run_failed) {
performance_dump(g_time_in_usec, 0);
}
} else {
printf("Test time less than one microsecond, no performance data will be shown\n");
}
blockdev_heads_destroy();
spdk_app_fini();
printf("done.\n");
return g_run_failed;
}