Which names need fixing? For example, std_clib_test_memcpy(void) tests odp_memcpy() of the module “std_clib”.
-Petri From: EXT Christophe Milard [mailto:[email protected]] Sent: Thursday, November 05, 2015 12:44 PM To: Savolainen, Petri (Nokia - FI/Espoo) Cc: EXT Maxim Uvarov; LNG ODP Mailman List Subject: Re: [lng-odp] [API-NEXT PATCH] validation: std_clib: added validation tests ok.then it is the right place in the structure. Are you fixing the names, Petri? On 5 November 2015 at 11:35, Savolainen, Petri (Nokia - FI/Espoo) <[email protected]<mailto:[email protected]>> wrote: /** * @defgroup odp_std_clib ODP STD CLIB * @details * ODP version of often used C library calls * @{ */ The module name is “std_clib”. I did try to use that as the module name. You can find e.g. std_clib.h in api-next. -Petri From: EXT Christophe Milard [mailto:[email protected]<mailto:[email protected]>] Sent: Thursday, November 05, 2015 12:28 PM To: Savolainen, Petri (Nokia - FI/Espoo) Cc: EXT Maxim Uvarov; LNG ODP Mailman List Subject: Re: [lng-odp] [API-NEXT PATCH] validation: std_clib: added validation tests /doc/implementers-guide/implementers-guide.html: 2.1.2. Module test and naming convention • Tests, i.e. C functions which are used in CUnit test suites are named: <Module>_test_* where the suffix idendify the test. • Test arrays, i.e. arrays of odp_testinfo_t, 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. where the possible extra middle pattern can be used if many suites are declared. • Suite arrays, i.e. arrays of odp_suiteinfo_t used in executables (CUnit registry) are called: <Module>_suites[_*] where the possible suffix identifies the executable using it, if many. • Main executable function(s), are called: <Module>_main[_*] where the possible suffix identifies the executable, if many, using it. • Init/term functions for the whole executable are called: <Module>_init <Module>_term All the above symbols are part of the generated libtest<Module>.la libraries. The generated main executable(s) (named <module>_main[_*], where the optional suffix is used to distinguish the executables belonging to the same module, if many) simply call(s) the related <Module>_main[_*] from the library. On 5 November 2015 at 11:16, Savolainen, Petri (Nokia - FI/Espoo) <[email protected]<mailto:[email protected]>> wrote: What rules exactly? From: EXT Christophe Milard [mailto:[email protected]<mailto:[email protected]>] Sent: Thursday, November 05, 2015 12:15 PM To: Savolainen, Petri (Nokia - FI/Espoo) Cc: EXT Maxim Uvarov; LNG ODP Mailman List Subject: Re: [lng-odp] [API-NEXT PATCH] validation: std_clib: added validation tests Also, this patch does not respect the test naming convention rules. /Christophe. On 5 November 2015 at 11:12, Christophe Milard <[email protected]<mailto:[email protected]>> wrote: but why should ODP tests test the C lib, as it is not part of ODP? If there is a good reason to do so (which I do not unerstand at this stage), I think the test sould be placed elsewhere. On 5 November 2015 at 11:06, Savolainen, Petri (Nokia - FI/Espoo) <[email protected]<mailto:[email protected]>> wrote: It’s asn ODP module. It tests ODP version of (optimized) common C lib calls – like odp_memcpy() -Petri +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); +} From: EXT Christophe Milard [mailto:[email protected]<mailto:[email protected]>] Sent: Thursday, November 05, 2015 12:02 PM To: Savolainen, Petri (Nokia - FI/Espoo) Cc: EXT Maxim Uvarov; LNG ODP Mailman List Subject: Re: [lng-odp] [API-NEXT PATCH] validation: std_clib: added validation tests This is not a ODP module, is it? should/could it be one? I am not sure either what is the point of testing libC? If the question is to make sure that libc contains such or such function, I thing we should first decide which libC to use. ( see Jira ODP 224 ) But maybe I am missing some point... /Christophe. On 5 November 2015 at 09:52, Savolainen, Petri (Nokia - FI/Espoo) <[email protected]<mailto:[email protected]>> wrote: Ping. From: EXT Bill Fischofer [mailto:[email protected]<mailto:[email protected]>] Sent: Thursday, October 29, 2015 5:27 PM To: Savolainen, Petri (Nokia - FI/Espoo) Cc: LNG ODP Mailman List Subject: Re: [lng-odp] [API-NEXT PATCH] validation: std_clib: added validation tests On Thu, Oct 29, 2015 at 9:52 AM, Petri Savolainen <[email protected]<mailto:[email protected]>> wrote: Added validation tests for ODP std C library API. Signed-off-by: Petri Savolainen <[email protected]<mailto:[email protected]>> Reviewed-and-Tested-by: Bill Fischofer <[email protected]<mailto:[email protected]>> --- 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 [email protected]<mailto:[email protected]> https://lists.linaro.org/mailman/listinfo/lng-odp _______________________________________________ lng-odp mailing list [email protected]<mailto:[email protected]> https://lists.linaro.org/mailman/listinfo/lng-odp
_______________________________________________ lng-odp mailing list [email protected] https://lists.linaro.org/mailman/listinfo/lng-odp
