[1/1] app/mldev: add check for model and filelist option
Checks
Commit Message
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
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.
@@ -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) {
@@ -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) {