[1/1] app/mldev: add check for model and filelist option

Message ID 20230323162111.5303-1-syalavarthi@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [1/1] app/mldev: add check for model and filelist option |

Checks

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

Commit Message

Srikanth Yalavarthi March 23, 2023, 4:21 p.m. UTC
  Application currently doesn't check for empty models list and
filelist entries. This causes the app to report an incorrect
error messages and test status when the lists are empty.

Fixes: bbd272edcb14 ("app/mldev: add ordered inferences")
Fixes: f6661e6d9a3a ("app/mldev: validate model operations")

Signed-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>
---
 app/test-mldev/test_inference_common.c | 6 ++++++
 app/test-mldev/test_model_ops.c        | 6 ++++++
 2 files changed, 12 insertions(+)
  

Comments

Thomas Monjalon July 6, 2023, 4:40 p.m. UTC | #1
23/03/2023 17:21, Srikanth Yalavarthi:
> Application currently doesn't check for empty models list and
> filelist entries. This causes the app to report an incorrect
> error messages and test status when the lists are empty.
> 
> Fixes: bbd272edcb14 ("app/mldev: add ordered inferences")
> Fixes: f6661e6d9a3a ("app/mldev: validate model operations")
> 
> Signed-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>

Applied, thanks.
  

Patch

diff --git a/app/test-mldev/test_inference_common.c b/app/test-mldev/test_inference_common.c
index c8cd80d69f..410e63bca4 100644
--- a/app/test-mldev/test_inference_common.c
+++ b/app/test-mldev/test_inference_common.c
@@ -344,6 +344,12 @@  test_inference_opt_check(struct ml_options *opt)
 	if (ret != 0)
 		return ret;
 
+	/* check for at least one filelist */
+	if (opt->nb_filelist == 0) {
+		ml_err("Filelist empty, need at least one filelist to run the test\n");
+		return -EINVAL;
+	}
+
 	/* check file availability */
 	for (i = 0; i < opt->nb_filelist; i++) {
 		if (access(opt->filelist[i].model, F_OK) == -1) {
diff --git a/app/test-mldev/test_model_ops.c b/app/test-mldev/test_model_ops.c
index 5bbbcb1a6c..9de13247ae 100644
--- a/app/test-mldev/test_model_ops.c
+++ b/app/test-mldev/test_model_ops.c
@@ -30,6 +30,12 @@  test_model_ops_opt_check(struct ml_options *opt)
 	if (ret != 0)
 		return ret;
 
+	/* check for at least one model */
+	if (opt->nb_filelist == 0) {
+		ml_err("Models list empty, need at least one model to run the test\n");
+		return -EINVAL;
+	}
+
 	/* check model file availability */
 	for (i = 0; i < opt->nb_filelist; i++) {
 		if (access(opt->filelist[i].model, F_OK) == -1) {