app/flow-perf: report invalid parameters

Message ID 20211111125032.29087-1-rasland@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series app/flow-perf: report invalid parameters |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot: build success github build: passed
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

Raslan Darawsheh Nov. 11, 2021, 12:50 p.m. UTC
  Currently, there is no check if an invalid parameter is passed
to the application.
for example:
	./dpdk-test-flow-perf -a 01:00.0 -- --invalid

This validate that all strings are part of the known options.

Fixes: 3344cf2e3001 ("app/flow-perf: add flow performance skeleton")
Cc: wisamm@nvidia.com
Cc: stable@dpdk.org

Signed-off-by: Raslan Darawsheh <rasland@nvidia.com>
---
 app/test-flow-perf/main.c | 7 +++++++
 1 file changed, 7 insertions(+)
  

Patch

diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index c1477b14a1..7453cf2b78 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -885,6 +885,13 @@  args_parse(int argc, char **argv)
 			break;
 		}
 	}
+
+	if (opt_idx != argc) {
+		usage(argv[0]);
+		rte_exit(EXIT_FAILURE,
+			 "Incorrect command line %s\n", argv[opt_idx]);
+	}
+
 	if (rules_count % rules_batch != 0) {
 		rte_exit(EXIT_FAILURE,
 			 "rules_count %% rules_batch should be 0\n");