Content-Type: multipart/mixed; boundary="===============1535379455588527355==" MIME-Version: 1.0 From: Tony Zhu Subject: [Accel-config] [PATCH v1 3/5] accel-config/test: add test_noop function to replace the test in main Date: Tue, 30 Nov 2021 18:51:30 +0800 Message-ID: <20211130105132.13502-4-tony.zhu@intel.com> In-Reply-To: 20211130105132.13502-1-tony.zhu@intel.com To: accel-config@lists.01.org List-ID: --===============1535379455588527355== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Noop opcode test doesn't need the device initialization, it is different from other opcodes. Add test_noop to make main clean. Signed-off-by: Tony Zhu --- test/dsa_test.c | 55 ++++++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/test/dsa_test.c b/test/dsa_test.c index 1009785..61c8ba2 100644 --- a/test/dsa_test.c +++ b/test/dsa_test.c @@ -100,6 +100,36 @@ static int test_batch(struct dsa_context *ctx, size_t = buf_size, return rc; } = +static int test_noop(struct dsa_context *ctx, int tflags) +{ + struct task *tsk; + int rc; + + info("noop: tflags %#x\n", tflags); + + ctx->is_batch =3D 0; + + rc =3D alloc_task(ctx); + if (rc !=3D DSA_STATUS_OK) { + err("noop: alloc task failed, rc=3D%d\n", rc); + return rc; + } + + tsk =3D ctx->single_task; + + rc =3D dsa_noop(ctx); + if (rc !=3D DSA_STATUS_OK) { + err("noop failed stat %d\n", rc); + return rc; + } + + rc =3D task_result_verify(tsk, 0); + if (rc !=3D DSA_STATUS_OK) + return rc; + + return rc; +} + int main(int argc, char *argv[]) { struct dsa_context *dsa; @@ -173,32 +203,11 @@ int main(int argc, char *argv[]) } = switch (opcode) { - case DSA_OPCODE_NOOP: { - struct task *tsk; - - info("noop: len %#lx tflags %#x\n", buf_size, tflags); - - rc =3D alloc_task(dsa); - if (rc !=3D DSA_STATUS_OK) { - err("noop: alloc task failed, rc=3D%d\n", rc); - goto error; - } - - tsk =3D dsa->single_task; - - rc =3D dsa_noop(dsa); - if (rc !=3D DSA_STATUS_OK) { - err("noop failed stat %d\n", rc); - rc =3D -ENXIO; - break; - } - - rc =3D task_result_verify(tsk, 0); + case DSA_OPCODE_NOOP: + rc =3D test_noop(dsa, tflags); if (rc !=3D DSA_STATUS_OK) goto error; - break; - } = case DSA_OPCODE_BATCH: if (bsize > dsa->max_batch_size || bsize < 2) { -- = 2.27.0 --===============1535379455588527355==--