
From: Junchong Pan <panjunchong@h-partners.com> Add print help when dfx/benchmark/test input empty parameters. Signed-off-by: Junchong Pan <panjunchong@h-partners.com> --- uadk_tool/benchmark/uadk_benchmark.c | 6 +++--- uadk_tool/benchmark/uadk_benchmark.h | 1 + uadk_tool/uadk_tool.c | 10 +++++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/uadk_tool/benchmark/uadk_benchmark.c b/uadk_tool/benchmark/uadk_benchmark.c index dd2b22da..16980616 100644 --- a/uadk_tool/benchmark/uadk_benchmark.c +++ b/uadk_tool/benchmark/uadk_benchmark.c @@ -635,7 +635,7 @@ int acc_default_case(struct acc_option *option) return acc_benchmark_run(option); } -static void print_help(void) +void print_benchmark_help(void) { ACC_TST_PRT("NAME\n"); ACC_TST_PRT(" benchmark: test UADK acc performance,etc\n"); @@ -728,7 +728,7 @@ int acc_cmd_parse(int argc, char *argv[], struct acc_option *option) switch (c) { case 0: - print_help(); + print_benchmark_help(); goto to_exit; case 1: option->algtype = get_alg_type(optarg); @@ -791,7 +791,7 @@ int acc_cmd_parse(int argc, char *argv[], struct acc_option *option) break; default: ACC_TST_PRT("invalid: bad input parameter!\n"); - print_help(); + print_benchmark_help(); goto to_exit; } } diff --git a/uadk_tool/benchmark/uadk_benchmark.h b/uadk_tool/benchmark/uadk_benchmark.h index 0def4b9f..c4042355 100644 --- a/uadk_tool/benchmark/uadk_benchmark.h +++ b/uadk_tool/benchmark/uadk_benchmark.h @@ -225,5 +225,6 @@ int acc_cmd_parse(int argc, char *argv[], struct acc_option *option); int acc_default_case(struct acc_option *option); int acc_option_convert(struct acc_option *option); int acc_benchmark_run(struct acc_option *option); +void print_benchmark_help(void); #endif /* UADK_BENCHMARK_H */ diff --git a/uadk_tool/uadk_tool.c b/uadk_tool/uadk_tool.c index 63e6d0f4..64d41630 100644 --- a/uadk_tool/uadk_tool.c +++ b/uadk_tool/uadk_tool.c @@ -22,11 +22,16 @@ int main(int argc, char **argv) if (argc > index) { if (!strcmp("dfx", argv[index])) { + if (!argv[++index]) + print_dfx_help(); + dfx_cmd_parse(argc, argv); } else if (!strcmp("benchmark", argv[index])) { printf("start UADK benchmark test.\n"); - if (!argv[++index]) + if (!argv[++index]) { + print_benchmark_help(); acc_default_case(&option); + } ret = acc_cmd_parse(argc, argv, &option); if (ret) @@ -37,6 +42,9 @@ int main(int argc, char **argv) return ret; (void)acc_benchmark_run(&option); } else if (!strcmp("test", argv[index])) { + if (!argv[++index]) + print_test_help(); + printf("start UADK acc algorithm test.\n"); acc_test_run(argc, argv); } else { -- 2.33.0