On 2014-12-12 02:30, Yan Sonming wrote:
> Remove odp_atomic_test in test/api_test and  add the odp_atomic_test
> to test/validation as one part of odp syncronizers
> 
> Signed-off-by: Yan Songming <[email protected]>
> ---
>  test/api_test/Makefile.am              |   5 +-
>  test/api_test/odp_atomic_test.c        | 299 
> ---------------------------------
>  test/api_test/odp_atomic_test.h        |  51 ------
>  test/api_test/odp_common.c             |   1 -

Remove the api_test should be in its own commit.

>  test/validation/.gitignore             |   1 +
>  test/validation/Makefile.am            |   6 +-
>  test/validation/odp_syne.c             |  15 ++

what is "syne" it doesn't make sence!
think it should be "sync"

>  test/validation/syne/odp_test_atomic.c | 258 ++++++++++++++++++++++++++++
>  test/validation/syne/odp_test_atomic.h |  14 ++

drop the _test from the filename.

>  9 files changed, 294 insertions(+), 356 deletions(-)
>  delete mode 100644 test/api_test/odp_atomic_test.c
>  delete mode 100644 test/api_test/odp_atomic_test.h
>  create mode 100644 test/validation/odp_syne.c
>  create mode 100644 test/validation/syne/odp_test_atomic.c
>  create mode 100644 test/validation/syne/odp_test_atomic.h
> 

[...]

> diff --git a/test/validation/.gitignore b/test/validation/.gitignore
> index 37e2594..22c867a 100644
> --- a/test/validation/.gitignore
> +++ b/test/validation/.gitignore
> @@ -4,3 +4,4 @@ odp_init
>  odp_queue
>  odp_crypto
>  odp_shm
> +odp_syne
> diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> index 8547085..073e72b 100644
> --- a/test/validation/Makefile.am
> +++ b/test/validation/Makefile.am
> @@ -6,13 +6,15 @@ AM_LDFLAGS += -static
>  if ODP_CUNIT_ENABLED
>  TESTS = ${bin_PROGRAMS}
>  check_PROGRAMS = ${bin_PROGRAMS}
> -bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm
> +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_syne
>  odp_init_LDFLAGS = $(AM_LDFLAGS)
>  odp_queue_LDFLAGS = $(AM_LDFLAGS)
>  odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
>  odp_crypto_LDFLAGS = $(AM_LDFLAGS)
>  odp_shm_CFLAGS = $(AM_CFLAGS)
>  odp_shm_LDFLAGS = $(AM_LDFLAGS)
> +odp_syne_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/syne
> +odp_syne_LDFLAGS = $(AM_LDFLAGS)
>  endif
>  
>  dist_odp_init_SOURCES = odp_init.c
> @@ -22,3 +24,5 @@ dist_odp_crypto_SOURCES = 
> crypto/odp_crypto_test_async_inp.c \
>                         crypto/odp_crypto_test_rng.c \
>                         odp_crypto.c common/odp_cunit_common.c
>  dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
> +dist_odp_syne_SOURCES = odp_syne.c   syne/odp_test_atomic.c\
> +                     common/odp_cunit_common.c
> diff --git a/test/validation/odp_syne.c b/test/validation/odp_syne.c
> new file mode 100644
> index 0000000..9a39740
> --- /dev/null
> +++ b/test/validation/odp_syne.c
> @@ -0,0 +1,15 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier:     BSD-3-Clause
> + */
> +
> +#include <odp.h>
> +#include <odp_cunit_common.h>
> +#include "odp_test_atomic.h"
> +
> +CU_SuiteInfo odp_testsuites[] = {
> +     {"ODP_ATOMIC", NULL, NULL, NULL, NULL, test_odp_atomic},
> +     /* {"ODP_LOCK", NULL, NULL, NULL, NULL, test_odp_lock},*/
> +     CU_SUITE_INFO_NULL,
> +};
> diff --git a/test/validation/syne/odp_test_atomic.c 
> b/test/validation/syne/odp_test_atomic.c
> new file mode 100644
> index 0000000..3f983fa
> --- /dev/null
> +++ b/test/validation/syne/odp_test_atomic.c
> @@ -0,0 +1,258 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier:     BSD-3-Clause
> + */
> +
> +#include <string.h>
> +#include <odp.h>
> +#include <odp_cunit_common.h>
> +
> +static odp_atomic_u32_t a32u;
> +static odp_atomic_u64_t a64u;
> +
> +
> +#define ADD_SUB_CNT  5
> +
> +#define      CNT 10
> +#define      U32_INIT_VAL    (1UL << 10)
> +#define      U64_INIT_VAL    (1ULL << 33)
> +
> +
> +static void test_atomic_inc_u32(void)
> +{
> +     int i;
> +
> +     for (i = 0; i < CNT; i++)
> +             odp_atomic_inc_u32(&a32u);
> +}
> +
> +static void test_atomic_inc_64(void)
> +{
> +     int i;
> +
> +     for (i = 0; i < CNT; i++)
> +             odp_atomic_inc_u64(&a64u);
> +}
> +
> +static void test_atomic_dec_u32(void)
> +{
> +     int i;
> +
> +     for (i = 0; i < CNT; i++)
> +             odp_atomic_dec_u32(&a32u);
> +}
> +
> +static void test_atomic_dec_64(void)
> +{
> +     int i;
> +
> +     for (i = 0; i < CNT; i++)
> +             odp_atomic_dec_u64(&a64u);
> +}
> +static void test_atomic_fetch_inc_u32(void)
> +{
> +     int i;
> +
> +     for (i = 0; i < CNT; i++)
> +             odp_atomic_fetch_inc_u32(&a32u);
> +}
> +
> +static void test_atomic_fetch_inc_64(void)
> +{
> +     int i;
> +
> +     for (i = 0; i < CNT; i++)
> +             odp_atomic_fetch_inc_u64(&a64u);
> +}
> +
> +static void test_atomic_fetch_dec_u32(void)
> +{
> +     int i;
> +
> +     for (i = 0; i < CNT; i++)
> +             odp_atomic_fetch_dec_u32(&a32u);
> +}
> +
> +static void test_atomic_fetch_dec_64(void)
> +{
> +     int i;
> +
> +     for (i = 0; i < CNT; i++)
> +             odp_atomic_fetch_dec_u64(&a64u);
> +}
> +
> +static void test_atomic_add_u32(void)
> +{
> +     int i;
> +
> +     for (i = 0; i < CNT; i++)
> +             odp_atomic_add_u32(&a32u, ADD_SUB_CNT);
> +}
> +static void test_atomic_add_64(void)
> +{
> +     int i;
> +
> +     for (i = 0; i < CNT; i++)
> +             odp_atomic_add_u64(&a64u, ADD_SUB_CNT);
> +}
> +
> +static void test_atomic_sub_u32(void)
> +{
> +     int i;
> +
> +     for (i = 0; i < CNT; i++)
> +             odp_atomic_sub_u32(&a32u, ADD_SUB_CNT);
> +}
> +
> +static void test_atomic_sub_64(void)
> +{
> +     int i;
> +
> +     for (i = 0; i < CNT; i++)
> +             odp_atomic_sub_u64(&a64u, ADD_SUB_CNT);
> +}
> +
> +static void test_atomic_fetch_add_u32(void)
> +{
> +     int i;
> +
> +     for (i = 0; i < CNT; i++)
> +             odp_atomic_fetch_add_u32(&a32u, ADD_SUB_CNT);
> +}
> +
> +static void test_atomic_fetch_add_64(void)
> +{
> +     int i;
> +
> +     for (i = 0; i < CNT; i++)
> +             odp_atomic_fetch_add_u64(&a64u, ADD_SUB_CNT);
> +}
> +static void test_atomic_fetch_sub_u32(void)
> +{
> +     int i;
> +
> +     for (i = 0; i < CNT; i++)
> +             odp_atomic_fetch_sub_u32(&a32u, ADD_SUB_CNT);
> +}
> +
> +static void test_atomic_fetch_sub_64(void)
> +{
> +     int i;
> +
> +     for (i = 0; i < CNT; i++)
> +             odp_atomic_fetch_sub_u64(&a64u, ADD_SUB_CNT);
> +}
> +
> +static void test_atomic_inc_dec_u32(void)
> +{
> +     test_atomic_inc_u32();
> +     test_atomic_dec_u32();
> +}
> +
> +static void test_atomic_inc_dec_64(void)
> +{
> +     test_atomic_inc_64();
> +     test_atomic_dec_64();
> +}
> +
> +static void test_atomic_fetch_inc_dec_u32(void)
> +{
> +     test_atomic_fetch_inc_u32();
> +     test_atomic_fetch_dec_u32();
> +}
> +
> +static void test_atomic_fetch_inc_dec_64(void)
> +{
> +     test_atomic_fetch_inc_64();
> +     test_atomic_fetch_dec_64();
> +}
> +
> +
> +static void test_atomic_add_sub_u32(void)
> +{
> +     test_atomic_add_u32();
> +     test_atomic_sub_u32();
> +}
> +
> +
> +static void test_atomic_add_sub_64(void)
> +{
> +     test_atomic_add_64();
> +     test_atomic_sub_64();
> +}
> +
> +static void test_atomic_fetch_add_sub_u32(void)
> +{
> +     test_atomic_fetch_add_u32();
> +     test_atomic_fetch_sub_u32();
> +}
> +
> +static void test_atomic_fetch_add_sub_64(void)
> +{
> +     test_atomic_fetch_add_64();
> +     test_atomic_fetch_sub_64();
> +}
> +
> +static void test_atomic_init(void)
> +{
> +     odp_atomic_init_u32(&a32u, 0);
> +     odp_atomic_init_u64(&a64u, 0);
> +}
> +
> +static void test_atomic_store(void)
> +{
> +     odp_atomic_store_u32(&a32u, U32_INIT_VAL);
> +     odp_atomic_store_u64(&a64u, U64_INIT_VAL);
> +}
> +
> +static void test_atomic_validate(void)
> +{
> +     CU_ASSERT(U32_INIT_VAL == odp_atomic_load_u32(&a32u));
> +     CU_ASSERT(U64_INIT_VAL == odp_atomic_load_u64(&a64u));
> +}
> +static void test_atomic_basic(void)
> +{
> +     test_atomic_init();
> +     test_atomic_store();
> +     test_atomic_validate();
> +}
> +static void test_atomic_inc_dec(void)
> +{
> +     test_atomic_store();
> +     test_atomic_inc_dec_u32();
> +     test_atomic_inc_dec_64();
> +     test_atomic_validate();
> +}
> +
> +static void test_atomic_fetch_inc_dec(void)
> +{
> +     test_atomic_store();
> +     test_atomic_fetch_inc_dec_u32();
> +     test_atomic_fetch_inc_dec_64();
> +     test_atomic_validate();
> +}
> +
> +static void test_atomic_add_sub(void)
> +{
> +     test_atomic_store();
> +     test_atomic_add_sub_u32();
> +     test_atomic_add_sub_64();
> +     test_atomic_validate();
> +}
> +static void test_atomic_fetch_add_sub(void)
> +{
> +     test_atomic_store();
> +     test_atomic_fetch_add_sub_u32();
> +     test_atomic_fetch_add_sub_64();
> +     test_atomic_validate();
> +}
> +
> +CU_TestInfo test_odp_atomic[] = {
> +     {"test_odp_atomic_basic",    test_atomic_basic},
> +     {"test_odp_atomic_inc_dec",  test_atomic_inc_dec},
> +     {"test_odp_atomic_add_sub",  test_atomic_add_sub},
> +     {"test_odp_atomic_fetch_inc_dec",  test_atomic_fetch_inc_dec},
> +     {"test_odp_atomic_fetch_add_sub",  test_atomic_fetch_add_sub},
> +     CU_TEST_INFO_NULL,
> +};
> diff --git a/test/validation/syne/odp_test_atomic.h 
> b/test/validation/syne/odp_test_atomic.h
> new file mode 100644
> index 0000000..a51a26a
> --- /dev/null
> +++ b/test/validation/syne/odp_test_atomic.h
> @@ -0,0 +1,14 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier:  BSD-3-Clause
> + */
> +#ifndef ODP_TEST_ATOMIC_
> +#define ODP_TEST_ATOMIC_
> +
> +#include "CUnit/TestDB.h"
> +
> +/* Suite test array */
> +extern CU_TestInfo test_odp_atomic[];
> +
> +#endif

I don't think the header file is worth having.
Just add it in odp_syne.c directly.

Cheers,
Anders

_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to