Merged,
Maxim.

On 10/29/2015 18:26, Bill Fischofer wrote:


On Thu, Oct 29, 2015 at 9:52 AM, Petri Savolainen <petri.savolai...@nokia.com <mailto:petri.savolai...@nokia.com>> wrote:

    Added validation tests for ODP std C library API.

    Signed-off-by: Petri Savolainen <petri.savolai...@nokia.com
    <mailto:petri.savolai...@nokia.com>>


Reviewed-and-Tested-by: Bill Fischofer <bill.fischo...@linaro.org <mailto:bill.fischo...@linaro.org>>

    ---
    configure.ac <http://configure.ac>                      |  1 +
     platform/linux-generic/test/Makefile.am  |  1 +
     test/validation/Makefile.am              |  1 +
     test/validation/std_clib/.gitignore      |  1 +
     test/validation/std_clib/Makefile.am     | 10 +++++
     test/validation/std_clib/std_clib.c      | 66
    ++++++++++++++++++++++++++++++++
     test/validation/std_clib/std_clib.h      | 21 ++++++++++
     test/validation/std_clib/std_clib_main.c | 12 ++++++
     8 files changed, 113 insertions(+)
     create mode 100644 test/validation/std_clib/.gitignore
     create mode 100644 test/validation/std_clib/Makefile.am
     create mode 100644 test/validation/std_clib/std_clib.c
     create mode 100644 test/validation/std_clib/std_clib.h
     create mode 100644 test/validation/std_clib/std_clib_main.c

    diff --git a/configure.ac <http://configure.ac> b/configure.ac
    <http://configure.ac>
    index 8e94d82..9887589 100644
    --- a/configure.ac <http://configure.ac>
    +++ b/configure.ac <http://configure.ac>
    @@ -326,6 +326,7 @@ AC_CONFIG_FILES([Makefile
                     test/validation/queue/Makefile
                     test/validation/random/Makefile
                     test/validation/scheduler/Makefile
    +                test/validation/std_clib/Makefile
                     test/validation/synchronizers/Makefile
                     test/validation/thread/Makefile
                     test/validation/time/Makefile
    diff --git a/platform/linux-generic/test/Makefile.am
    b/platform/linux-generic/test/Makefile.am
    index a657de9..24285c1 100644
    --- a/platform/linux-generic/test/Makefile.am
    +++ b/platform/linux-generic/test/Makefile.am
    @@ -19,6 +19,7 @@ TESTS = pktio/pktio_run \
    ${top_builddir}/test/validation/queue/queue_main$(EXEEXT) \
    ${top_builddir}/test/validation/random/random_main$(EXEEXT) \
    ${top_builddir}/test/validation/scheduler/scheduler_main$(EXEEXT) \
    +  ${top_builddir}/test/validation/std_clib/std_clib_main$(EXEEXT) \
    ${top_builddir}/test/validation/synchronizers/synchronizers_main$(EXEEXT)
    \
    ${top_builddir}/test/validation/thread/thread_main$(EXEEXT) \
    ${top_builddir}/test/validation/time/time_main$(EXEEXT) \
    diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
    index 4f926ce..1711b93 100644
    --- a/test/validation/Makefile.am
    +++ b/test/validation/Makefile.am
    @@ -12,6 +12,7 @@ ODP_MODULES = buffer \
                  pool \
                  random \
                  scheduler \
    +             std_clib \
                  synchronizers \
                  thread \
                  time \
    diff --git a/test/validation/std_clib/.gitignore
    b/test/validation/std_clib/.gitignore
    new file mode 100644
    index 0000000..3782833
    --- /dev/null
    +++ b/test/validation/std_clib/.gitignore
    @@ -0,0 +1 @@
    +std_clib_main
    diff --git a/test/validation/std_clib/Makefile.am
    b/test/validation/std_clib/Makefile.am
    new file mode 100644
    index 0000000..aa02be6
    --- /dev/null
    +++ b/test/validation/std_clib/Makefile.am
    @@ -0,0 +1,10 @@
    +include ../Makefile.inc
    +
    +noinst_LTLIBRARIES = libteststd_clib.la <http://libteststd_clib.la>
    +libteststd_clib_la_SOURCES = std_clib.c
    +
    +bin_PROGRAMS = std_clib_main$(EXEEXT)
    +dist_std_clib_main_SOURCES = std_clib_main.c
    +std_clib_main_LDADD = libteststd_clib.la
    <http://libteststd_clib.la> $(LIBCUNIT_COMMON) $(LIBODP)
    +
    +EXTRA_DIST = std_clib.h
    diff --git a/test/validation/std_clib/std_clib.c
    b/test/validation/std_clib/std_clib.c
    new file mode 100644
    index 0000000..e53ad39
    --- /dev/null
    +++ b/test/validation/std_clib/std_clib.c
    @@ -0,0 +1,66 @@
    +/* Copyright (c) 2015, Linaro Limited
    + * All rights reserved.
    + *
    + * SPDX-License-Identifier:     BSD-3-Clause
    + */
    +
    +#include <odp.h>
    +#include <odp_cunit_common.h>
    +#include "std_clib.h"
    +
    +#include <string.h>
    +
    +#define PATTERN 0x5e
    +
    +static void std_clib_test_memcpy(void)
    +{
    +       uint8_t src[] = {0, 1,  2,  3,  4,  5,  6,  7,
    +                        8, 9, 10, 11, 12, 13, 14, 15};
    +       uint8_t dst[16];
    +       int ret;
    +
    +       memset(dst, 0, sizeof(dst));
    +
    +       odp_memcpy(dst, src, sizeof(dst));
    +
    +       ret = memcmp(dst, src, sizeof(dst));
    +
    +       CU_ASSERT(ret == 0);
    +}
    +
    +static void std_clib_test_memset(void)
    +{
    +       uint8_t data[] = {0, 1,  2,  3,  4,  5,  6,  7,
    +                         8, 9, 10, 11, 12, 13, 14, 15};
    +       uint8_t ref[16];
    +       int ret;
    +
    +       odp_memset(data, PATTERN, sizeof(data));
    +
    +       memset(ref, PATTERN, sizeof(ref));
    +
    +       ret = memcmp(data, ref, sizeof(data));
    +
    +       CU_ASSERT(ret == 0);
    +}
    +
    +odp_testinfo_t std_clib_suite[] = {
    +       ODP_TEST_INFO(std_clib_test_memcpy),
    +       ODP_TEST_INFO(std_clib_test_memset),
    +       ODP_TEST_INFO_NULL,
    +};
    +
    +odp_suiteinfo_t std_clib_suites[] = {
    +       {"Std C library", NULL, NULL, std_clib_suite},
    +       ODP_SUITE_INFO_NULL
    +};
    +
    +int std_clib_main(void)
    +{
    +       int ret = odp_cunit_register(std_clib_suites);
    +
    +       if (ret == 0)
    +               ret = odp_cunit_run();
    +
    +       return ret;
    +}
    diff --git a/test/validation/std_clib/std_clib.h
    b/test/validation/std_clib/std_clib.h
    new file mode 100644
    index 0000000..eab6872
    --- /dev/null
    +++ b/test/validation/std_clib/std_clib.h
    @@ -0,0 +1,21 @@
    +/* Copyright (c) 2015, Linaro Limited
    + * All rights reserved.
    + *
    + * SPDX-License-Identifier:     BSD-3-Clause
    + */
    +
    +#ifndef _ODP_TEST_STD_CLIB_H_
    +#define _ODP_TEST_STD_CLIB_H_
    +
    +#include <odp_cunit_common.h>
    +
    +/* test arrays: */
    +extern odp_testinfo_t std_clib_suite[];
    +
    +/* test registry: */
    +extern odp_suiteinfo_t std_clib_suites[];
    +
    +/* main test program: */
    +int std_clib_main(void);
    +
    +#endif
    diff --git a/test/validation/std_clib/std_clib_main.c
    b/test/validation/std_clib/std_clib_main.c
    new file mode 100644
    index 0000000..010c1c6
    --- /dev/null
    +++ b/test/validation/std_clib/std_clib_main.c
    @@ -0,0 +1,12 @@
    +/* Copyright (c) 2015, Linaro Limited
    + * All rights reserved.
    + *
    + * SPDX-License-Identifier:     BSD-3-Clause
    + */
    +
    +#include "std_clib.h"
    +
    +int main(void)
    +{
    +       return std_clib_main();
    +}
    --
    2.6.2

    _______________________________________________
    lng-odp mailing list
    lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
    https://lists.linaro.org/mailman/listinfo/lng-odp




_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to