Content-Type: multipart/mixed; boundary="===============3694741780541421683==" MIME-Version: 1.0 From: ramesh.thomas at intel.com Subject: [Accel-config] [PATCH 1/3] accel-config/test: Add support for skipping tests Date: Wed, 11 Aug 2021 22:34:26 -0400 Message-ID: <20210812023428.1185313-2-ramesh.thomas@intel.com> In-Reply-To: 20210812023428.1185313-1-ramesh.thomas@intel.com To: accel-config@lists.01.org List-ID: --===============3694741780541421683== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Ramesh Thomas Add option for tests to skip individual tests without aborting entire unit test if a required feature is absent. Following status will be printed for each test: -passed -failed -disabled -skipped Signed-off-by: Ramesh Thomas --- test/libaccfg.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/test/libaccfg.c b/test/libaccfg.c index 516adbc..44e10df 100644 --- a/test/libaccfg.c +++ b/test/libaccfg.c @@ -807,6 +807,9 @@ static int test_mdev_1swq(struct accfg_ctx *ctx) { int rc =3D 0; = + if (mdev_disabled) + return -EOPNOTSUPP; + rc =3D device_test_reset(ctx, test_ctx.device, false); if (rc) return rc; @@ -840,6 +843,9 @@ static int test_mdev_1dwq(struct accfg_ctx *ctx) { int rc =3D 0; = + if (mdev_disabled) + return -EOPNOTSUPP; + rc =3D device_test_reset(ctx, test_ctx.device, false); if (rc) return rc; @@ -873,7 +879,6 @@ struct _test_case { do_test_fn test_fn; char *desc; bool enabled; - bool mdev; }; = static struct _test_case test_cases[] =3D { @@ -881,31 +886,26 @@ static struct _test_case test_cases[] =3D { .test_fn =3D test_config, .desc =3D "set and get configurations", .enabled =3D true, - .mdev =3D false, }, { .test_fn =3D test_max_wq_size, .desc =3D "max wq size", .enabled =3D true, - .mdev =3D false, }, { .test_fn =3D test_wq_boundary_conditions, .desc =3D "wq boundary conditions", .enabled =3D true, - .mdev =3D false, }, { .test_fn =3D test_mdev_1swq, .desc =3D "1swq type mdev creation and removal", .enabled =3D true, - .mdev =3D true, }, { .test_fn =3D test_mdev_1dwq, .desc =3D "1dwq type mdev creation and removal", .enabled =3D true, - .mdev =3D true, }, }; = @@ -1009,11 +1009,14 @@ int test_libaccfg(int loglevel, struct accfg_test *= test, continue; } = - if (test_cases[i].mdev && mdev_disabled) - continue; - printf("\nRunning accfg-test%d: %s\n", i, test_cases[i].desc); err =3D test_cases[i].test_fn(ctx); + if (err =3D=3D -EOPNOTSUPP) { + fprintf(stderr, + "accfg-test%d *skipped*: required feature not found\n", + i); + continue; + } if (err < 0) { fprintf(stderr, "accfg-test%d *failed*: %d\n", i, err); break; -- = 2.26.3 --===============3694741780541421683==--