Message ID | 1425426661-12398-1-git-send-email-bill.fischofer@linaro.org |
---|---|
State | New |
Headers | show |
I wonder if these tests should be in their respective API area test files as not just as an additional test file. What I mean is that in general we have test suites per API module:- odp_packet odp_buffer odp_pool odp_schedule odp_crypto odp_shm This would result in for example all crypto tests being in the crypto test suite and not spread out. On 3 March 2015 at 18:51, Bill Fischofer <bill.fischofer@linaro.org> wrote: > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> > --- > test/validation/.gitignore | 1 + > test/validation/Makefile.am | 2 + > test/validation/odp_strongtypes.c | 86 > +++++++++++++++++++++++++++++++++++++++ > 3 files changed, 89 insertions(+) > create mode 100644 test/validation/odp_strongtypes.c > > diff --git a/test/validation/.gitignore b/test/validation/.gitignore > index 2eab34c..1f7f37e 100644 > --- a/test/validation/.gitignore > +++ b/test/validation/.gitignore > @@ -14,6 +14,7 @@ odp_queue > odp_random > odp_schedule > odp_shm > +odp_strongtypes > odp_synchronizers > odp_system > odp_time > diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am > index 0833181..4d04349 100644 > --- a/test/validation/Makefile.am > +++ b/test/validation/Makefile.am > @@ -17,6 +17,7 @@ EXECUTABLES = odp_buffer \ > odp_random \ > odp_schedule \ > odp_shm \ > + odp_strongtypes \ > odp_system \ > odp_synchronizers \ > odp_time \ > @@ -52,6 +53,7 @@ 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_strongtypes_SOURCES = odp_strongtypes.c $(ODP_CU_COMMON) > dist_odp_system_SOURCES = odp_system.c $(ODP_CU_COMMON) > dist_odp_synchronizers_SOURCES = odp_synchronizers.c $(ODP_CU_COMMON) > dist_odp_time_SOURCES = odp_time.c $(ODP_CU_COMMON) > diff --git a/test/validation/odp_strongtypes.c > b/test/validation/odp_strongtypes.c > new file mode 100644 > index 0000000..29407b5 > --- /dev/null > +++ b/test/validation/odp_strongtypes.c > @@ -0,0 +1,86 @@ > +/* Copyright (c) 2015, Linaro Limited > + * All rights reserved. > + * > + * SPDX-License-Identifier: BSD-3-Clause > + */ > + > +#include <odp.h> > +#include <CUnit/Basic.h> > + > +static void test_odp_strong_types(void) > +{ > + odp_buffer_t buf = ODP_BUFFER_INVALID; > + odp_cos_t cos = ODP_COS_INVALID; > + odp_pmr_t pmr = ODP_PMR_INVAL; > + odp_pmr_set_t pmrset = ODP_PMR_SET_INVAL; > + odp_crypto_session_t csession = ODP_CRYPTO_SESSION_INVALID; > + /* odp_crypto_compl_t ccompl; */ > + odp_event_t evt = ODP_EVENT_INVALID; > + odp_pktio_t pktio = ODP_PKTIO_INVALID; > + odp_packet_t pkt = ODP_PACKET_INVALID; > + odp_packet_seg_t pktseg = ODP_PACKET_SEG_INVALID; > + odp_pool_t pool = ODP_POOL_INVALID; > + odp_queue_t queue = ODP_QUEUE_INVALID; > + odp_shm_t shm = ODP_SHM_INVALID; > + > + /* > + * Note: These type conversion functions have no defined return > values > + * since they produce implementation-defined values for display > + * purposes. This test simply verifies that they exist and can be > + * invoked. > + */ > + > + CU_ASSERT(odp_buffer_to_u64(buf) == > + odp_buffer_to_u64(ODP_BUFFER_INVALID)); > + > + CU_ASSERT(odp_cos_to_u64(cos) == > + odp_cos_to_u64(ODP_COS_INVALID)); > + > + CU_ASSERT(odp_pmr_to_u64(pmr) == > + odp_pmr_to_u64(ODP_PMR_INVAL)); > + > + CU_ASSERT(odp_pmr_set_to_u64(pmrset) == > + odp_pmr_set_to_u64(ODP_PMR_SET_INVAL)); > + > + CU_ASSERT(odp_crypto_session_to_u64(csession) == > + odp_crypto_session_to_u64(ODP_CRYPTO_SESSION_INVALID)); > + > + /* > + CU_ASSERT(odp_crypto_compl_to_u64(ccompl) == > + odp_crypto_compl_to_u64(ccompl)); > + */ > + > + CU_ASSERT(odp_event_to_u64(evt) == > + odp_event_to_u64(ODP_EVENT_INVALID)); > + > + CU_ASSERT(odp_pktio_to_u64(pktio) == > + odp_pktio_to_u64(ODP_PKTIO_INVALID)); > + > + CU_ASSERT(odp_packet_to_u64(pkt) == > + odp_packet_to_u64(ODP_PACKET_INVALID)); > + > + CU_ASSERT(odp_packet_seg_to_u64(pktseg) == > + odp_packet_seg_to_u64(ODP_PACKET_SEG_INVALID)); > + > + CU_ASSERT(odp_pool_to_u64(pool) == > + odp_pool_to_u64(ODP_POOL_INVALID)); > + > + CU_ASSERT(odp_queue_to_u64(queue) == > + odp_queue_to_u64(ODP_QUEUE_INVALID)); > + > + CU_ASSERT(odp_shm_to_u64(shm) == > + odp_shm_to_u64(ODP_SHM_INVALID)); > +} > + > +CU_TestInfo test_odp_type_display[] = { > + {"ODP abstract type diplay test", test_odp_strong_types}, > + CU_TEST_INFO_NULL, > +}; > + > +CU_SuiteInfo odp_testsuites[] = { > + { "ODP abstract type display functions", > + NULL, NULL, NULL, NULL, > + test_odp_type_display, > + }, > + CU_SUITE_INFO_NULL, > +}; > -- > 2.1.0 > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp >
Possibly. i can do that if there's consensus that that's the way to go. Bill On Thu, Mar 5, 2015 at 2:29 PM, Mike Holmes <mike.holmes@linaro.org> wrote: > I wonder if these tests should be in their respective API area test files > as not just as an additional test file. > > What I mean is that in general we have test suites per API module:- > > odp_packet > odp_buffer > odp_pool > odp_schedule > odp_crypto > odp_shm > > This would result in for example all crypto tests being in the crypto test > suite and not spread out. > > On 3 March 2015 at 18:51, Bill Fischofer <bill.fischofer@linaro.org> > wrote: > >> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> >> --- >> test/validation/.gitignore | 1 + >> test/validation/Makefile.am | 2 + >> test/validation/odp_strongtypes.c | 86 >> +++++++++++++++++++++++++++++++++++++++ >> 3 files changed, 89 insertions(+) >> create mode 100644 test/validation/odp_strongtypes.c >> >> diff --git a/test/validation/.gitignore b/test/validation/.gitignore >> index 2eab34c..1f7f37e 100644 >> --- a/test/validation/.gitignore >> +++ b/test/validation/.gitignore >> @@ -14,6 +14,7 @@ odp_queue >> odp_random >> odp_schedule >> odp_shm >> +odp_strongtypes >> odp_synchronizers >> odp_system >> odp_time >> diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am >> index 0833181..4d04349 100644 >> --- a/test/validation/Makefile.am >> +++ b/test/validation/Makefile.am >> @@ -17,6 +17,7 @@ EXECUTABLES = odp_buffer \ >> odp_random \ >> odp_schedule \ >> odp_shm \ >> + odp_strongtypes \ >> odp_system \ >> odp_synchronizers \ >> odp_time \ >> @@ -52,6 +53,7 @@ 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_strongtypes_SOURCES = odp_strongtypes.c $(ODP_CU_COMMON) >> dist_odp_system_SOURCES = odp_system.c $(ODP_CU_COMMON) >> dist_odp_synchronizers_SOURCES = odp_synchronizers.c $(ODP_CU_COMMON) >> dist_odp_time_SOURCES = odp_time.c $(ODP_CU_COMMON) >> diff --git a/test/validation/odp_strongtypes.c >> b/test/validation/odp_strongtypes.c >> new file mode 100644 >> index 0000000..29407b5 >> --- /dev/null >> +++ b/test/validation/odp_strongtypes.c >> @@ -0,0 +1,86 @@ >> +/* Copyright (c) 2015, Linaro Limited >> + * All rights reserved. >> + * >> + * SPDX-License-Identifier: BSD-3-Clause >> + */ >> + >> +#include <odp.h> >> +#include <CUnit/Basic.h> >> + >> +static void test_odp_strong_types(void) >> +{ >> + odp_buffer_t buf = ODP_BUFFER_INVALID; >> + odp_cos_t cos = ODP_COS_INVALID; >> + odp_pmr_t pmr = ODP_PMR_INVAL; >> + odp_pmr_set_t pmrset = ODP_PMR_SET_INVAL; >> + odp_crypto_session_t csession = ODP_CRYPTO_SESSION_INVALID; >> + /* odp_crypto_compl_t ccompl; */ >> + odp_event_t evt = ODP_EVENT_INVALID; >> + odp_pktio_t pktio = ODP_PKTIO_INVALID; >> + odp_packet_t pkt = ODP_PACKET_INVALID; >> + odp_packet_seg_t pktseg = ODP_PACKET_SEG_INVALID; >> + odp_pool_t pool = ODP_POOL_INVALID; >> + odp_queue_t queue = ODP_QUEUE_INVALID; >> + odp_shm_t shm = ODP_SHM_INVALID; >> + >> + /* >> + * Note: These type conversion functions have no defined return >> values >> + * since they produce implementation-defined values for display >> + * purposes. This test simply verifies that they exist and can be >> + * invoked. >> + */ >> + >> + CU_ASSERT(odp_buffer_to_u64(buf) == >> + odp_buffer_to_u64(ODP_BUFFER_INVALID)); >> + >> + CU_ASSERT(odp_cos_to_u64(cos) == >> + odp_cos_to_u64(ODP_COS_INVALID)); >> + >> + CU_ASSERT(odp_pmr_to_u64(pmr) == >> + odp_pmr_to_u64(ODP_PMR_INVAL)); >> + >> + CU_ASSERT(odp_pmr_set_to_u64(pmrset) == >> + odp_pmr_set_to_u64(ODP_PMR_SET_INVAL)); >> + >> + CU_ASSERT(odp_crypto_session_to_u64(csession) == >> + odp_crypto_session_to_u64(ODP_CRYPTO_SESSION_INVALID)); >> + >> + /* >> + CU_ASSERT(odp_crypto_compl_to_u64(ccompl) == >> + odp_crypto_compl_to_u64(ccompl)); >> + */ >> + >> + CU_ASSERT(odp_event_to_u64(evt) == >> + odp_event_to_u64(ODP_EVENT_INVALID)); >> + >> + CU_ASSERT(odp_pktio_to_u64(pktio) == >> + odp_pktio_to_u64(ODP_PKTIO_INVALID)); >> + >> + CU_ASSERT(odp_packet_to_u64(pkt) == >> + odp_packet_to_u64(ODP_PACKET_INVALID)); >> + >> + CU_ASSERT(odp_packet_seg_to_u64(pktseg) == >> + odp_packet_seg_to_u64(ODP_PACKET_SEG_INVALID)); >> + >> + CU_ASSERT(odp_pool_to_u64(pool) == >> + odp_pool_to_u64(ODP_POOL_INVALID)); >> + >> + CU_ASSERT(odp_queue_to_u64(queue) == >> + odp_queue_to_u64(ODP_QUEUE_INVALID)); >> + >> + CU_ASSERT(odp_shm_to_u64(shm) == >> + odp_shm_to_u64(ODP_SHM_INVALID)); >> +} >> + >> +CU_TestInfo test_odp_type_display[] = { >> + {"ODP abstract type diplay test", test_odp_strong_types}, >> + CU_TEST_INFO_NULL, >> +}; >> + >> +CU_SuiteInfo odp_testsuites[] = { >> + { "ODP abstract type display functions", >> + NULL, NULL, NULL, NULL, >> + test_odp_type_display, >> + }, >> + CU_SUITE_INFO_NULL, >> +}; >> -- >> 2.1.0 >> >> >> _______________________________________________ >> lng-odp mailing list >> lng-odp@lists.linaro.org >> http://lists.linaro.org/mailman/listinfo/lng-odp >> > > > > -- > Mike Holmes > Technical Manager - Linaro Networking Group > Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs > > >
On 03/06/15 11:25, Savolainen, Petri (Nokia - FI/Espoo) wrote: > > I agree with Mike. There’s no strong type API and these tests are not > testing strong typing - but those handle conversion functions (from > various APIs). Also strong typing is a linux-generic feature and not > mandated by the API spec. > > Still it would be nice to add a strong typing test for linux-generic > (implementation specific testing during ‘make check’). How we could > verify easily and automatically that passing a wrong type causes a > build error (caused by the wrong type)? If it’s not regression tested, > we may lose the feature for some handle type without noticing. > > -Petri > should that tests be in ./platform/linux-generic/tests directory? I would like to move there also pktio scripts which set up environment for tests. Maxim. > *From:*lng-odp-bounces@lists.linaro.org > [mailto:lng-odp-bounces@lists.linaro.org] *On Behalf Of *ext Bill > Fischofer > *Sent:* Friday, March 06, 2015 6:11 AM > *To:* Mike Holmes > *Cc:* lng-odp > *Subject:* Re: [lng-odp] [PATCHv2] validation: strongtypes: add unit > tests for strong type display functions > > Possibly. i can do that if there's consensus that that's the way to go. > > Bill > > On Thu, Mar 5, 2015 at 2:29 PM, Mike Holmes <mike.holmes@linaro.org > <mailto:mike.holmes@linaro.org>> wrote: > > I wonder if these tests should be in their respective API area test > files as not just as an additional test file. > > What I mean is that in general we have test suites per API module:- > > odp_packet > > odp_buffer > > odp_pool > > odp_schedule > > odp_crypto > > odp_shm > > This would result in for example all crypto tests being in the crypto > test suite and not spread out. > > On 3 March 2015 at 18:51, Bill Fischofer <bill.fischofer@linaro.org > <mailto:bill.fischofer@linaro.org>> wrote: > > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org > <mailto:bill.fischofer@linaro.org>> > --- > test/validation/.gitignore | 1 + > test/validation/Makefile.am | 2 + > test/validation/odp_strongtypes.c | 86 > +++++++++++++++++++++++++++++++++++++++ > 3 files changed, 89 insertions(+) > create mode 100644 test/validation/odp_strongtypes.c > > diff --git a/test/validation/.gitignore b/test/validation/.gitignore > index 2eab34c..1f7f37e 100644 > --- a/test/validation/.gitignore > +++ b/test/validation/.gitignore > @@ -14,6 +14,7 @@ odp_queue > odp_random > odp_schedule > odp_shm > +odp_strongtypes > odp_synchronizers > odp_system > odp_time > diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am > index 0833181..4d04349 100644 > --- a/test/validation/Makefile.am > +++ b/test/validation/Makefile.am > @@ -17,6 +17,7 @@ EXECUTABLES = odp_buffer \ > odp_random \ > odp_schedule \ > odp_shm \ > + odp_strongtypes \ > odp_system \ > odp_synchronizers \ > odp_time \ > @@ -52,6 +53,7 @@ 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_strongtypes_SOURCES = odp_strongtypes.c $(ODP_CU_COMMON) > dist_odp_system_SOURCES = odp_system.c $(ODP_CU_COMMON) > dist_odp_synchronizers_SOURCES = odp_synchronizers.c $(ODP_CU_COMMON) > dist_odp_time_SOURCES = odp_time.c $(ODP_CU_COMMON) > diff --git a/test/validation/odp_strongtypes.c > b/test/validation/odp_strongtypes.c > new file mode 100644 > index 0000000..29407b5 > --- /dev/null > +++ b/test/validation/odp_strongtypes.c > @@ -0,0 +1,86 @@ > +/* Copyright (c) 2015, Linaro Limited > + * All rights reserved. > + * > + * SPDX-License-Identifier: BSD-3-Clause > + */ > + > +#include <odp.h> > +#include <CUnit/Basic.h> > + > +static void test_odp_strong_types(void) > +{ > + odp_buffer_t buf = ODP_BUFFER_INVALID; > + odp_cos_t cos = ODP_COS_INVALID; > + odp_pmr_t pmr = ODP_PMR_INVAL; > + odp_pmr_set_t pmrset = ODP_PMR_SET_INVAL; > + odp_crypto_session_t csession = ODP_CRYPTO_SESSION_INVALID; > + /* odp_crypto_compl_t ccompl; */ > + odp_event_t evt = ODP_EVENT_INVALID; > + odp_pktio_t pktio = ODP_PKTIO_INVALID; > + odp_packet_t pkt = ODP_PACKET_INVALID; > + odp_packet_seg_t pktseg = ODP_PACKET_SEG_INVALID; > + odp_pool_t pool = ODP_POOL_INVALID; > + odp_queue_t queue = ODP_QUEUE_INVALID; > + odp_shm_t shm = ODP_SHM_INVALID; > + > + /* > + * Note: These type conversion functions have no defined > return values > + * since they produce implementation-defined values for display > + * purposes. This test simply verifies that they exist and > can be > + * invoked. > + */ > + > + CU_ASSERT(odp_buffer_to_u64(buf) == > + odp_buffer_to_u64(ODP_BUFFER_INVALID)); > + > + CU_ASSERT(odp_cos_to_u64(cos) == > + odp_cos_to_u64(ODP_COS_INVALID)); > + > + CU_ASSERT(odp_pmr_to_u64(pmr) == > + odp_pmr_to_u64(ODP_PMR_INVAL)); > + > + CU_ASSERT(odp_pmr_set_to_u64(pmrset) == > + odp_pmr_set_to_u64(ODP_PMR_SET_INVAL)); > + > + CU_ASSERT(odp_crypto_session_to_u64(csession) == > + odp_crypto_session_to_u64(ODP_CRYPTO_SESSION_INVALID)); > + > + /* > + CU_ASSERT(odp_crypto_compl_to_u64(ccompl) == > + odp_crypto_compl_to_u64(ccompl)); > + */ > + > + CU_ASSERT(odp_event_to_u64(evt) == > + odp_event_to_u64(ODP_EVENT_INVALID)); > + > + CU_ASSERT(odp_pktio_to_u64(pktio) == > + odp_pktio_to_u64(ODP_PKTIO_INVALID)); > + > + CU_ASSERT(odp_packet_to_u64(pkt) == > + odp_packet_to_u64(ODP_PACKET_INVALID)); > + > + CU_ASSERT(odp_packet_seg_to_u64(pktseg) == > + odp_packet_seg_to_u64(ODP_PACKET_SEG_INVALID)); > + > + CU_ASSERT(odp_pool_to_u64(pool) == > + odp_pool_to_u64(ODP_POOL_INVALID)); > + > + CU_ASSERT(odp_queue_to_u64(queue) == > + odp_queue_to_u64(ODP_QUEUE_INVALID)); > + > + CU_ASSERT(odp_shm_to_u64(shm) == > + odp_shm_to_u64(ODP_SHM_INVALID)); > +} > + > +CU_TestInfo test_odp_type_display[] = { > + {"ODP abstract type diplay test", test_odp_strong_types}, > + CU_TEST_INFO_NULL, > +}; > + > +CU_SuiteInfo odp_testsuites[] = { > + { "ODP abstract type display functions", > + NULL, NULL, NULL, NULL, > + test_odp_type_display, > + }, > + CU_SUITE_INFO_NULL, > +}; > > -- > 2.1.0 > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org> > http://lists.linaro.org/mailman/listinfo/lng-odp > > > > -- > > Mike Holmes > > Technical Manager - Linaro Networking Group > > Linaro.org <http://www.linaro.org/>***│ *Open source software for ARM SoCs > > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp
On 6 March 2015 at 05:29, Savolainen, Petri (Nokia - FI/Espoo) < petri.savolainen@nokia.com> wrote: > > > > -----Original Message----- > > From: lng-odp-bounces@lists.linaro.org [mailto:lng-odp- > > bounces@lists.linaro.org] On Behalf Of ext Maxim Uvarov > > Sent: Friday, March 06, 2015 11:57 AM > > To: lng-odp@lists.linaro.org > > Subject: Re: [lng-odp] [PATCHv2] validation: strongtypes: add unit tests > > for strong type display functions > > > > On 03/06/15 11:25, Savolainen, Petri (Nokia - FI/Espoo) wrote: > > > > > > I agree with Mike. There’s no strong type API and these tests are not > > > testing strong typing - but those handle conversion functions (from > > > various APIs). Also strong typing is a linux-generic feature and not > > > mandated by the API spec. > > > > > > Still it would be nice to add a strong typing test for linux-generic > > > (implementation specific testing during ‘make check’). How we could > > > verify easily and automatically that passing a wrong type causes a > > > build error (caused by the wrong type)? If it’s not regression tested, > > > we may lose the feature for some handle type without noticing. > > > > > > -Petri > > > > > > > should that tests be in ./platform/linux-generic/tests directory? I > > would like to move there also pktio scripts which set up environment for > > tests. > > > > Maxim. > > > I guess so (with "test" in single). > > odp/test/ for common tests > > odp/platform/xxx/test for platform specific tests > +1 -Christophe has also run into the need for platform specific tests in cpuset testing, > > > -Petri > > > > > > > *From:*lng-odp-bounces@lists.linaro.org > > > [mailto:lng-odp-bounces@lists.linaro.org] *On Behalf Of *ext Bill > > > Fischofer > > > *Sent:* Friday, March 06, 2015 6:11 AM > > > *To:* Mike Holmes > > > *Cc:* lng-odp > > > *Subject:* Re: [lng-odp] [PATCHv2] validation: strongtypes: add unit > > > tests for strong type display functions > > > > > > Possibly. i can do that if there's consensus that that's the way to > go. > > > > > > Bill > > > > > > On Thu, Mar 5, 2015 at 2:29 PM, Mike Holmes <mike.holmes@linaro.org > > > <mailto:mike.holmes@linaro.org>> wrote: > > > > > > I wonder if these tests should be in their respective API area test > > > files as not just as an additional test file. > > > > > > What I mean is that in general we have test suites per API module:- > > > > > > odp_packet > > > > > > odp_buffer > > > > > > odp_pool > > > > > > odp_schedule > > > > > > odp_crypto > > > > > > odp_shm > > > > > > This would result in for example all crypto tests being in the crypto > > > test suite and not spread out. > > > > > > On 3 March 2015 at 18:51, Bill Fischofer <bill.fischofer@linaro.org > > > <mailto:bill.fischofer@linaro.org>> wrote: > > > > > > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org > > > <mailto:bill.fischofer@linaro.org>> > > > --- > > > test/validation/.gitignore | 1 + > > > test/validation/Makefile.am | 2 + > > > test/validation/odp_strongtypes.c | 86 > > > +++++++++++++++++++++++++++++++++++++++ > > > 3 files changed, 89 insertions(+) > > > create mode 100644 test/validation/odp_strongtypes.c > > > > > > diff --git a/test/validation/.gitignore > b/test/validation/.gitignore > > > index 2eab34c..1f7f37e 100644 > > > --- a/test/validation/.gitignore > > > +++ b/test/validation/.gitignore > > > @@ -14,6 +14,7 @@ odp_queue > > > odp_random > > > odp_schedule > > > odp_shm > > > +odp_strongtypes > > > odp_synchronizers > > > odp_system > > > odp_time > > > diff --git a/test/validation/Makefile.am > > b/test/validation/Makefile.am > > > index 0833181..4d04349 100644 > > > --- a/test/validation/Makefile.am > > > +++ b/test/validation/Makefile.am > > > @@ -17,6 +17,7 @@ EXECUTABLES = odp_buffer \ > > > odp_random \ > > > odp_schedule \ > > > odp_shm \ > > > + odp_strongtypes \ > > > odp_system \ > > > odp_synchronizers \ > > > odp_time \ > > > @@ -52,6 +53,7 @@ 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_strongtypes_SOURCES = odp_strongtypes.c $(ODP_CU_COMMON) > > > dist_odp_system_SOURCES = odp_system.c $(ODP_CU_COMMON) > > > dist_odp_synchronizers_SOURCES = odp_synchronizers.c > > $(ODP_CU_COMMON) > > > dist_odp_time_SOURCES = odp_time.c $(ODP_CU_COMMON) > > > diff --git a/test/validation/odp_strongtypes.c > > > b/test/validation/odp_strongtypes.c > > > new file mode 100644 > > > index 0000000..29407b5 > > > --- /dev/null > > > +++ b/test/validation/odp_strongtypes.c > > > @@ -0,0 +1,86 @@ > > > +/* Copyright (c) 2015, Linaro Limited > > > + * All rights reserved. > > > + * > > > + * SPDX-License-Identifier: BSD-3-Clause > > > + */ > > > + > > > +#include <odp.h> > > > +#include <CUnit/Basic.h> > > > + > > > +static void test_odp_strong_types(void) > > > +{ > > > + odp_buffer_t buf = ODP_BUFFER_INVALID; > > > + odp_cos_t cos = ODP_COS_INVALID; > > > + odp_pmr_t pmr = ODP_PMR_INVAL; > > > + odp_pmr_set_t pmrset = ODP_PMR_SET_INVAL; > > > + odp_crypto_session_t csession = ODP_CRYPTO_SESSION_INVALID; > > > + /* odp_crypto_compl_t ccompl; */ > > > + odp_event_t evt = ODP_EVENT_INVALID; > > > + odp_pktio_t pktio = ODP_PKTIO_INVALID; > > > + odp_packet_t pkt = ODP_PACKET_INVALID; > > > + odp_packet_seg_t pktseg = ODP_PACKET_SEG_INVALID; > > > + odp_pool_t pool = ODP_POOL_INVALID; > > > + odp_queue_t queue = ODP_QUEUE_INVALID; > > > + odp_shm_t shm = ODP_SHM_INVALID; > > > + > > > + /* > > > + * Note: These type conversion functions have no defined > > > return values > > > + * since they produce implementation-defined values for > > display > > > + * purposes. This test simply verifies that they exist and > > > can be > > > + * invoked. > > > + */ > > > + > > > + CU_ASSERT(odp_buffer_to_u64(buf) == > > > + odp_buffer_to_u64(ODP_BUFFER_INVALID)); > > > + > > > + CU_ASSERT(odp_cos_to_u64(cos) == > > > + odp_cos_to_u64(ODP_COS_INVALID)); > > > + > > > + CU_ASSERT(odp_pmr_to_u64(pmr) == > > > + odp_pmr_to_u64(ODP_PMR_INVAL)); > > > + > > > + CU_ASSERT(odp_pmr_set_to_u64(pmrset) == > > > + odp_pmr_set_to_u64(ODP_PMR_SET_INVAL)); > > > + > > > + CU_ASSERT(odp_crypto_session_to_u64(csession) == > > > + odp_crypto_session_to_u64(ODP_CRYPTO_SESSION_INVALID)); > > > + > > > + /* > > > + CU_ASSERT(odp_crypto_compl_to_u64(ccompl) == > > > + odp_crypto_compl_to_u64(ccompl)); > > > + */ > > > + > > > + CU_ASSERT(odp_event_to_u64(evt) == > > > + odp_event_to_u64(ODP_EVENT_INVALID)); > > > + > > > + CU_ASSERT(odp_pktio_to_u64(pktio) == > > > + odp_pktio_to_u64(ODP_PKTIO_INVALID)); > > > + > > > + CU_ASSERT(odp_packet_to_u64(pkt) == > > > + odp_packet_to_u64(ODP_PACKET_INVALID)); > > > + > > > + CU_ASSERT(odp_packet_seg_to_u64(pktseg) == > > > + odp_packet_seg_to_u64(ODP_PACKET_SEG_INVALID)); > > > + > > > + CU_ASSERT(odp_pool_to_u64(pool) == > > > + odp_pool_to_u64(ODP_POOL_INVALID)); > > > + > > > + CU_ASSERT(odp_queue_to_u64(queue) == > > > + odp_queue_to_u64(ODP_QUEUE_INVALID)); > > > + > > > + CU_ASSERT(odp_shm_to_u64(shm) == > > > + odp_shm_to_u64(ODP_SHM_INVALID)); > > > +} > > > + > > > +CU_TestInfo test_odp_type_display[] = { > > > + {"ODP abstract type diplay test", test_odp_strong_types}, > > > + CU_TEST_INFO_NULL, > > > +}; > > > + > > > +CU_SuiteInfo odp_testsuites[] = { > > > + { "ODP abstract type display functions", > > > + NULL, NULL, NULL, NULL, > > > + test_odp_type_display, > > > + }, > > > + CU_SUITE_INFO_NULL, > > > +}; > > > > > > -- > > > 2.1.0 > > > > > > > > > _______________________________________________ > > > lng-odp mailing list > > > lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org> > > > http://lists.linaro.org/mailman/listinfo/lng-odp > > > > > > > > > > > > -- > > > > > > Mike Holmes > > > > > > Technical Manager - Linaro Networking Group > > > > > > Linaro.org <http://www.linaro.org/>***│ *Open source software for ARM > > SoCs > > > > > > > > > > > > _______________________________________________ > > > lng-odp mailing list > > > lng-odp@lists.linaro.org > > > http://lists.linaro.org/mailman/listinfo/lng-odp > > > > > > _______________________________________________ > > lng-odp mailing list > > lng-odp@lists.linaro.org > > http://lists.linaro.org/mailman/listinfo/lng-odp > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp >
There seem to be two separate discussions here. With regard to the patch, I'll repost a v3 that puts the individual converter functions integrated into the underlying tests (buffers, crypto, etc.). The platform-specific tests also seem useful and we should develop that proposal separately. With regard to a platform-specific test for implementation of strong types the issue there is that a proper implementation would result in a compilation error if you try to pass a type-mismatched argument to a function. How do we test that? The CUNIT framework won't help here since if the code can't compile it can't run. On Fri, Mar 6, 2015 at 7:21 AM, Mike Holmes <mike.holmes@linaro.org> wrote: > > On 6 March 2015 at 05:29, Savolainen, Petri (Nokia - FI/Espoo) < > petri.savolainen@nokia.com> wrote: > >> >> >> > -----Original Message----- >> > From: lng-odp-bounces@lists.linaro.org [mailto:lng-odp- >> > bounces@lists.linaro.org] On Behalf Of ext Maxim Uvarov >> > Sent: Friday, March 06, 2015 11:57 AM >> > To: lng-odp@lists.linaro.org >> > Subject: Re: [lng-odp] [PATCHv2] validation: strongtypes: add unit tests >> > for strong type display functions >> > >> > On 03/06/15 11:25, Savolainen, Petri (Nokia - FI/Espoo) wrote: >> > > >> > > I agree with Mike. There’s no strong type API and these tests are not >> > > testing strong typing - but those handle conversion functions (from >> > > various APIs). Also strong typing is a linux-generic feature and not >> > > mandated by the API spec. >> > > >> > > Still it would be nice to add a strong typing test for linux-generic >> > > (implementation specific testing during ‘make check’). How we could >> > > verify easily and automatically that passing a wrong type causes a >> > > build error (caused by the wrong type)? If it’s not regression tested, >> > > we may lose the feature for some handle type without noticing. >> > > >> > > -Petri >> > > >> > >> > should that tests be in ./platform/linux-generic/tests directory? I >> > would like to move there also pktio scripts which set up environment for >> > tests. >> > >> > Maxim. >> >> >> I guess so (with "test" in single). >> >> odp/test/ for common tests >> >> odp/platform/xxx/test for platform specific tests >> > > +1 -Christophe has also run into the need for platform specific tests in > cpuset testing, > > >> >> >> -Petri >> >> >> > >> > > *From:*lng-odp-bounces@lists.linaro.org >> > > [mailto:lng-odp-bounces@lists.linaro.org] *On Behalf Of *ext Bill >> > > Fischofer >> > > *Sent:* Friday, March 06, 2015 6:11 AM >> > > *To:* Mike Holmes >> > > *Cc:* lng-odp >> > > *Subject:* Re: [lng-odp] [PATCHv2] validation: strongtypes: add unit >> > > tests for strong type display functions >> > > >> > > Possibly. i can do that if there's consensus that that's the way to >> go. >> > > >> > > Bill >> > > >> > > On Thu, Mar 5, 2015 at 2:29 PM, Mike Holmes <mike.holmes@linaro.org >> > > <mailto:mike.holmes@linaro.org>> wrote: >> > > >> > > I wonder if these tests should be in their respective API area test >> > > files as not just as an additional test file. >> > > >> > > What I mean is that in general we have test suites per API module:- >> > > >> > > odp_packet >> > > >> > > odp_buffer >> > > >> > > odp_pool >> > > >> > > odp_schedule >> > > >> > > odp_crypto >> > > >> > > odp_shm >> > > >> > > This would result in for example all crypto tests being in the crypto >> > > test suite and not spread out. >> > > >> > > On 3 March 2015 at 18:51, Bill Fischofer <bill.fischofer@linaro.org >> > > <mailto:bill.fischofer@linaro.org>> wrote: >> > > >> > > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org >> > > <mailto:bill.fischofer@linaro.org>> >> > > --- >> > > test/validation/.gitignore | 1 + >> > > test/validation/Makefile.am | 2 + >> > > test/validation/odp_strongtypes.c | 86 >> > > +++++++++++++++++++++++++++++++++++++++ >> > > 3 files changed, 89 insertions(+) >> > > create mode 100644 test/validation/odp_strongtypes.c >> > > >> > > diff --git a/test/validation/.gitignore >> b/test/validation/.gitignore >> > > index 2eab34c..1f7f37e 100644 >> > > --- a/test/validation/.gitignore >> > > +++ b/test/validation/.gitignore >> > > @@ -14,6 +14,7 @@ odp_queue >> > > odp_random >> > > odp_schedule >> > > odp_shm >> > > +odp_strongtypes >> > > odp_synchronizers >> > > odp_system >> > > odp_time >> > > diff --git a/test/validation/Makefile.am >> > b/test/validation/Makefile.am >> > > index 0833181..4d04349 100644 >> > > --- a/test/validation/Makefile.am >> > > +++ b/test/validation/Makefile.am >> > > @@ -17,6 +17,7 @@ EXECUTABLES = odp_buffer \ >> > > odp_random \ >> > > odp_schedule \ >> > > odp_shm \ >> > > + odp_strongtypes \ >> > > odp_system \ >> > > odp_synchronizers \ >> > > odp_time \ >> > > @@ -52,6 +53,7 @@ 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_strongtypes_SOURCES = odp_strongtypes.c $(ODP_CU_COMMON) >> > > dist_odp_system_SOURCES = odp_system.c $(ODP_CU_COMMON) >> > > dist_odp_synchronizers_SOURCES = odp_synchronizers.c >> > $(ODP_CU_COMMON) >> > > dist_odp_time_SOURCES = odp_time.c $(ODP_CU_COMMON) >> > > diff --git a/test/validation/odp_strongtypes.c >> > > b/test/validation/odp_strongtypes.c >> > > new file mode 100644 >> > > index 0000000..29407b5 >> > > --- /dev/null >> > > +++ b/test/validation/odp_strongtypes.c >> > > @@ -0,0 +1,86 @@ >> > > +/* Copyright (c) 2015, Linaro Limited >> > > + * All rights reserved. >> > > + * >> > > + * SPDX-License-Identifier: BSD-3-Clause >> > > + */ >> > > + >> > > +#include <odp.h> >> > > +#include <CUnit/Basic.h> >> > > + >> > > +static void test_odp_strong_types(void) >> > > +{ >> > > + odp_buffer_t buf = ODP_BUFFER_INVALID; >> > > + odp_cos_t cos = ODP_COS_INVALID; >> > > + odp_pmr_t pmr = ODP_PMR_INVAL; >> > > + odp_pmr_set_t pmrset = ODP_PMR_SET_INVAL; >> > > + odp_crypto_session_t csession = >> ODP_CRYPTO_SESSION_INVALID; >> > > + /* odp_crypto_compl_t ccompl; */ >> > > + odp_event_t evt = ODP_EVENT_INVALID; >> > > + odp_pktio_t pktio = ODP_PKTIO_INVALID; >> > > + odp_packet_t pkt = ODP_PACKET_INVALID; >> > > + odp_packet_seg_t pktseg = ODP_PACKET_SEG_INVALID; >> > > + odp_pool_t pool = ODP_POOL_INVALID; >> > > + odp_queue_t queue = ODP_QUEUE_INVALID; >> > > + odp_shm_t shm = ODP_SHM_INVALID; >> > > + >> > > + /* >> > > + * Note: These type conversion functions have no defined >> > > return values >> > > + * since they produce implementation-defined values for >> > display >> > > + * purposes. This test simply verifies that they exist and >> > > can be >> > > + * invoked. >> > > + */ >> > > + >> > > + CU_ASSERT(odp_buffer_to_u64(buf) == >> > > + odp_buffer_to_u64(ODP_BUFFER_INVALID)); >> > > + >> > > + CU_ASSERT(odp_cos_to_u64(cos) == >> > > + odp_cos_to_u64(ODP_COS_INVALID)); >> > > + >> > > + CU_ASSERT(odp_pmr_to_u64(pmr) == >> > > + odp_pmr_to_u64(ODP_PMR_INVAL)); >> > > + >> > > + CU_ASSERT(odp_pmr_set_to_u64(pmrset) == >> > > + odp_pmr_set_to_u64(ODP_PMR_SET_INVAL)); >> > > + >> > > + CU_ASSERT(odp_crypto_session_to_u64(csession) == >> > > + odp_crypto_session_to_u64(ODP_CRYPTO_SESSION_INVALID)); >> > > + >> > > + /* >> > > + CU_ASSERT(odp_crypto_compl_to_u64(ccompl) == >> > > + odp_crypto_compl_to_u64(ccompl)); >> > > + */ >> > > + >> > > + CU_ASSERT(odp_event_to_u64(evt) == >> > > + odp_event_to_u64(ODP_EVENT_INVALID)); >> > > + >> > > + CU_ASSERT(odp_pktio_to_u64(pktio) == >> > > + odp_pktio_to_u64(ODP_PKTIO_INVALID)); >> > > + >> > > + CU_ASSERT(odp_packet_to_u64(pkt) == >> > > + odp_packet_to_u64(ODP_PACKET_INVALID)); >> > > + >> > > + CU_ASSERT(odp_packet_seg_to_u64(pktseg) == >> > > + odp_packet_seg_to_u64(ODP_PACKET_SEG_INVALID)); >> > > + >> > > + CU_ASSERT(odp_pool_to_u64(pool) == >> > > + odp_pool_to_u64(ODP_POOL_INVALID)); >> > > + >> > > + CU_ASSERT(odp_queue_to_u64(queue) == >> > > + odp_queue_to_u64(ODP_QUEUE_INVALID)); >> > > + >> > > + CU_ASSERT(odp_shm_to_u64(shm) == >> > > + odp_shm_to_u64(ODP_SHM_INVALID)); >> > > +} >> > > + >> > > +CU_TestInfo test_odp_type_display[] = { >> > > + {"ODP abstract type diplay test", test_odp_strong_types}, >> > > + CU_TEST_INFO_NULL, >> > > +}; >> > > + >> > > +CU_SuiteInfo odp_testsuites[] = { >> > > + { "ODP abstract type display functions", >> > > + NULL, NULL, NULL, NULL, >> > > + test_odp_type_display, >> > > + }, >> > > + CU_SUITE_INFO_NULL, >> > > +}; >> > > >> > > -- >> > > 2.1.0 >> > > >> > > >> > > _______________________________________________ >> > > lng-odp mailing list >> > > lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org> >> > > http://lists.linaro.org/mailman/listinfo/lng-odp >> > > >> > > >> > > >> > > -- >> > > >> > > Mike Holmes >> > > >> > > Technical Manager - Linaro Networking Group >> > > >> > > Linaro.org <http://www.linaro.org/>***│ *Open source software for ARM >> > SoCs >> > > >> > > >> > > >> > > _______________________________________________ >> > > lng-odp mailing list >> > > lng-odp@lists.linaro.org >> > > http://lists.linaro.org/mailman/listinfo/lng-odp >> > >> > >> > _______________________________________________ >> > lng-odp mailing list >> > lng-odp@lists.linaro.org >> > http://lists.linaro.org/mailman/listinfo/lng-odp >> _______________________________________________ >> lng-odp mailing list >> lng-odp@lists.linaro.org >> http://lists.linaro.org/mailman/listinfo/lng-odp >> > > > > -- > Mike Holmes > Technical Manager - Linaro Networking Group > Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs > > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp > >
diff --git a/test/validation/.gitignore b/test/validation/.gitignore index 2eab34c..1f7f37e 100644 --- a/test/validation/.gitignore +++ b/test/validation/.gitignore @@ -14,6 +14,7 @@ odp_queue odp_random odp_schedule odp_shm +odp_strongtypes odp_synchronizers odp_system odp_time diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index 0833181..4d04349 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -17,6 +17,7 @@ EXECUTABLES = odp_buffer \ odp_random \ odp_schedule \ odp_shm \ + odp_strongtypes \ odp_system \ odp_synchronizers \ odp_time \ @@ -52,6 +53,7 @@ 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_strongtypes_SOURCES = odp_strongtypes.c $(ODP_CU_COMMON) dist_odp_system_SOURCES = odp_system.c $(ODP_CU_COMMON) dist_odp_synchronizers_SOURCES = odp_synchronizers.c $(ODP_CU_COMMON) dist_odp_time_SOURCES = odp_time.c $(ODP_CU_COMMON) diff --git a/test/validation/odp_strongtypes.c b/test/validation/odp_strongtypes.c new file mode 100644 index 0000000..29407b5 --- /dev/null +++ b/test/validation/odp_strongtypes.c @@ -0,0 +1,86 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <odp.h> +#include <CUnit/Basic.h> + +static void test_odp_strong_types(void) +{ + odp_buffer_t buf = ODP_BUFFER_INVALID; + odp_cos_t cos = ODP_COS_INVALID; + odp_pmr_t pmr = ODP_PMR_INVAL; + odp_pmr_set_t pmrset = ODP_PMR_SET_INVAL; + odp_crypto_session_t csession = ODP_CRYPTO_SESSION_INVALID; + /* odp_crypto_compl_t ccompl; */ + odp_event_t evt = ODP_EVENT_INVALID; + odp_pktio_t pktio = ODP_PKTIO_INVALID; + odp_packet_t pkt = ODP_PACKET_INVALID; + odp_packet_seg_t pktseg = ODP_PACKET_SEG_INVALID; + odp_pool_t pool = ODP_POOL_INVALID; + odp_queue_t queue = ODP_QUEUE_INVALID; + odp_shm_t shm = ODP_SHM_INVALID; + + /* + * Note: These type conversion functions have no defined return values + * since they produce implementation-defined values for display + * purposes. This test simply verifies that they exist and can be + * invoked. + */ + + CU_ASSERT(odp_buffer_to_u64(buf) == + odp_buffer_to_u64(ODP_BUFFER_INVALID)); + + CU_ASSERT(odp_cos_to_u64(cos) == + odp_cos_to_u64(ODP_COS_INVALID)); + + CU_ASSERT(odp_pmr_to_u64(pmr) == + odp_pmr_to_u64(ODP_PMR_INVAL)); + + CU_ASSERT(odp_pmr_set_to_u64(pmrset) == + odp_pmr_set_to_u64(ODP_PMR_SET_INVAL)); + + CU_ASSERT(odp_crypto_session_to_u64(csession) == + odp_crypto_session_to_u64(ODP_CRYPTO_SESSION_INVALID)); + + /* + CU_ASSERT(odp_crypto_compl_to_u64(ccompl) == + odp_crypto_compl_to_u64(ccompl)); + */ + + CU_ASSERT(odp_event_to_u64(evt) == + odp_event_to_u64(ODP_EVENT_INVALID)); + + CU_ASSERT(odp_pktio_to_u64(pktio) == + odp_pktio_to_u64(ODP_PKTIO_INVALID)); + + CU_ASSERT(odp_packet_to_u64(pkt) == + odp_packet_to_u64(ODP_PACKET_INVALID)); + + CU_ASSERT(odp_packet_seg_to_u64(pktseg) == + odp_packet_seg_to_u64(ODP_PACKET_SEG_INVALID)); + + CU_ASSERT(odp_pool_to_u64(pool) == + odp_pool_to_u64(ODP_POOL_INVALID)); + + CU_ASSERT(odp_queue_to_u64(queue) == + odp_queue_to_u64(ODP_QUEUE_INVALID)); + + CU_ASSERT(odp_shm_to_u64(shm) == + odp_shm_to_u64(ODP_SHM_INVALID)); +} + +CU_TestInfo test_odp_type_display[] = { + {"ODP abstract type diplay test", test_odp_strong_types}, + CU_TEST_INFO_NULL, +}; + +CU_SuiteInfo odp_testsuites[] = { + { "ODP abstract type display functions", + NULL, NULL, NULL, NULL, + test_odp_type_display, + }, + CU_SUITE_INFO_NULL, +};
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> --- test/validation/.gitignore | 1 + test/validation/Makefile.am | 2 + test/validation/odp_strongtypes.c | 86 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 test/validation/odp_strongtypes.c