[3/3] examples/fips_validation: support self-test only

Message ID 20201006074143.31691-4-olivier.matz@6wind.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series examples/fips_validation: misc fixes |

Checks

Context Check Description
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed

Commit Message

Olivier Matz Oct. 6, 2020, 7:41 a.m. UTC
  Make it possible to pass the self-tests when no req path is set.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 examples/fips_validation/main.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
  

Comments

Fan Zhang Oct. 6, 2020, 8:55 a.m. UTC | #1
> -----Original Message-----
> From: Olivier Matz <olivier.matz@6wind.com>
> Sent: Tuesday, October 6, 2020 8:42 AM
> To: dev@dpdk.org
> Cc: Kovacevic, Marko <marko.kovacevic@intel.com>; Akhil Goyal
> <akhil.goyal@nxp.com>; Zhang, Roy Fan <roy.fan.zhang@intel.com>; Kusztal,
> ArkadiuszX <arkadiuszx.kusztal@intel.com>
> Subject: [PATCH 3/3] examples/fips_validation: support self-test only
> 
> Make it possible to pass the self-tests when no req path is set.
> 
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> ---

Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
  

Patch

diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c
index 0a1c8b568c..ee3a890e9e 100644
--- a/examples/fips_validation/main.c
+++ b/examples/fips_validation/main.c
@@ -315,8 +315,21 @@  cryptodev_fips_validate_parse_args(int argc, char **argv)
 		}
 	}
 
-	if (env.req_path == NULL || env.rsp_path == NULL ||
-			env.dev_id == UINT32_MAX) {
+	if (env.dev_id == UINT32_MAX) {
+		RTE_LOG(ERR, USER1, "No device specified\n");
+		cryptodev_fips_validate_usage(prgname);
+		return -EINVAL;
+	}
+
+	if ((env.req_path == NULL && env.rsp_path != NULL) ||
+			(env.req_path != NULL && env.rsp_path == NULL)) {
+		RTE_LOG(ERR, USER1, "Missing req path or rsp path\n");
+		cryptodev_fips_validate_usage(prgname);
+		return -EINVAL;
+	}
+
+	if (env.req_path == NULL && env.self_test == 0) {
+		RTE_LOG(ERR, USER1, "--self-test must be set if req path is missing\n");
 		cryptodev_fips_validate_usage(prgname);
 		return -EINVAL;
 	}
@@ -348,6 +361,11 @@  main(int argc, char *argv[])
 		return -1;
 	}
 
+	if (env.req_path == NULL || env.rsp_path == NULL) {
+		printf("No request, exit.\n");
+		goto exit;
+	}
+
 	if (!env.is_path_folder) {
 		printf("Processing file %s... ", env.req_path);