All of lore.kernel.org
 help / color / mirror / Atom feed
* [Accel-config] [PATCH] accel-config: Fix a bug in unit test
@ 2021-07-02  2:50 ramesh.thomas
  0 siblings, 0 replies; only message in thread
From: ramesh.thomas @ 2021-07-02  2:50 UTC (permalink / raw)
  To: accel-config

[-- Attachment #1: Type: text/plain, Size: 2233 bytes --]

From: Ramesh Thomas <ramesh.thomas(a)intel.com>

Configuring wq as "mdev" type when mdev support is not present fails at
configuration tests. Set the wq type as "user" in the template configs
and set type as "mdev" only in the mdev tests.

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

diff --git a/test/libaccfg.c b/test/libaccfg.c
index 93229c6..e5676eb 100644
--- a/test/libaccfg.c
+++ b/test/libaccfg.c
@@ -94,7 +94,7 @@ static struct wq_parameters wq02_param = {
 	.max_batch_size = (1 << 8),
 	.max_transfer_size = (1l << 30),
 	.mode = "shared",
-	.type = "mdev",
+	.type = "user",
 	.name = "guest1"
 };
 
@@ -106,7 +106,7 @@ static struct wq_parameters wq03_param = {
 	.max_batch_size = (1 << 9),
 	.max_transfer_size = (1l << 31),
 	.mode = "dedicated",
-	.type = "mdev",
+	.type = "user",
 	.name = "guest2"
 };
 
@@ -246,7 +246,7 @@ static int config_wq(struct accfg_ctx *ctx, struct accfg_device *device,
 	if (wq_param->threshold)
 		SET_ERR(rc, accfg_wq_set_threshold(wq, wq_param->threshold));
 
-	return 0;
+	return rc;
 }
 
 static int check_wq(struct accfg_ctx *ctx, struct accfg_device *device,
@@ -744,6 +744,17 @@ static int mdev_test(struct accfg_ctx *ctx, struct accfg_device *device,
 	return 0;
 }
 
+static int set_mdev_type(struct accfg_ctx *ctx, struct accfg_wq *wq)
+{
+	int rc;
+
+	rc = accfg_wq_set_str_type(wq, "mdev");
+	if (rc)
+		fprintf(stderr, "Error setting mdev type\n");
+
+	return rc;
+}
+
 static int enable_wq(struct accfg_ctx *ctx, struct accfg_device *device,
 		struct accfg_wq *wq)
 {
@@ -779,6 +790,10 @@ static int test_mdev_1swq(struct accfg_ctx *ctx)
 	if (rc)
 		return rc;
 
+	rc = set_mdev_type(ctx, test_ctx.wq[2]);
+	if (rc)
+		return rc;
+
 	rc = enable_wq(ctx, test_ctx.device, test_ctx.wq[2]);
 	if (rc)
 		return rc;
@@ -808,6 +823,10 @@ static int test_mdev_1dwq(struct accfg_ctx *ctx)
 	if (rc)
 		return rc;
 
+	rc = set_mdev_type(ctx, test_ctx.wq[3]);
+	if (rc)
+		return rc;
+
 	rc = enable_wq(ctx, test_ctx.device, test_ctx.wq[3]);
 	if (rc)
 		return rc;
-- 
2.26.3

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-02  2:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-02  2:50 [Accel-config] [PATCH] accel-config: Fix a bug in unit test ramesh.thomas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.