The only nit that I have, and not sure we have any way around it today, is the size of the test buffer being hard coded to "32". Seems eventually that should be a #define for a given implementation's capabilities, or perhaps a minimum guaranteed on all ODP platforms.
But I think this is OK for now. Reviewed-and-tested-by: Robbie King <robk...@cisco.com> -----Original Message----- From: Taras Kondratiuk [mailto:taras.kondrat...@linaro.org] Sent: Thursday, February 26, 2015 8:26 AM To: lng-odp@lists.linaro.org Cc: mike.hol...@linaro.org; Robbie King (robking); Taras Kondratiuk Subject: [PATCH] validation: crypto: split crypto and random tests Crypto and Random are separate API modules now, so split tests accordingly. Signed-off-by: Taras Kondratiuk <taras.kondrat...@linaro.org> --- test/validation/Makefile.am | 3 ++- test/validation/crypto/odp_crypto_test_rng.c | 28 -------------------------- test/validation/crypto/odp_crypto_test_rng.h | 17 ---------------- test/validation/odp_crypto.c | 2 -- test/validation/odp_random.c | 30 ++++++++++++++++++++++++++++ 5 files changed, 32 insertions(+), 48 deletions(-) delete mode 100644 test/validation/crypto/odp_crypto_test_rng.c delete mode 100644 test/validation/crypto/odp_crypto_test_rng.h create mode 100644 test/validation/odp_random.c diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index f5bb9ac..0639205 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -14,6 +14,7 @@ EXECUTABLES = odp_buffer \ odp_packet \ odp_pool \ odp_queue \ + odp_random \ odp_schedule \ odp_shm \ odp_system \ @@ -42,12 +43,12 @@ dist_odp_classification_SOURCES = classification/odp_classification_tests.c \ odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \ crypto/odp_crypto_test_sync_inp.c \ - crypto/odp_crypto_test_rng.c \ odp_crypto.c $(ODP_CU_COMMON) dist_odp_init_SOURCES = odp_init.c dist_odp_init_abort_SOURCES = odp_init_abort.c dist_odp_init_log_SOURCES = odp_init_log.c dist_odp_queue_SOURCES = odp_queue.c $(ODP_CU_COMMON) +dist_odp_random_SOURCES = odp_random.c $(ODP_CU_COMMON) dist_odp_schedule_SOURCES = odp_schedule.c $(ODP_CU_COMMON) dist_odp_shm_SOURCES = odp_shm.c $(ODP_CU_COMMON) dist_odp_system_SOURCES = odp_system.c $(ODP_CU_COMMON) diff --git a/test/validation/crypto/odp_crypto_test_rng.c b/test/validation/crypto/odp_crypto_test_rng.c deleted file mode 100644 index 6a4ad17..0000000 --- a/test/validation/crypto/odp_crypto_test_rng.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (c) 2014, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ -#include <odp.h> -#include <CUnit/Basic.h> -#include <CUnit/TestDB.h> -#include "test_vectors_len.h" - -/* - * This test verifies that HW random number generator is able - * to produce an IV for TDES_CBC cipher algorithm. - * */ -#define RNG_GET_SIZE "RNG_GET_SIZE" -static void rng_get_size(void) -{ - int32_t ret; - uint8_t buf[TDES_CBC_IV_LEN]; - - ret = odp_random_data(buf, sizeof(buf), false); - CU_ASSERT(ret == TDES_CBC_IV_LEN); -} - -CU_TestInfo test_rng[] = { - { RNG_GET_SIZE, rng_get_size }, - CU_TEST_INFO_NULL, -}; diff --git a/test/validation/crypto/odp_crypto_test_rng.h b/test/validation/crypto/odp_crypto_test_rng.h deleted file mode 100644 index 16909b3..0000000 --- a/test/validation/crypto/odp_crypto_test_rng.h +++ /dev/null @@ -1,17 +0,0 @@ -/* Copyright (c) 2014, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ -#ifndef ODP_CRYPTO_TEST_RNG_ -#define ODP_CRYPTO_TEST_RNG_ - -#include "CUnit/TestDB.h" - -/* Suite name */ -#define ODP_CRYPTO_RNG "ODP_CRYPTO_RNG" - -/* Suite test array */ -extern CU_TestInfo test_rng[]; - -#endif diff --git a/test/validation/odp_crypto.c b/test/validation/odp_crypto.c index fbe5dbb..6cb5695 100644 --- a/test/validation/odp_crypto.c +++ b/test/validation/odp_crypto.c @@ -8,7 +8,6 @@ #include "odp_cunit_common.h" #include "odp_crypto_test_async_inp.h" #include "odp_crypto_test_sync_inp.h" -#include "odp_crypto_test_rng.h" #define SHM_PKT_POOL_SIZE (512*2048*2) #define SHM_PKT_POOL_BUF_SIZE (1024 * 32) @@ -19,7 +18,6 @@ CU_SuiteInfo odp_testsuites[] = { {ODP_CRYPTO_SYNC_INP, NULL, NULL, NULL, NULL, test_array_sync }, {ODP_CRYPTO_ASYNC_INP, NULL, NULL, NULL, NULL, test_array_async }, - {ODP_CRYPTO_RNG, NULL, NULL, NULL, NULL, test_rng }, CU_SUITE_INFO_NULL, }; diff --git a/test/validation/odp_random.c b/test/validation/odp_random.c new file mode 100644 index 0000000..ebc9705 --- /dev/null +++ b/test/validation/odp_random.c @@ -0,0 +1,30 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <odp.h> +#include <odp_cunit_common.h> + +/* Helper macro for CU_TestInfo initialization */ +#define _CU_TEST_INFO(test_func) {#test_func, test_func} + +static void random_get_size(void) +{ + int32_t ret; + uint8_t buf[32]; + + ret = odp_random_data(buf, sizeof(buf), false); + CU_ASSERT(ret == sizeof(buf)); +} + +CU_TestInfo test_odp_random[] = { + _CU_TEST_INFO(random_get_size), + CU_TEST_INFO_NULL, +}; + +CU_SuiteInfo odp_testsuites[] = { + {"Random", NULL, NULL, NULL, NULL, test_odp_random}, + CU_SUITE_INFO_NULL, +}; -- 1.9.1 _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp