diff mbox

[2/5] validation: renaming in odp_crypto.c

Message ID 1434577905-11797-3-git-send-email-christophe.milard@linaro.org
State Accepted
Commit b5fdcab84b0a17f958417c06ff0e4e519fe1177e
Headers show

Commit Message

Christophe Milard June 17, 2015, 9:51 p.m. UTC
Renaming of things which may be, one day, exported in a lib.
This renaming is important, as it creates consistency between test
symbols, which is needed if things get eventually exported in the lib.
Also, tests are often created from other tests: Fixing the first exemples
will help geting future tests better.

Things that are candidate to be exported in the lib in the future
have been named as follows:
 -Tests, i.e. functions which are used in CUNIT testsuites are named:
    <Module>_test_*
 -Test arrays, i.e. arrays of CU_TestInfo, listing the test functions
  belonging to a suite, are called:
    <Module>_suite[_*]
  where the possible suffix can be used if many suites are declared.
 -CUNIT suite init and termination functions are called:
    <Module>_suite[_*]_init() and <Module>_suite[_*]_term()
  respectively.
 -Suite arrays, i.e. arrays of CU_SuiteInfo used in executables are called:
    <Module>_suites[_*]
  where the possible suffix identifies the executable using it, if many.
 -Main function(s), are called:
    <Module>_main[_*]
  where the possible suffix identifies the executable using it

Signed-off-by: Christophe Milard <christophe.milard@linaro.org>
---
 test/validation/crypto/odp_crypto_test_inp.c | 28 +++++++++++++++-------------
 test/validation/crypto/odp_crypto_test_inp.h |  6 +++---
 test/validation/odp_crypto.c                 |  8 ++++----
 3 files changed, 22 insertions(+), 20 deletions(-)
diff mbox

Patch

diff --git a/test/validation/crypto/odp_crypto_test_inp.c b/test/validation/crypto/odp_crypto_test_inp.c
index 5f688d6..c1c08af 100644
--- a/test/validation/crypto/odp_crypto_test_inp.c
+++ b/test/validation/crypto/odp_crypto_test_inp.c
@@ -132,7 +132,7 @@  cleanup:
  * In addition the test verifies if the implementation can use the
  * packet buffer as completion event buffer.*/
 #define ASYNC_INP_ENC_ALG_3DES_CBC	"ENC_ALG_3DES_CBC"
-static void enc_alg_3des_cbc(void)
+static void crypto_test_enc_alg_3des_cbc(void)
 {
 	odp_crypto_key_t cipher_key = { .data = NULL, .length = 0 },
 			 auth_key   = { .data = NULL, .length = 0 };
@@ -165,7 +165,7 @@  static void enc_alg_3des_cbc(void)
  * operation for 3DES_CBC algorithm. IV for the operation is the operation IV.
  * */
 #define ASYNC_INP_ENC_ALG_3DES_CBC_OVR_IV	"ENC_ALG_3DES_CBC_OVR_IV"
-static void enc_alg_3des_cbc_ovr_iv(void)
+static void crypto_test_enc_alg_3des_cbc_ovr_iv(void)
 {
 	odp_crypto_key_t cipher_key = { .data = NULL, .length = 0 },
 			 auth_key   = { .data = NULL, .length = 0 };
@@ -199,7 +199,7 @@  static void enc_alg_3des_cbc_ovr_iv(void)
  * packet buffer as completion event buffer.
  * */
 #define ASYNC_INP_DEC_ALG_3DES_CBC	"DEC_ALG_3DES_CBC"
-static void dec_alg_3des_cbc(void)
+static void crypto_test_dec_alg_3des_cbc(void)
 {
 	odp_crypto_key_t cipher_key = { .data = NULL, .length = 0 },
 			 auth_key   = { .data = NULL, .length = 0 };
@@ -234,7 +234,7 @@  static void dec_alg_3des_cbc(void)
  * packet buffer as completion event buffer.
  * */
 #define ASYNC_INP_DEC_ALG_3DES_CBC_OVR_IV	"DEC_ALG_3DES_CBC_OVR_IV"
-static void dec_alg_3des_cbc_ovr_iv(void)
+static void crypto_test_dec_alg_3des_cbc_ovr_iv(void)
 {
 	odp_crypto_key_t cipher_key = { .data = NULL, .length = 0 },
 			 auth_key   = { .data = NULL, .length = 0 };
@@ -270,7 +270,7 @@  static void dec_alg_3des_cbc_ovr_iv(void)
  * packet buffer as completion event buffer.
  * */
 #define ASYNC_INP_ALG_HMAC_MD5	"ALG_HMAC_MD5"
-static void alg_hmac_md5(void)
+static void crypto_test_alg_hmac_md5(void)
 {
 	odp_crypto_key_t cipher_key = { .data = NULL, .length = 0 },
 			 auth_key   = { .data = NULL, .length = 0 };
@@ -298,7 +298,7 @@  static void alg_hmac_md5(void)
 	}
 }
 
-int suite_sync_inp_init(void)
+int crypto_suite_sync_init(void)
 {
 	suite_context.pool = odp_pool_lookup("packet_pool");
 	if (suite_context.pool == ODP_POOL_INVALID)
@@ -309,7 +309,7 @@  int suite_sync_inp_init(void)
 	return 0;
 }
 
-int suite_async_inp_init(void)
+int crypto_suite_async_init(void)
 {
 	suite_context.pool = odp_pool_lookup("packet_pool");
 	if (suite_context.pool == ODP_POOL_INVALID)
@@ -322,11 +322,13 @@  int suite_async_inp_init(void)
 	return 0;
 }
 
-CU_TestInfo test_array_inp[] = {
-	{ASYNC_INP_ENC_ALG_3DES_CBC, enc_alg_3des_cbc },
-	{ASYNC_INP_DEC_ALG_3DES_CBC, dec_alg_3des_cbc },
-	{ASYNC_INP_ENC_ALG_3DES_CBC_OVR_IV, enc_alg_3des_cbc_ovr_iv },
-	{ASYNC_INP_DEC_ALG_3DES_CBC_OVR_IV, dec_alg_3des_cbc_ovr_iv },
-	{ASYNC_INP_ALG_HMAC_MD5, alg_hmac_md5 },
+CU_TestInfo crypto_suite[] = {
+	{ASYNC_INP_ENC_ALG_3DES_CBC, crypto_test_enc_alg_3des_cbc },
+	{ASYNC_INP_DEC_ALG_3DES_CBC, crypto_test_dec_alg_3des_cbc },
+	{ASYNC_INP_ENC_ALG_3DES_CBC_OVR_IV,
+		crypto_test_enc_alg_3des_cbc_ovr_iv },
+	{ASYNC_INP_DEC_ALG_3DES_CBC_OVR_IV,
+		crypto_test_dec_alg_3des_cbc_ovr_iv },
+	{ASYNC_INP_ALG_HMAC_MD5, crypto_test_alg_hmac_md5 },
 	CU_TEST_INFO_NULL,
 };
diff --git a/test/validation/crypto/odp_crypto_test_inp.h b/test/validation/crypto/odp_crypto_test_inp.h
index a3a5d8d..d46994f 100644
--- a/test/validation/crypto/odp_crypto_test_inp.h
+++ b/test/validation/crypto/odp_crypto_test_inp.h
@@ -13,9 +13,9 @@ 
 #define ODP_CRYPTO_SYNC_INP    "odp_crypto_sync_inp"
 
 /* Suite test array */
-extern CU_TestInfo test_array_inp[];
+extern CU_TestInfo crypto_suite[];
 
-int suite_sync_inp_init(void);
-int suite_async_inp_init(void);
+int crypto_suite_sync_init(void);
+int crypto_suite_async_init(void);
 
 #endif
diff --git a/test/validation/odp_crypto.c b/test/validation/odp_crypto.c
index ef0abbc..3393909 100644
--- a/test/validation/odp_crypto.c
+++ b/test/validation/odp_crypto.c
@@ -15,10 +15,10 @@ 
 #define SHM_COMPL_POOL_BUF_SIZE	128
 
 static CU_SuiteInfo crypto_suites[] = {
-	{ODP_CRYPTO_SYNC_INP, suite_sync_inp_init, NULL, NULL, NULL,
-			test_array_inp},
-	{ODP_CRYPTO_ASYNC_INP, suite_async_inp_init, NULL, NULL, NULL,
-			test_array_inp},
+	{ODP_CRYPTO_SYNC_INP, crypto_suite_sync_init, NULL, NULL, NULL,
+			crypto_suite},
+	{ODP_CRYPTO_ASYNC_INP, crypto_suite_async_init, NULL, NULL, NULL,
+			crypto_suite},
 	CU_SUITE_INFO_NULL,
 };