Re: [lng-odp] [PATCH v2 1/1] cunit : add tests for crypto APIs

2014-11-12 Thread Alexandru Badicioiu
Comments inline.

Thanks,
Alex

On 10 November 2014 18:00, Taras Kondratiuk 
wrote:

> Do you plan to add tests for async out of place?
>
> Please check comments below.
>
> On 11/10/2014 05:31 PM, Alexandru Badicioiu wrote:
>
>> Ping.
>>
>> On 5 November 2014 11:00, > > wrote:
>>
>> From: Alexandru Badicioiu > >
>>
>> This patch adds a suite for sync and async inplace mode of crypto
>> APIs.
>> Correctness of crypto operation output is verified with known test
>> vectors. Various options and functionalities like use session IV
>> or operation IV for ciphering are exercised for both modes.
>> For async mode there are options to use input packet buffer or a
>> separate buffer as the completion event and to set and retrieve the
>> context associated with an operation from the completion event.
>>
>> Signed-off-by: Alexandru Badicioiu > >
>> ---
>> configure.ac 
>> |1 +
>>   test/cunit/Makefile.am|2 +
>>   test/cunit/crypto/Makefile.am |   10 +
>>   test/cunit/crypto/odp_crypto_test.c   |  114 
>>   test/cunit/crypto/odp_crypto_test_async_inp.c |  371
>> +
>>   test/cunit/crypto/odp_crypto_test_async_inp.h |   17 ++
>>   test/cunit/crypto/odp_crypto_test_sync_inp.c  |  260
>> +
>>   test/cunit/crypto/odp_crypto_test_sync_inp.h  |   17 ++
>>   test/cunit/crypto/test_vectors.h  |   94 +++
>>   9 files changed, 886 insertions(+), 0 deletions(-)
>>   create mode 100644 test/cunit/crypto/Makefile.am
>>   create mode 100644 test/cunit/crypto/odp_crypto_test.c
>>   create mode 100644 test/cunit/crypto/odp_crypto_test_async_inp.c
>>   create mode 100644 test/cunit/crypto/odp_crypto_test_async_inp.h
>>   create mode 100644 test/cunit/crypto/odp_crypto_test_sync_inp.c
>>   create mode 100644 test/cunit/crypto/odp_crypto_test_sync_inp.h
>>   create mode 100644 test/cunit/crypto/test_vectors.h
>>
>> diff --git a/configure.ac  b/configure.ac
>> 
>> index 1c061e9..298d50b 100644
>> --- a/configure.ac 
>> +++ b/configure.ac 
>>
>> @@ -177,6 +177,7 @@ AC_CONFIG_FILES([Makefile
>>   test/Makefile
>>   test/api_test/Makefile
>>test/cunit/Makefile
>> +test/cunit/crypto/Makefile
>>   pkgconfig/libodp.pc])
>>
>>   AC_SEARCH_LIBS([timer_create],[rt posix4])
>> diff --git a/test/cunit/Makefile.am b/test/cunit/Makefile.am
>> index 927a5a5..7611145 100644
>> --- a/test/cunit/Makefile.am
>> +++ b/test/cunit/Makefile.am
>> @@ -3,6 +3,8 @@ include $(top_srcdir)/test/Makefile.inc
>>   AM_CFLAGS += -I$(CUNIT_PATH)/include
>>   AM_LDFLAGS += -L$(CUNIT_PATH)/lib
>>
>> +SUBDIRS = crypto
>> +
>>   if ODP_CUNIT_ENABLED
>>   TESTS = ${bin_PROGRAMS}
>>   check_PROGRAMS = ${bin_PROGRAMS}
>> diff --git a/test/cunit/crypto/Makefile.am
>> b/test/cunit/crypto/Makefile.am
>> new file mode 100644
>> index 000..0eb06df
>> --- /dev/null
>> +++ b/test/cunit/crypto/Makefile.am
>> @@ -0,0 +1,10 @@
>> +include $(top_srcdir)/test/Makefile.inc
>> +
>> +if ODP_CUNIT_ENABLED
>> +bin_PROGRAMS = odp_crypto
>> +odp_crypto_LDFLAGS = $(AM_LDFLAGS) -static -lcunit
>> +endif
>> +
>> +dist_odp_crypto_SOURCES = odp_crypto_test_async_inp.c \
>> + odp_crypto_test_sync_inp.c \
>> + odp_crypto_test.c
>> diff --git a/test/cunit/crypto/odp_crypto_test.c
>> b/test/cunit/crypto/odp_crypto_test.c
>> new file mode 100644
>> index 000..dbf245a
>> --- /dev/null
>> +++ b/test/cunit/crypto/odp_crypto_test.c
>> @@ -0,0 +1,114 @@
>> +/* Copyright (c) 2014, Linaro Limited
>> + * All rights reserved.
>> + *
>> + * SPDX-License-Identifier:BSD-3-Clause
>> + */
>> +
>> +#include 
>> +#include "CUnit/Headers/Basic.h"
>> +#include "CUnit/Headers/TestDB.h"
>>
>
> It seems you are using not installed CUnit headers.
> This should be  and 
> The same for all other instances of these headers.
> [Alex] Agree. I'll make the changes.
>
>  +#include "odp_crypto_test_async_inp.h"
>> +#include "odp_crypto_test_sync_inp.h"
>> +
>> +#define SHM_PKT_POOL_SIZE  (512*2048*2)
>> +#define SHM_PKT_POOL_BUF_SIZE  (1024 * 32)
>> +
>> +#define SHM_COMPL_POOL_SIZE(128*1024)
>> +#define SHM_COMPL_POOL_BUF_SIZE 128
>> +
>> +
>> +/* Suites init/finalize funcs */
>> +/* ODP global/local initialization
>> + * Packet/Completion event pool cre

Re: [lng-odp] [PATCH v2 1/1] cunit : add tests for crypto APIs

2014-11-11 Thread Mike Holmes
Hi Alex,

Will you be able to revise this patch this week ?

On 10 November 2014 11:00, Taras Kondratiuk 
wrote:

> Do you plan to add tests for async out of place?
>
> Please check comments below.
>
> On 11/10/2014 05:31 PM, Alexandru Badicioiu wrote:
>
>> Ping.
>>
>> On 5 November 2014 11:00, > > wrote:
>>
>> From: Alexandru Badicioiu > >
>>
>> This patch adds a suite for sync and async inplace mode of crypto
>> APIs.
>> Correctness of crypto operation output is verified with known test
>> vectors. Various options and functionalities like use session IV
>> or operation IV for ciphering are exercised for both modes.
>> For async mode there are options to use input packet buffer or a
>> separate buffer as the completion event and to set and retrieve the
>> context associated with an operation from the completion event.
>>
>> Signed-off-by: Alexandru Badicioiu > >
>> ---
>> configure.ac 
>> |1 +
>>   test/cunit/Makefile.am|2 +
>>   test/cunit/crypto/Makefile.am |   10 +
>>   test/cunit/crypto/odp_crypto_test.c   |  114 
>>   test/cunit/crypto/odp_crypto_test_async_inp.c |  371
>> +
>>   test/cunit/crypto/odp_crypto_test_async_inp.h |   17 ++
>>   test/cunit/crypto/odp_crypto_test_sync_inp.c  |  260
>> +
>>   test/cunit/crypto/odp_crypto_test_sync_inp.h  |   17 ++
>>   test/cunit/crypto/test_vectors.h  |   94 +++
>>   9 files changed, 886 insertions(+), 0 deletions(-)
>>   create mode 100644 test/cunit/crypto/Makefile.am
>>   create mode 100644 test/cunit/crypto/odp_crypto_test.c
>>   create mode 100644 test/cunit/crypto/odp_crypto_test_async_inp.c
>>   create mode 100644 test/cunit/crypto/odp_crypto_test_async_inp.h
>>   create mode 100644 test/cunit/crypto/odp_crypto_test_sync_inp.c
>>   create mode 100644 test/cunit/crypto/odp_crypto_test_sync_inp.h
>>   create mode 100644 test/cunit/crypto/test_vectors.h
>>
>> diff --git a/configure.ac  b/configure.ac
>> 
>> index 1c061e9..298d50b 100644
>> --- a/configure.ac 
>> +++ b/configure.ac 
>>
>> @@ -177,6 +177,7 @@ AC_CONFIG_FILES([Makefile
>>   test/Makefile
>>   test/api_test/Makefile
>>test/cunit/Makefile
>> +test/cunit/crypto/Makefile
>>   pkgconfig/libodp.pc])
>>
>>   AC_SEARCH_LIBS([timer_create],[rt posix4])
>> diff --git a/test/cunit/Makefile.am b/test/cunit/Makefile.am
>> index 927a5a5..7611145 100644
>> --- a/test/cunit/Makefile.am
>> +++ b/test/cunit/Makefile.am
>> @@ -3,6 +3,8 @@ include $(top_srcdir)/test/Makefile.inc
>>   AM_CFLAGS += -I$(CUNIT_PATH)/include
>>   AM_LDFLAGS += -L$(CUNIT_PATH)/lib
>>
>> +SUBDIRS = crypto
>> +
>>   if ODP_CUNIT_ENABLED
>>   TESTS = ${bin_PROGRAMS}
>>   check_PROGRAMS = ${bin_PROGRAMS}
>> diff --git a/test/cunit/crypto/Makefile.am
>> b/test/cunit/crypto/Makefile.am
>> new file mode 100644
>> index 000..0eb06df
>> --- /dev/null
>> +++ b/test/cunit/crypto/Makefile.am
>> @@ -0,0 +1,10 @@
>> +include $(top_srcdir)/test/Makefile.inc
>> +
>> +if ODP_CUNIT_ENABLED
>> +bin_PROGRAMS = odp_crypto
>> +odp_crypto_LDFLAGS = $(AM_LDFLAGS) -static -lcunit
>> +endif
>> +
>> +dist_odp_crypto_SOURCES = odp_crypto_test_async_inp.c \
>> + odp_crypto_test_sync_inp.c \
>> + odp_crypto_test.c
>> diff --git a/test/cunit/crypto/odp_crypto_test.c
>> b/test/cunit/crypto/odp_crypto_test.c
>> new file mode 100644
>> index 000..dbf245a
>> --- /dev/null
>> +++ b/test/cunit/crypto/odp_crypto_test.c
>> @@ -0,0 +1,114 @@
>> +/* Copyright (c) 2014, Linaro Limited
>> + * All rights reserved.
>> + *
>> + * SPDX-License-Identifier:BSD-3-Clause
>> + */
>> +
>> +#include 
>> +#include "CUnit/Headers/Basic.h"
>> +#include "CUnit/Headers/TestDB.h"
>>
>
> It seems you are using not installed CUnit headers.
> This should be  and 
> The same for all other instances of these headers.
>
>
>  +#include "odp_crypto_test_async_inp.h"
>> +#include "odp_crypto_test_sync_inp.h"
>> +
>> +#define SHM_PKT_POOL_SIZE  (512*2048*2)
>> +#define SHM_PKT_POOL_BUF_SIZE  (1024 * 32)
>> +
>> +#define SHM_COMPL_POOL_SIZE(128*1024)
>> +#define SHM_COMPL_POOL_BUF_SIZE 128
>> +
>> +
>> +/* Suites init/finalize funcs */
>> +/* ODP global/local initialization
>> + * Packet/Completion event pool creation
>>

Re: [lng-odp] [PATCH v2 1/1] cunit : add tests for crypto APIs

2014-11-10 Thread Taras Kondratiuk

Do you plan to add tests for async out of place?

Please check comments below.

On 11/10/2014 05:31 PM, Alexandru Badicioiu wrote:

Ping.

On 5 November 2014 11:00, mailto:alexandru.badici...@linaro.org>> wrote:

From: Alexandru Badicioiu mailto:alexandru.badici...@linaro.org>>

This patch adds a suite for sync and async inplace mode of crypto APIs.
Correctness of crypto operation output is verified with known test
vectors. Various options and functionalities like use session IV
or operation IV for ciphering are exercised for both modes.
For async mode there are options to use input packet buffer or a
separate buffer as the completion event and to set and retrieve the
context associated with an operation from the completion event.

Signed-off-by: Alexandru Badicioiu mailto:alexandru.badici...@linaro.org>>
---
configure.ac 
|1 +
  test/cunit/Makefile.am|2 +
  test/cunit/crypto/Makefile.am |   10 +
  test/cunit/crypto/odp_crypto_test.c   |  114 
  test/cunit/crypto/odp_crypto_test_async_inp.c |  371
+
  test/cunit/crypto/odp_crypto_test_async_inp.h |   17 ++
  test/cunit/crypto/odp_crypto_test_sync_inp.c  |  260 +
  test/cunit/crypto/odp_crypto_test_sync_inp.h  |   17 ++
  test/cunit/crypto/test_vectors.h  |   94 +++
  9 files changed, 886 insertions(+), 0 deletions(-)
  create mode 100644 test/cunit/crypto/Makefile.am
  create mode 100644 test/cunit/crypto/odp_crypto_test.c
  create mode 100644 test/cunit/crypto/odp_crypto_test_async_inp.c
  create mode 100644 test/cunit/crypto/odp_crypto_test_async_inp.h
  create mode 100644 test/cunit/crypto/odp_crypto_test_sync_inp.c
  create mode 100644 test/cunit/crypto/odp_crypto_test_sync_inp.h
  create mode 100644 test/cunit/crypto/test_vectors.h

diff --git a/configure.ac  b/configure.ac

index 1c061e9..298d50b 100644
--- a/configure.ac 
+++ b/configure.ac 
@@ -177,6 +177,7 @@ AC_CONFIG_FILES([Makefile
  test/Makefile
  test/api_test/Makefile
   test/cunit/Makefile
+test/cunit/crypto/Makefile
  pkgconfig/libodp.pc])

  AC_SEARCH_LIBS([timer_create],[rt posix4])
diff --git a/test/cunit/Makefile.am b/test/cunit/Makefile.am
index 927a5a5..7611145 100644
--- a/test/cunit/Makefile.am
+++ b/test/cunit/Makefile.am
@@ -3,6 +3,8 @@ include $(top_srcdir)/test/Makefile.inc
  AM_CFLAGS += -I$(CUNIT_PATH)/include
  AM_LDFLAGS += -L$(CUNIT_PATH)/lib

+SUBDIRS = crypto
+
  if ODP_CUNIT_ENABLED
  TESTS = ${bin_PROGRAMS}
  check_PROGRAMS = ${bin_PROGRAMS}
diff --git a/test/cunit/crypto/Makefile.am
b/test/cunit/crypto/Makefile.am
new file mode 100644
index 000..0eb06df
--- /dev/null
+++ b/test/cunit/crypto/Makefile.am
@@ -0,0 +1,10 @@
+include $(top_srcdir)/test/Makefile.inc
+
+if ODP_CUNIT_ENABLED
+bin_PROGRAMS = odp_crypto
+odp_crypto_LDFLAGS = $(AM_LDFLAGS) -static -lcunit
+endif
+
+dist_odp_crypto_SOURCES = odp_crypto_test_async_inp.c \
+ odp_crypto_test_sync_inp.c \
+ odp_crypto_test.c
diff --git a/test/cunit/crypto/odp_crypto_test.c
b/test/cunit/crypto/odp_crypto_test.c
new file mode 100644
index 000..dbf245a
--- /dev/null
+++ b/test/cunit/crypto/odp_crypto_test.c
@@ -0,0 +1,114 @@
+/* Copyright (c) 2014, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:BSD-3-Clause
+ */
+
+#include 
+#include "CUnit/Headers/Basic.h"
+#include "CUnit/Headers/TestDB.h"


It seems you are using not installed CUnit headers.
This should be  and 
The same for all other instances of these headers.


+#include "odp_crypto_test_async_inp.h"
+#include "odp_crypto_test_sync_inp.h"
+
+#define SHM_PKT_POOL_SIZE  (512*2048*2)
+#define SHM_PKT_POOL_BUF_SIZE  (1024 * 32)
+
+#define SHM_COMPL_POOL_SIZE(128*1024)
+#define SHM_COMPL_POOL_BUF_SIZE 128
+
+
+/* Suites init/finalize funcs */
+/* ODP global/local initialization
+ * Packet/Completion event pool creation
+ * Crypto output queue creation
+*/
+
+static int init(void)
+{
+   odp_shm_t shm;
+   void *pool_base = NULL;
+   odp_buffer_pool_t pool;
+   odp_queue_t out_queue;
+
+   if (odp_init_global(NULL, NULL)) {
+   ODP_ERR("ODP global init failed.\n");
+   return -1;
+   }
+   odp_init_local();


Maybe it makes sense to call odp_init_*() from main function.
They are 

Re: [lng-odp] [PATCH v2 1/1] cunit : add tests for crypto APIs

2014-11-10 Thread Alexandru Badicioiu
Ping.

On 5 November 2014 11:00,  wrote:

> From: Alexandru Badicioiu 
>
> This patch adds a suite for sync and async inplace mode of crypto APIs.
> Correctness of crypto operation output is verified with known test
> vectors. Various options and functionalities like use session IV
> or operation IV for ciphering are exercised for both modes.
> For async mode there are options to use input packet buffer or a
> separate buffer as the completion event and to set and retrieve the
> context associated with an operation from the completion event.
>
> Signed-off-by: Alexandru Badicioiu 
> ---
>  configure.ac  |1 +
>  test/cunit/Makefile.am|2 +
>  test/cunit/crypto/Makefile.am |   10 +
>  test/cunit/crypto/odp_crypto_test.c   |  114 
>  test/cunit/crypto/odp_crypto_test_async_inp.c |  371
> +
>  test/cunit/crypto/odp_crypto_test_async_inp.h |   17 ++
>  test/cunit/crypto/odp_crypto_test_sync_inp.c  |  260 +
>  test/cunit/crypto/odp_crypto_test_sync_inp.h  |   17 ++
>  test/cunit/crypto/test_vectors.h  |   94 +++
>  9 files changed, 886 insertions(+), 0 deletions(-)
>  create mode 100644 test/cunit/crypto/Makefile.am
>  create mode 100644 test/cunit/crypto/odp_crypto_test.c
>  create mode 100644 test/cunit/crypto/odp_crypto_test_async_inp.c
>  create mode 100644 test/cunit/crypto/odp_crypto_test_async_inp.h
>  create mode 100644 test/cunit/crypto/odp_crypto_test_sync_inp.c
>  create mode 100644 test/cunit/crypto/odp_crypto_test_sync_inp.h
>  create mode 100644 test/cunit/crypto/test_vectors.h
>
> diff --git a/configure.ac b/configure.ac
> index 1c061e9..298d50b 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -177,6 +177,7 @@ AC_CONFIG_FILES([Makefile
>  test/Makefile
>  test/api_test/Makefile
>   test/cunit/Makefile
> +test/cunit/crypto/Makefile
>  pkgconfig/libodp.pc])
>
>  AC_SEARCH_LIBS([timer_create],[rt posix4])
> diff --git a/test/cunit/Makefile.am b/test/cunit/Makefile.am
> index 927a5a5..7611145 100644
> --- a/test/cunit/Makefile.am
> +++ b/test/cunit/Makefile.am
> @@ -3,6 +3,8 @@ include $(top_srcdir)/test/Makefile.inc
>  AM_CFLAGS += -I$(CUNIT_PATH)/include
>  AM_LDFLAGS += -L$(CUNIT_PATH)/lib
>
> +SUBDIRS = crypto
> +
>  if ODP_CUNIT_ENABLED
>  TESTS = ${bin_PROGRAMS}
>  check_PROGRAMS = ${bin_PROGRAMS}
> diff --git a/test/cunit/crypto/Makefile.am b/test/cunit/crypto/Makefile.am
> new file mode 100644
> index 000..0eb06df
> --- /dev/null
> +++ b/test/cunit/crypto/Makefile.am
> @@ -0,0 +1,10 @@
> +include $(top_srcdir)/test/Makefile.inc
> +
> +if ODP_CUNIT_ENABLED
> +bin_PROGRAMS = odp_crypto
> +odp_crypto_LDFLAGS = $(AM_LDFLAGS) -static -lcunit
> +endif
> +
> +dist_odp_crypto_SOURCES = odp_crypto_test_async_inp.c \
> + odp_crypto_test_sync_inp.c \
> + odp_crypto_test.c
> diff --git a/test/cunit/crypto/odp_crypto_test.c
> b/test/cunit/crypto/odp_crypto_test.c
> new file mode 100644
> index 000..dbf245a
> --- /dev/null
> +++ b/test/cunit/crypto/odp_crypto_test.c
> @@ -0,0 +1,114 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier:BSD-3-Clause
> + */
> +
> +#include 
> +#include "CUnit/Headers/Basic.h"
> +#include "CUnit/Headers/TestDB.h"
> +#include "odp_crypto_test_async_inp.h"
> +#include "odp_crypto_test_sync_inp.h"
> +
> +#define SHM_PKT_POOL_SIZE  (512*2048*2)
> +#define SHM_PKT_POOL_BUF_SIZE  (1024 * 32)
> +
> +#define SHM_COMPL_POOL_SIZE(128*1024)
> +#define SHM_COMPL_POOL_BUF_SIZE 128
> +
> +
> +/* Suites init/finalize funcs */
> +/* ODP global/local initialization
> + * Packet/Completion event pool creation
> + * Crypto output queue creation
> +*/
> +
> +static int init(void)
> +{
> +   odp_shm_t shm;
> +   void *pool_base = NULL;
> +   odp_buffer_pool_t pool;
> +   odp_queue_t out_queue;
> +
> +   if (odp_init_global(NULL, NULL)) {
> +   ODP_ERR("ODP global init failed.\n");
> +   return -1;
> +   }
> +   odp_init_local();
> +
> +   shm = odp_shm_reserve("shm_packet_pool",
> + SHM_PKT_POOL_SIZE,
> + ODP_CACHE_LINE_SIZE, 0);
> +
> +   pool_base = odp_shm_addr(shm);
> +   if (!pool_base) {
> +   ODP_ERR("Packet pool allocation failed.\n");
> +   return -1;
> +   }
> +
> +   pool = odp_buffer_pool_create("packet_pool", pool_base,
> + SHM_PKT_POOL_SIZE,
> + SHM_PKT_POOL_BUF_SIZE,
> + ODP_CACHE_LINE_SIZE,
> + ODP_BUFFER_TYPE_PACKET);
> +   if (pool == ODP_BUFFER_POOL_INVALID) {
> +   ODP_ERR("Packet pool creation failed.\n");
> +   

Re: [lng-odp] [PATCH v2 1/1] cunit : add tests for crypto APIs

2014-11-06 Thread Mike Holmes
Alex and I are discussing things off list, I hope to add reviewed-by

On 6 November 2014 13:59, Maxim Uvarov  wrote:

> Please review / test this patch.
>
> Maxim.
>
>
> On 11/05/2014 12:00 PM, alexandru.badici...@linaro.org wrote:
>
>> From: Alexandru Badicioiu 
>>
>> This patch adds a suite for sync and async inplace mode of crypto APIs.
>> Correctness of crypto operation output is verified with known test
>> vectors. Various options and functionalities like use session IV
>> or operation IV for ciphering are exercised for both modes.
>> For async mode there are options to use input packet buffer or a
>> separate buffer as the completion event and to set and retrieve the
>> context associated with an operation from the completion event.
>>
>> Signed-off-by: Alexandru Badicioiu 
>> ---
>>   configure.ac  |1 +
>>   test/cunit/Makefile.am|2 +
>>   test/cunit/crypto/Makefile.am |   10 +
>>   test/cunit/crypto/odp_crypto_test.c   |  114 
>>   test/cunit/crypto/odp_crypto_test_async_inp.c |  371
>> +
>>   test/cunit/crypto/odp_crypto_test_async_inp.h |   17 ++
>>   test/cunit/crypto/odp_crypto_test_sync_inp.c  |  260 +
>>   test/cunit/crypto/odp_crypto_test_sync_inp.h  |   17 ++
>>   test/cunit/crypto/test_vectors.h  |   94 +++
>>   9 files changed, 886 insertions(+), 0 deletions(-)
>>   create mode 100644 test/cunit/crypto/Makefile.am
>>   create mode 100644 test/cunit/crypto/odp_crypto_test.c
>>   create mode 100644 test/cunit/crypto/odp_crypto_test_async_inp.c
>>   create mode 100644 test/cunit/crypto/odp_crypto_test_async_inp.h
>>   create mode 100644 test/cunit/crypto/odp_crypto_test_sync_inp.c
>>   create mode 100644 test/cunit/crypto/odp_crypto_test_sync_inp.h
>>   create mode 100644 test/cunit/crypto/test_vectors.h
>>
>> diff --git a/configure.ac b/configure.ac
>> index 1c061e9..298d50b 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -177,6 +177,7 @@ AC_CONFIG_FILES([Makefile
>>  test/Makefile
>>  test/api_test/Makefile
>>test/cunit/Makefile
>> +test/cunit/crypto/Makefile
>>  pkgconfig/libodp.pc])
>> AC_SEARCH_LIBS([timer_create],[rt posix4])
>> diff --git a/test/cunit/Makefile.am b/test/cunit/Makefile.am
>> index 927a5a5..7611145 100644
>> --- a/test/cunit/Makefile.am
>> +++ b/test/cunit/Makefile.am
>> @@ -3,6 +3,8 @@ include $(top_srcdir)/test/Makefile.inc
>>   AM_CFLAGS += -I$(CUNIT_PATH)/include
>>   AM_LDFLAGS += -L$(CUNIT_PATH)/lib
>>   +SUBDIRS = crypto
>> +
>>   if ODP_CUNIT_ENABLED
>>   TESTS = ${bin_PROGRAMS}
>>   check_PROGRAMS = ${bin_PROGRAMS}
>> diff --git a/test/cunit/crypto/Makefile.am b/test/cunit/crypto/Makefile.
>> am
>> new file mode 100644
>> index 000..0eb06df
>> --- /dev/null
>> +++ b/test/cunit/crypto/Makefile.am
>> @@ -0,0 +1,10 @@
>> +include $(top_srcdir)/test/Makefile.inc
>> +
>> +if ODP_CUNIT_ENABLED
>> +bin_PROGRAMS = odp_crypto
>> +odp_crypto_LDFLAGS = $(AM_LDFLAGS) -static -lcunit
>> +endif
>> +
>> +dist_odp_crypto_SOURCES = odp_crypto_test_async_inp.c \
>> + odp_crypto_test_sync_inp.c \
>> + odp_crypto_test.c
>> diff --git a/test/cunit/crypto/odp_crypto_test.c b/test/cunit/crypto/odp_
>> crypto_test.c
>> new file mode 100644
>> index 000..dbf245a
>> --- /dev/null
>> +++ b/test/cunit/crypto/odp_crypto_test.c
>> @@ -0,0 +1,114 @@
>> +/* Copyright (c) 2014, Linaro Limited
>> + * All rights reserved.
>> + *
>> + * SPDX-License-Identifier:BSD-3-Clause
>> + */
>> +
>> +#include 
>> +#include "CUnit/Headers/Basic.h"
>> +#include "CUnit/Headers/TestDB.h"
>> +#include "odp_crypto_test_async_inp.h"
>> +#include "odp_crypto_test_sync_inp.h"
>> +
>> +#define SHM_PKT_POOL_SIZE  (512*2048*2)
>> +#define SHM_PKT_POOL_BUF_SIZE  (1024 * 32)
>> +
>> +#define SHM_COMPL_POOL_SIZE(128*1024)
>> +#define SHM_COMPL_POOL_BUF_SIZE 128
>> +
>> +
>> +/* Suites init/finalize funcs */
>> +/* ODP global/local initialization
>> + * Packet/Completion event pool creation
>> + * Crypto output queue creation
>> +*/
>> +
>> +static int init(void)
>> +{
>> +   odp_shm_t shm;
>> +   void *pool_base = NULL;
>> +   odp_buffer_pool_t pool;
>> +   odp_queue_t out_queue;
>> +
>> +   if (odp_init_global(NULL, NULL)) {
>> +   ODP_ERR("ODP global init failed.\n");
>> +   return -1;
>> +   }
>> +   odp_init_local();
>> +
>> +   shm = odp_shm_reserve("shm_packet_pool",
>> + SHM_PKT_POOL_SIZE,
>> + ODP_CACHE_LINE_SIZE, 0);
>> +
>> +   pool_base = odp_shm_addr(shm);
>> +   if (!pool_base) {
>> +   ODP_ERR("Packet pool allocation failed.\n");
>> +   return -1;
>> +   }
>> +
>> +   pool = odp_buffer_pool_create("packet_pool", pool_base,
>> + 

Re: [lng-odp] [PATCH v2 1/1] cunit : add tests for crypto APIs

2014-11-06 Thread Maxim Uvarov

Please review / test this patch.

Maxim.

On 11/05/2014 12:00 PM, alexandru.badici...@linaro.org wrote:

From: Alexandru Badicioiu 

This patch adds a suite for sync and async inplace mode of crypto APIs.
Correctness of crypto operation output is verified with known test
vectors. Various options and functionalities like use session IV
or operation IV for ciphering are exercised for both modes.
For async mode there are options to use input packet buffer or a
separate buffer as the completion event and to set and retrieve the
context associated with an operation from the completion event.

Signed-off-by: Alexandru Badicioiu 
---
  configure.ac  |1 +
  test/cunit/Makefile.am|2 +
  test/cunit/crypto/Makefile.am |   10 +
  test/cunit/crypto/odp_crypto_test.c   |  114 
  test/cunit/crypto/odp_crypto_test_async_inp.c |  371 +
  test/cunit/crypto/odp_crypto_test_async_inp.h |   17 ++
  test/cunit/crypto/odp_crypto_test_sync_inp.c  |  260 +
  test/cunit/crypto/odp_crypto_test_sync_inp.h  |   17 ++
  test/cunit/crypto/test_vectors.h  |   94 +++
  9 files changed, 886 insertions(+), 0 deletions(-)
  create mode 100644 test/cunit/crypto/Makefile.am
  create mode 100644 test/cunit/crypto/odp_crypto_test.c
  create mode 100644 test/cunit/crypto/odp_crypto_test_async_inp.c
  create mode 100644 test/cunit/crypto/odp_crypto_test_async_inp.h
  create mode 100644 test/cunit/crypto/odp_crypto_test_sync_inp.c
  create mode 100644 test/cunit/crypto/odp_crypto_test_sync_inp.h
  create mode 100644 test/cunit/crypto/test_vectors.h

diff --git a/configure.ac b/configure.ac
index 1c061e9..298d50b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -177,6 +177,7 @@ AC_CONFIG_FILES([Makefile
 test/Makefile
 test/api_test/Makefile
   test/cunit/Makefile
+test/cunit/crypto/Makefile
 pkgconfig/libodp.pc])
  
  AC_SEARCH_LIBS([timer_create],[rt posix4])

diff --git a/test/cunit/Makefile.am b/test/cunit/Makefile.am
index 927a5a5..7611145 100644
--- a/test/cunit/Makefile.am
+++ b/test/cunit/Makefile.am
@@ -3,6 +3,8 @@ include $(top_srcdir)/test/Makefile.inc
  AM_CFLAGS += -I$(CUNIT_PATH)/include
  AM_LDFLAGS += -L$(CUNIT_PATH)/lib
  
+SUBDIRS = crypto

+
  if ODP_CUNIT_ENABLED
  TESTS = ${bin_PROGRAMS}
  check_PROGRAMS = ${bin_PROGRAMS}
diff --git a/test/cunit/crypto/Makefile.am b/test/cunit/crypto/Makefile.am
new file mode 100644
index 000..0eb06df
--- /dev/null
+++ b/test/cunit/crypto/Makefile.am
@@ -0,0 +1,10 @@
+include $(top_srcdir)/test/Makefile.inc
+
+if ODP_CUNIT_ENABLED
+bin_PROGRAMS = odp_crypto
+odp_crypto_LDFLAGS = $(AM_LDFLAGS) -static -lcunit
+endif
+
+dist_odp_crypto_SOURCES = odp_crypto_test_async_inp.c \
+ odp_crypto_test_sync_inp.c \
+ odp_crypto_test.c
diff --git a/test/cunit/crypto/odp_crypto_test.c 
b/test/cunit/crypto/odp_crypto_test.c
new file mode 100644
index 000..dbf245a
--- /dev/null
+++ b/test/cunit/crypto/odp_crypto_test.c
@@ -0,0 +1,114 @@
+/* Copyright (c) 2014, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:BSD-3-Clause
+ */
+
+#include 
+#include "CUnit/Headers/Basic.h"
+#include "CUnit/Headers/TestDB.h"
+#include "odp_crypto_test_async_inp.h"
+#include "odp_crypto_test_sync_inp.h"
+
+#define SHM_PKT_POOL_SIZE  (512*2048*2)
+#define SHM_PKT_POOL_BUF_SIZE  (1024 * 32)
+
+#define SHM_COMPL_POOL_SIZE(128*1024)
+#define SHM_COMPL_POOL_BUF_SIZE 128
+
+
+/* Suites init/finalize funcs */
+/* ODP global/local initialization
+ * Packet/Completion event pool creation
+ * Crypto output queue creation
+*/
+
+static int init(void)
+{
+   odp_shm_t shm;
+   void *pool_base = NULL;
+   odp_buffer_pool_t pool;
+   odp_queue_t out_queue;
+
+   if (odp_init_global(NULL, NULL)) {
+   ODP_ERR("ODP global init failed.\n");
+   return -1;
+   }
+   odp_init_local();
+
+   shm = odp_shm_reserve("shm_packet_pool",
+ SHM_PKT_POOL_SIZE,
+ ODP_CACHE_LINE_SIZE, 0);
+
+   pool_base = odp_shm_addr(shm);
+   if (!pool_base) {
+   ODP_ERR("Packet pool allocation failed.\n");
+   return -1;
+   }
+
+   pool = odp_buffer_pool_create("packet_pool", pool_base,
+ SHM_PKT_POOL_SIZE,
+ SHM_PKT_POOL_BUF_SIZE,
+ ODP_CACHE_LINE_SIZE,
+ ODP_BUFFER_TYPE_PACKET);
+   if (pool == ODP_BUFFER_POOL_INVALID) {
+   ODP_ERR("Packet pool creation failed.\n");
+   /* TODO - cleanup */
+   return -1;
+   }
+   out_queue = odp_queue_create("crypto-out",
+ODP_QUEUE_TYPE_POLL,

Re: [lng-odp] [PATCH v2 1/1] cunit : add tests for crypto APIs

2014-11-01 Thread Bala Manoharan
We should be able to modify the suite once we define the additional API in
crypto to read the supported crypto operations in the underlying platform.
The test suite  could be written in such a way to run only the sync or
async test cases for the specified platform based on the return from the
query function.
So that we can run a single suite which validates the crypto function based
on different methods supported by different platforms.

Regards,
Bala

On 31 October 2014 23:44, Mike Holmes  wrote:

> I had thought that in this case it might be something like below using the
> cunit ability to organise tests into different suites.
> The code can then be organized and reused as needed, but it is all built
> together as a suite that can be run for async only, sync only or both, with
> the main entry point just taking an commandline argument as to which suites
> to run.
>
> crypto
> |
>  --
>  ||
>   async  . . . . sync
>  ||
>--- ---
>| | | |
> Test '11' ... Test '1M' Test 'N1' ... Test 'NM'
>
>
> On 31 October 2014 11:10, Jerin Jacob 
> wrote:
>
>> On Fri, Oct 31, 2014 at 04:35:21PM +0200, Alexandru Badicioiu wrote:
>> > This suite is only for async inplace mode.The tests can be reused, with
>> > some modifications, for other modes too (sync/inplace/outplace/).
>> Command
>> > line argument to select the the suite(s) or separate test programs could
>> > work too.
>>
>> Introducing an abstraction for sync/async mode for functional test-case
>> is very straight forward.
>> Most of the platforms don't support both async and sync together.
>> and its very difficult to maintain parallel tests suites for the same
>> functionality which can be abstracted.
>> If you need any help in defining/reviewing the abstraction and/or testing
>> the sync mode then I can help you with that.
>> I would like avoid the duplicate effort of writing parallel ODP crypto
>> Cunit testcases.
>>
>> Let me know your views on the proposal.
>>
>> >
>> > On 31 October 2014 16:28, Jerin Jacob 
>> > wrote:
>> >
>> > > On Fri, Oct 31, 2014 at 02:08:47PM +0200,
>> alexandru.badici...@linaro.org
>> > > wrote:
>> > > > From: Alexandru Badicioiu 
>> > > >
>> > > > This patch adds a suite for async inplace mode of crypto APIs.
>> > > > Correctness of crypto operations output is verified with known
>> > > > test vectors  as well as various options and functionalities:
>> > > > use session IV or operation IV for ciphering, use input packet
>> > > > buffer or a separate buffer as the completion event, set and
>> > > > retrieve the context associated with an operation.
>> > >
>> > > IMO crypto functionality unit tests should be capable of running on
>> both
>> > > sync and async modes.
>> > > Platform like octeon supports only sync crypto mode.
>> > > We can introduce a command-line option to select the mode for
>> functional
>> > > testcases.
>> > > We can have separate  dedicated test to verify async/sync operation
>> but
>> > > crypto functional tests
>> > > should cater both.
>> > >
>> > > Jerin
>> > >
>> > > >
>> > > > Signed-off-by: Alexandru Badicioiu 
>> > > > ---
>> > > >  configure.ac  |1 +
>> > > >  test/cunit/Makefile.am|2 +
>> > > >  test/cunit/crypto/Makefile.am |9 +
>> > > >  test/cunit/crypto/odp_crypto_test.c   |   26 ++
>> > > >  test/cunit/crypto/odp_crypto_test_async_inp.c |  459
>> > > +
>> > > >  test/cunit/crypto/odp_crypto_test_async_inp.h |   13 +
>> > > >  test/cunit/crypto/test_vectors.h  |   94 +
>> > > >  7 files changed, 604 insertions(+), 0 deletions(-)
>> > > >  create mode 100644 test/cunit/crypto/Makefile.am
>> > > >  create mode 100644 test/cunit/crypto/odp_crypto_test.c
>> > > >  create mode 100644 test/cunit/crypto/odp_crypto_test_async_inp.c
>> > > >  create mode 100644 test/cunit/crypto/odp_crypto_test_async_inp.h
>> > > >  create mode 100644 test/cunit/crypto/test_vectors.h
>> > > >
>> > > > diff --git a/configure.ac b/configure.ac
>> > > > index fd69e85..b1785e9 100644
>> > > > --- a/configure.ac
>> > > > +++ b/configure.ac
>> > > > @@ -166,6 +166,7 @@ AC_CONFIG_FILES([Makefile
>> > > >test/Makefile
>> > > >test/api_test/Makefile
>> > > >   test/cunit/Makefile
>> > > > +  test/cunit/crypto/Makefile
>> > > >pkgconfig/libodp.pc])
>> > > >
>> > > >  AC_SEARCH_LIBS([timer_create],[rt posix4])
>> > > > diff --git a/test/cunit/Makefile.am b/test/cunit/Makefile.am
>> > > > index 927a5a5..7611145 100644
>> > > > --- a/test/cunit/Makefile.am
>> > > > +++ b/test/cunit/Makefile.am
>> > > > @@ -3,6 +3,8 @@ include $(top_srcdir)/test/M

Re: [lng-odp] [PATCH v2 1/1] cunit : add tests for crypto APIs

2014-10-31 Thread Mike Holmes
I had thought that in this case it might be something like below using the
cunit ability to organise tests into different suites.
The code can then be organized and reused as needed, but it is all built
together as a suite that can be run for async only, sync only or both, with
the main entry point just taking an commandline argument as to which suites
to run.

crypto
|
 --
 ||
  async  . . . . sync
 ||
   --- ---
   | | | |
Test '11' ... Test '1M' Test 'N1' ... Test 'NM'


On 31 October 2014 11:10, Jerin Jacob 
wrote:

> On Fri, Oct 31, 2014 at 04:35:21PM +0200, Alexandru Badicioiu wrote:
> > This suite is only for async inplace mode.The tests can be reused, with
> > some modifications, for other modes too (sync/inplace/outplace/). Command
> > line argument to select the the suite(s) or separate test programs could
> > work too.
>
> Introducing an abstraction for sync/async mode for functional test-case is
> very straight forward.
> Most of the platforms don't support both async and sync together.
> and its very difficult to maintain parallel tests suites for the same
> functionality which can be abstracted.
> If you need any help in defining/reviewing the abstraction and/or testing
> the sync mode then I can help you with that.
> I would like avoid the duplicate effort of writing parallel ODP crypto
> Cunit testcases.
>
> Let me know your views on the proposal.
>
> >
> > On 31 October 2014 16:28, Jerin Jacob 
> > wrote:
> >
> > > On Fri, Oct 31, 2014 at 02:08:47PM +0200,
> alexandru.badici...@linaro.org
> > > wrote:
> > > > From: Alexandru Badicioiu 
> > > >
> > > > This patch adds a suite for async inplace mode of crypto APIs.
> > > > Correctness of crypto operations output is verified with known
> > > > test vectors  as well as various options and functionalities:
> > > > use session IV or operation IV for ciphering, use input packet
> > > > buffer or a separate buffer as the completion event, set and
> > > > retrieve the context associated with an operation.
> > >
> > > IMO crypto functionality unit tests should be capable of running on
> both
> > > sync and async modes.
> > > Platform like octeon supports only sync crypto mode.
> > > We can introduce a command-line option to select the mode for
> functional
> > > testcases.
> > > We can have separate  dedicated test to verify async/sync operation but
> > > crypto functional tests
> > > should cater both.
> > >
> > > Jerin
> > >
> > > >
> > > > Signed-off-by: Alexandru Badicioiu 
> > > > ---
> > > >  configure.ac  |1 +
> > > >  test/cunit/Makefile.am|2 +
> > > >  test/cunit/crypto/Makefile.am |9 +
> > > >  test/cunit/crypto/odp_crypto_test.c   |   26 ++
> > > >  test/cunit/crypto/odp_crypto_test_async_inp.c |  459
> > > +
> > > >  test/cunit/crypto/odp_crypto_test_async_inp.h |   13 +
> > > >  test/cunit/crypto/test_vectors.h  |   94 +
> > > >  7 files changed, 604 insertions(+), 0 deletions(-)
> > > >  create mode 100644 test/cunit/crypto/Makefile.am
> > > >  create mode 100644 test/cunit/crypto/odp_crypto_test.c
> > > >  create mode 100644 test/cunit/crypto/odp_crypto_test_async_inp.c
> > > >  create mode 100644 test/cunit/crypto/odp_crypto_test_async_inp.h
> > > >  create mode 100644 test/cunit/crypto/test_vectors.h
> > > >
> > > > diff --git a/configure.ac b/configure.ac
> > > > index fd69e85..b1785e9 100644
> > > > --- a/configure.ac
> > > > +++ b/configure.ac
> > > > @@ -166,6 +166,7 @@ AC_CONFIG_FILES([Makefile
> > > >test/Makefile
> > > >test/api_test/Makefile
> > > >   test/cunit/Makefile
> > > > +  test/cunit/crypto/Makefile
> > > >pkgconfig/libodp.pc])
> > > >
> > > >  AC_SEARCH_LIBS([timer_create],[rt posix4])
> > > > diff --git a/test/cunit/Makefile.am b/test/cunit/Makefile.am
> > > > index 927a5a5..7611145 100644
> > > > --- a/test/cunit/Makefile.am
> > > > +++ b/test/cunit/Makefile.am
> > > > @@ -3,6 +3,8 @@ include $(top_srcdir)/test/Makefile.inc
> > > >  AM_CFLAGS += -I$(CUNIT_PATH)/include
> > > >  AM_LDFLAGS += -L$(CUNIT_PATH)/lib
> > > >
> > > > +SUBDIRS = crypto
> > > > +
> > > >  if ODP_CUNIT_ENABLED
> > > >  TESTS = ${bin_PROGRAMS}
> > > >  check_PROGRAMS = ${bin_PROGRAMS}
> > > > diff --git a/test/cunit/crypto/Makefile.am
> > > b/test/cunit/crypto/Makefile.am
> > > > new file mode 100644
> > > > index 000..b984eaa
> > > > --- /dev/null
> > > > +++ b/test/cunit/crypto/Makefile.am
> > > > @@ -0,0 +1,9 @@
> > > > +include $(top_srcdir)/test/Makefile.inc
> > > > +
> > > > +if ODP_CUNIT_ENABLED
> > > > +bin_PROGRAMS = odp_crypto
> > > > +odp_cryp

Re: [lng-odp] [PATCH v2 1/1] cunit : add tests for crypto APIs

2014-10-31 Thread Jerin Jacob
On Fri, Oct 31, 2014 at 04:35:21PM +0200, Alexandru Badicioiu wrote:
> This suite is only for async inplace mode.The tests can be reused, with
> some modifications, for other modes too (sync/inplace/outplace/). Command
> line argument to select the the suite(s) or separate test programs could
> work too.

Introducing an abstraction for sync/async mode for functional test-case is very 
straight forward.
Most of the platforms don't support both async and sync together.
and its very difficult to maintain parallel tests suites for the same 
functionality which can be abstracted.
If you need any help in defining/reviewing the abstraction and/or testing the 
sync mode then I can help you with that.
I would like avoid the duplicate effort of writing parallel ODP crypto Cunit 
testcases.

Let me know your views on the proposal.

> 
> On 31 October 2014 16:28, Jerin Jacob 
> wrote:
> 
> > On Fri, Oct 31, 2014 at 02:08:47PM +0200, alexandru.badici...@linaro.org
> > wrote:
> > > From: Alexandru Badicioiu 
> > >
> > > This patch adds a suite for async inplace mode of crypto APIs.
> > > Correctness of crypto operations output is verified with known
> > > test vectors  as well as various options and functionalities:
> > > use session IV or operation IV for ciphering, use input packet
> > > buffer or a separate buffer as the completion event, set and
> > > retrieve the context associated with an operation.
> >
> > IMO crypto functionality unit tests should be capable of running on both
> > sync and async modes.
> > Platform like octeon supports only sync crypto mode.
> > We can introduce a command-line option to select the mode for functional
> > testcases.
> > We can have separate  dedicated test to verify async/sync operation but
> > crypto functional tests
> > should cater both.
> >
> > Jerin
> >
> > >
> > > Signed-off-by: Alexandru Badicioiu 
> > > ---
> > >  configure.ac  |1 +
> > >  test/cunit/Makefile.am|2 +
> > >  test/cunit/crypto/Makefile.am |9 +
> > >  test/cunit/crypto/odp_crypto_test.c   |   26 ++
> > >  test/cunit/crypto/odp_crypto_test_async_inp.c |  459
> > +
> > >  test/cunit/crypto/odp_crypto_test_async_inp.h |   13 +
> > >  test/cunit/crypto/test_vectors.h  |   94 +
> > >  7 files changed, 604 insertions(+), 0 deletions(-)
> > >  create mode 100644 test/cunit/crypto/Makefile.am
> > >  create mode 100644 test/cunit/crypto/odp_crypto_test.c
> > >  create mode 100644 test/cunit/crypto/odp_crypto_test_async_inp.c
> > >  create mode 100644 test/cunit/crypto/odp_crypto_test_async_inp.h
> > >  create mode 100644 test/cunit/crypto/test_vectors.h
> > >
> > > diff --git a/configure.ac b/configure.ac
> > > index fd69e85..b1785e9 100644
> > > --- a/configure.ac
> > > +++ b/configure.ac
> > > @@ -166,6 +166,7 @@ AC_CONFIG_FILES([Makefile
> > >test/Makefile
> > >test/api_test/Makefile
> > >   test/cunit/Makefile
> > > +  test/cunit/crypto/Makefile
> > >pkgconfig/libodp.pc])
> > >
> > >  AC_SEARCH_LIBS([timer_create],[rt posix4])
> > > diff --git a/test/cunit/Makefile.am b/test/cunit/Makefile.am
> > > index 927a5a5..7611145 100644
> > > --- a/test/cunit/Makefile.am
> > > +++ b/test/cunit/Makefile.am
> > > @@ -3,6 +3,8 @@ include $(top_srcdir)/test/Makefile.inc
> > >  AM_CFLAGS += -I$(CUNIT_PATH)/include
> > >  AM_LDFLAGS += -L$(CUNIT_PATH)/lib
> > >
> > > +SUBDIRS = crypto
> > > +
> > >  if ODP_CUNIT_ENABLED
> > >  TESTS = ${bin_PROGRAMS}
> > >  check_PROGRAMS = ${bin_PROGRAMS}
> > > diff --git a/test/cunit/crypto/Makefile.am
> > b/test/cunit/crypto/Makefile.am
> > > new file mode 100644
> > > index 000..b984eaa
> > > --- /dev/null
> > > +++ b/test/cunit/crypto/Makefile.am
> > > @@ -0,0 +1,9 @@
> > > +include $(top_srcdir)/test/Makefile.inc
> > > +
> > > +if ODP_CUNIT_ENABLED
> > > +bin_PROGRAMS = odp_crypto
> > > +odp_crypto_LDFLAGS = $(AM_LDFLAGS) -static -lcunit
> > > +endif
> > > +
> > > +dist_odp_crypto_SOURCES = odp_crypto_test_async_inp.c \
> > > +   odp_crypto_test.c
> > > diff --git a/test/cunit/crypto/odp_crypto_test.c
> > b/test/cunit/crypto/odp_crypto_test.c
> > > new file mode 100644
> > > index 000..b5d0dea
> > > --- /dev/null
> > > +++ b/test/cunit/crypto/odp_crypto_test.c
> > > @@ -0,0 +1,26 @@
> > > +/* Copyright (c) 2014, Linaro Limited
> > > + * All rights reserved.
> > > + *
> > > + * SPDX-License-Identifier: BSD-3-Clause
> > > + */
> > > +
> > > +#include 
> > > +#include "CUnit/Headers/Basic.h"
> > > +#include "CUnit/Headers/TestDB.h"
> > > +#include "odp_crypto_test_async_inp.h"
> > > +
> > > +int main(void)
> > > +{
> > > + /* initialize the CUnit test registry */
> > > + if (CUE_SUCCESS != CU_initialize_registry())
> > > + return CU_get_error();
> > > +
> > > + /* register suites */
> > > + CU_register_suites(suites);
> > > +

Re: [lng-odp] [PATCH v2 1/1] cunit : add tests for crypto APIs

2014-10-31 Thread Alexandru Badicioiu
This suite is only for async inplace mode.The tests can be reused, with
some modifications, for other modes too (sync/inplace/outplace/). Command
line argument to select the the suite(s) or separate test programs could
work too.

On 31 October 2014 16:28, Jerin Jacob 
wrote:

> On Fri, Oct 31, 2014 at 02:08:47PM +0200, alexandru.badici...@linaro.org
> wrote:
> > From: Alexandru Badicioiu 
> >
> > This patch adds a suite for async inplace mode of crypto APIs.
> > Correctness of crypto operations output is verified with known
> > test vectors  as well as various options and functionalities:
> > use session IV or operation IV for ciphering, use input packet
> > buffer or a separate buffer as the completion event, set and
> > retrieve the context associated with an operation.
>
> IMO crypto functionality unit tests should be capable of running on both
> sync and async modes.
> Platform like octeon supports only sync crypto mode.
> We can introduce a command-line option to select the mode for functional
> testcases.
> We can have separate  dedicated test to verify async/sync operation but
> crypto functional tests
> should cater both.
>
> Jerin
>
> >
> > Signed-off-by: Alexandru Badicioiu 
> > ---
> >  configure.ac  |1 +
> >  test/cunit/Makefile.am|2 +
> >  test/cunit/crypto/Makefile.am |9 +
> >  test/cunit/crypto/odp_crypto_test.c   |   26 ++
> >  test/cunit/crypto/odp_crypto_test_async_inp.c |  459
> +
> >  test/cunit/crypto/odp_crypto_test_async_inp.h |   13 +
> >  test/cunit/crypto/test_vectors.h  |   94 +
> >  7 files changed, 604 insertions(+), 0 deletions(-)
> >  create mode 100644 test/cunit/crypto/Makefile.am
> >  create mode 100644 test/cunit/crypto/odp_crypto_test.c
> >  create mode 100644 test/cunit/crypto/odp_crypto_test_async_inp.c
> >  create mode 100644 test/cunit/crypto/odp_crypto_test_async_inp.h
> >  create mode 100644 test/cunit/crypto/test_vectors.h
> >
> > diff --git a/configure.ac b/configure.ac
> > index fd69e85..b1785e9 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -166,6 +166,7 @@ AC_CONFIG_FILES([Makefile
> >test/Makefile
> >test/api_test/Makefile
> >   test/cunit/Makefile
> > +  test/cunit/crypto/Makefile
> >pkgconfig/libodp.pc])
> >
> >  AC_SEARCH_LIBS([timer_create],[rt posix4])
> > diff --git a/test/cunit/Makefile.am b/test/cunit/Makefile.am
> > index 927a5a5..7611145 100644
> > --- a/test/cunit/Makefile.am
> > +++ b/test/cunit/Makefile.am
> > @@ -3,6 +3,8 @@ include $(top_srcdir)/test/Makefile.inc
> >  AM_CFLAGS += -I$(CUNIT_PATH)/include
> >  AM_LDFLAGS += -L$(CUNIT_PATH)/lib
> >
> > +SUBDIRS = crypto
> > +
> >  if ODP_CUNIT_ENABLED
> >  TESTS = ${bin_PROGRAMS}
> >  check_PROGRAMS = ${bin_PROGRAMS}
> > diff --git a/test/cunit/crypto/Makefile.am
> b/test/cunit/crypto/Makefile.am
> > new file mode 100644
> > index 000..b984eaa
> > --- /dev/null
> > +++ b/test/cunit/crypto/Makefile.am
> > @@ -0,0 +1,9 @@
> > +include $(top_srcdir)/test/Makefile.inc
> > +
> > +if ODP_CUNIT_ENABLED
> > +bin_PROGRAMS = odp_crypto
> > +odp_crypto_LDFLAGS = $(AM_LDFLAGS) -static -lcunit
> > +endif
> > +
> > +dist_odp_crypto_SOURCES = odp_crypto_test_async_inp.c \
> > +   odp_crypto_test.c
> > diff --git a/test/cunit/crypto/odp_crypto_test.c
> b/test/cunit/crypto/odp_crypto_test.c
> > new file mode 100644
> > index 000..b5d0dea
> > --- /dev/null
> > +++ b/test/cunit/crypto/odp_crypto_test.c
> > @@ -0,0 +1,26 @@
> > +/* Copyright (c) 2014, Linaro Limited
> > + * All rights reserved.
> > + *
> > + * SPDX-License-Identifier: BSD-3-Clause
> > + */
> > +
> > +#include 
> > +#include "CUnit/Headers/Basic.h"
> > +#include "CUnit/Headers/TestDB.h"
> > +#include "odp_crypto_test_async_inp.h"
> > +
> > +int main(void)
> > +{
> > + /* initialize the CUnit test registry */
> > + if (CUE_SUCCESS != CU_initialize_registry())
> > + return CU_get_error();
> > +
> > + /* register suites */
> > + CU_register_suites(suites);
> > + /* Run all tests using the CUnit Basic interface */
> > + CU_basic_set_mode(CU_BRM_VERBOSE);
> > + CU_basic_run_tests();
> > + CU_cleanup_registry();
> > +
> > + return CU_get_error();
> > +}
> > diff --git a/test/cunit/crypto/odp_crypto_test_async_inp.c
> b/test/cunit/crypto/odp_crypto_test_async_inp.c
> > new file mode 100644
> > index 000..dd5fb5f
> > --- /dev/null
> > +++ b/test/cunit/crypto/odp_crypto_test_async_inp.c
> > @@ -0,0 +1,458 @@
> > +/* Copyright (c) 2014, Linaro Limited
> > + * All rights reserved.
> > + *
> > + * SPDX-License-Identifier:  BSD-3-Clause
> > + */
> > +
> > +#include 
> > +#include 
> > +#include "CUnit/Headers/Basic.h"
> > +#include "CUnit/Headers/TestDB.h"
> > +#include "test_vectors.h"
> > +
> > +/* Suite name */
> > +#define ODP_CRYPTO_ASYNC_INP "odp_crypto_asyn

Re: [lng-odp] [PATCH v2 1/1] cunit : add tests for crypto APIs

2014-10-31 Thread Jerin Jacob
On Fri, Oct 31, 2014 at 02:08:47PM +0200, alexandru.badici...@linaro.org wrote:
> From: Alexandru Badicioiu 
> 
> This patch adds a suite for async inplace mode of crypto APIs.
> Correctness of crypto operations output is verified with known
> test vectors  as well as various options and functionalities:
> use session IV or operation IV for ciphering, use input packet
> buffer or a separate buffer as the completion event, set and
> retrieve the context associated with an operation.

IMO crypto functionality unit tests should be capable of running on both sync 
and async modes.
Platform like octeon supports only sync crypto mode.
We can introduce a command-line option to select the mode for functional 
testcases.
We can have separate  dedicated test to verify async/sync operation but crypto 
functional tests
should cater both.

Jerin

> 
> Signed-off-by: Alexandru Badicioiu 
> ---
>  configure.ac  |1 +
>  test/cunit/Makefile.am|2 +
>  test/cunit/crypto/Makefile.am |9 +
>  test/cunit/crypto/odp_crypto_test.c   |   26 ++
>  test/cunit/crypto/odp_crypto_test_async_inp.c |  459 
> +
>  test/cunit/crypto/odp_crypto_test_async_inp.h |   13 +
>  test/cunit/crypto/test_vectors.h  |   94 +
>  7 files changed, 604 insertions(+), 0 deletions(-)
>  create mode 100644 test/cunit/crypto/Makefile.am
>  create mode 100644 test/cunit/crypto/odp_crypto_test.c
>  create mode 100644 test/cunit/crypto/odp_crypto_test_async_inp.c
>  create mode 100644 test/cunit/crypto/odp_crypto_test_async_inp.h
>  create mode 100644 test/cunit/crypto/test_vectors.h
> 
> diff --git a/configure.ac b/configure.ac
> index fd69e85..b1785e9 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -166,6 +166,7 @@ AC_CONFIG_FILES([Makefile
>test/Makefile
>test/api_test/Makefile
>   test/cunit/Makefile
> +  test/cunit/crypto/Makefile
>pkgconfig/libodp.pc])
>  
>  AC_SEARCH_LIBS([timer_create],[rt posix4])
> diff --git a/test/cunit/Makefile.am b/test/cunit/Makefile.am
> index 927a5a5..7611145 100644
> --- a/test/cunit/Makefile.am
> +++ b/test/cunit/Makefile.am
> @@ -3,6 +3,8 @@ include $(top_srcdir)/test/Makefile.inc
>  AM_CFLAGS += -I$(CUNIT_PATH)/include
>  AM_LDFLAGS += -L$(CUNIT_PATH)/lib
>  
> +SUBDIRS = crypto
> +
>  if ODP_CUNIT_ENABLED
>  TESTS = ${bin_PROGRAMS}
>  check_PROGRAMS = ${bin_PROGRAMS}
> diff --git a/test/cunit/crypto/Makefile.am b/test/cunit/crypto/Makefile.am
> new file mode 100644
> index 000..b984eaa
> --- /dev/null
> +++ b/test/cunit/crypto/Makefile.am
> @@ -0,0 +1,9 @@
> +include $(top_srcdir)/test/Makefile.inc
> +
> +if ODP_CUNIT_ENABLED
> +bin_PROGRAMS = odp_crypto
> +odp_crypto_LDFLAGS = $(AM_LDFLAGS) -static -lcunit
> +endif
> +
> +dist_odp_crypto_SOURCES = odp_crypto_test_async_inp.c \
> +   odp_crypto_test.c
> diff --git a/test/cunit/crypto/odp_crypto_test.c 
> b/test/cunit/crypto/odp_crypto_test.c
> new file mode 100644
> index 000..b5d0dea
> --- /dev/null
> +++ b/test/cunit/crypto/odp_crypto_test.c
> @@ -0,0 +1,26 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +#include 
> +#include "CUnit/Headers/Basic.h"
> +#include "CUnit/Headers/TestDB.h"
> +#include "odp_crypto_test_async_inp.h"
> +
> +int main(void)
> +{
> + /* initialize the CUnit test registry */
> + if (CUE_SUCCESS != CU_initialize_registry())
> + return CU_get_error();
> +
> + /* register suites */
> + CU_register_suites(suites);
> + /* Run all tests using the CUnit Basic interface */
> + CU_basic_set_mode(CU_BRM_VERBOSE);
> + CU_basic_run_tests();
> + CU_cleanup_registry();
> +
> + return CU_get_error();
> +}
> diff --git a/test/cunit/crypto/odp_crypto_test_async_inp.c 
> b/test/cunit/crypto/odp_crypto_test_async_inp.c
> new file mode 100644
> index 000..dd5fb5f
> --- /dev/null
> +++ b/test/cunit/crypto/odp_crypto_test_async_inp.c
> @@ -0,0 +1,458 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier:  BSD-3-Clause
> + */
> +
> +#include 
> +#include 
> +#include "CUnit/Headers/Basic.h"
> +#include "CUnit/Headers/TestDB.h"
> +#include "test_vectors.h"
> +
> +/* Suite name */
> +#define ODP_CRYPTO_ASYNC_INP "odp_crypto_async_inp"
> +
> +/* Suite init/finalize funcs */
> +/* ODP global/local initialization
> + * Packet pool creation
> + * Crypto output queue creation */
> +
> +#define SHM_PKT_POOL_SIZE  (512*2048*2)
> +#define SHM_PKT_POOL_BUF_SIZE  (1024 * 32)
> +
> +#define SHM_COMPL_POOL_SIZE  (128*1024)
> +#define SHM_COMPL_POOL_BUF_SIZE 128
> +
> +static int init(void)
> +{
> + odp_shm_t shm;
> + void *pool_base = NULL;
> + odp_buffer_pool_t pool;
> + odp_queue_t out_queue;
> +
> + if (odp_init_global(NULL, NUL