> -----Original Message----- > From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT > Nicolas Morey-Chaisemartin > Sent: Thursday, October 08, 2015 5:09 PM > To: lng-odp@lists.linaro.org > Subject: [lng-odp] [API-NEXTv3 7/7] validation: packet: add tests for > packet alloc/free multi functions > > Signed-off-by: Nicolas Morey-Chaisemartin <nmo...@kalray.eu> > --- > test/validation/packet/packet.c | 80 > +++++++++++++++++++++++++++++++++++++++++ > test/validation/packet/packet.h | 1 + > 2 files changed, 81 insertions(+) > > diff --git a/test/validation/packet/packet.c > b/test/validation/packet/packet.c > index 0c749c3..41bba06 100644 > --- a/test/validation/packet/packet.c > +++ b/test/validation/packet/packet.c > @@ -132,6 +132,85 @@ void packet_test_alloc_free(void) > CU_ASSERT(odp_pool_destroy(pool) == 0); > } > > +/* Wrapper to call odp_packet_alloc_multi multiple times until > + * either no mure buffers are returned, or num buffers were alloced */ > +static int packet_alloc_multi(odp_pool_t pool, uint32_t pkt_len, > + odp_packet_t pkt[], int num) > +{ > + int ret, total = 0; > + > + do { > + ret = odp_packet_alloc_multi(pool, pkt_len, pkt + total, > + num - total); > + CU_ASSERT(ret <= num - total);
Catch (assert fatal) when ret < 0 -Petri > + total += ret; > + } while (total < num && ret); > + > + return total; > +} > + _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp