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

Srikanth Yalavarthi syalavarthi at marvell.com
Thu Mar 23 17:21:11 CET 2023


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 at marvell.com>
---
 app/test-mldev/test_inference_common.c | 6 ++++++
 app/test-mldev/test_model_ops.c        | 6 ++++++
 2 files changed, 12 insertions(+)

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) {
-- 
2.17.1



More information about the dev mailing list