[Accel-config] [PATCH 3/3] accel-config/test: Skip shared wq config test if shm support

ramesh.thomas at intel.com Wed, 11 Aug 2021 22:34:28 -0400
Newsgroups dev.linux.lists.accel-config
Message-ID <[email protected]>
From: Ramesh Thomas <ramesh.thomas(a)intel.com>

Skip config tests that use shared wqs if shared memory support is not
available.

Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
 test/libaccfg.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/test/libaccfg.c b/test/libaccfg.c
index 9ac4bcd..5a17650 100644
--- a/test/libaccfg.c
+++ b/test/libaccfg.c
@@ -244,7 +244,9 @@ static int config_wq(struct accfg_ctx *ctx, struct accfg_device *device,
 {
 	int rc = 0;
 
-	SET_ERR(rc, accfg_wq_set_str_mode(wq, wq_param->mode));
+	rc = accfg_wq_set_str_mode(wq, wq_param->mode);
+	if (rc)
+		return rc;
 	SET_ERR(rc, accfg_wq_set_str_type(wq, wq_param->type));
 	SET_ERR(rc, accfg_wq_set_str_name(wq, wq_param->name));
 	SET_ERR(rc, accfg_wq_set_size(wq, wq_param->wq_size));
@@ -677,8 +679,14 @@ static int test_config_shared(struct accfg_ctx *ctx)
 		return rc;
 
 	rc = set_config(ctx, &test_ctx, "shared");
-	if (rc)
+	if (rc) {
+		if (rc == -EINVAL) {
+			fprintf(stderr, "shared wq support not available\n");
+			device_test_reset(ctx, test_ctx.device, false);
+			return -EOPNOTSUPP;
+		}
 		return rc;
+	}
 
 	rc = check_config(ctx, &test_ctx, "shared");
 	if (rc)
-- 
2.26.3