On Mon, Sep 07, 2015 at 02:20:46PM +0300, Maxim Uvarov wrote:
> On 09/04/15 12:55, Stuart Haslam wrote:
> >Test that transmit errors are handled correctly by attempting to send a
> >packet larger than the MTU of the interface.
> >
> >Signed-off-by: Stuart Haslam <[email protected]>
> >---
> >  test/validation/pktio/pktio.c | 124 
> > +++++++++++++++++++++++++++++++++++++++++-
> >  1 file changed, 121 insertions(+), 3 deletions(-)
> >
> >diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
> >index 95c3c34..fa146c5 100644
> >--- a/test/validation/pktio/pktio.c
> >+++ b/test/validation/pktio/pktio.c
> >@@ -21,6 +21,7 @@
> >  #define MAX_NUM_IFACES         2
> >  #define TEST_SEQ_INVALID       ((uint32_t)~0)
> >  #define TEST_SEQ_MAGIC         0x92749451
> >+#define TX_BATCH_LEN           4
> >  /** interface names used for testing */
> >  static const char *iface_name[MAX_NUM_IFACES];
> >@@ -507,7 +508,7 @@ void pktio_test_poll_queue(void)
> >  void pktio_test_poll_multi(void)
> >  {
> >-    test_txrx(ODP_PKTIN_MODE_POLL, 4);
> >+    test_txrx(ODP_PKTIN_MODE_POLL, TX_BATCH_LEN);
> >  }
> >  void pktio_test_sched_queue(void)
> >@@ -517,7 +518,7 @@ void pktio_test_sched_queue(void)
> >  void pktio_test_sched_multi(void)
> >  {
> >-    test_txrx(ODP_PKTIN_MODE_SCHED, 4);
> >+    test_txrx(ODP_PKTIN_MODE_SCHED, TX_BATCH_LEN);
> >  }
> >  void pktio_test_recv(void)
> >@@ -527,7 +528,7 @@ void pktio_test_recv(void)
> >  void pktio_test_recv_multi(void)
> >  {
> >-    test_txrx(ODP_PKTIN_MODE_RECV, 4);
> >+    test_txrx(ODP_PKTIN_MODE_RECV, TX_BATCH_LEN);
> >  }
> >  void pktio_test_jumbo(void)
> >@@ -790,6 +791,121 @@ static void pktio_test_start_stop(void)
> >     }
> >  }
> >+static void pktio_test_send_failure(void)
> >+{
> >+    odp_pktio_t pktio_tx, pktio_rx;
> >+    odp_packet_t pkt_tbl[TX_BATCH_LEN];
> >+    uint32_t pkt_seq[TX_BATCH_LEN];
> >+    int ret, mtu, i, alloc_pkts;
> >+    odp_pool_param_t pool_params;
> >+    odp_pool_t pkt_pool;
> >+    int long_pkt_idx = TX_BATCH_LEN / 2;
> >+    pktio_info_t info_rx;
> >+
> >+    pktio_tx = create_pktio(0, ODP_PKTIN_MODE_RECV);
> >+    if (pktio_tx == ODP_PKTIO_INVALID) {
> >+            CU_FAIL("failed to open pktio");
> >+            return;
> >+    }
> >+
> >+    /* read the MTU from the transmit interface */
> >+    mtu = odp_pktio_mtu(pktio_tx);
> >+
> >+    /* if the interface MTU is larger that the biggest packet we can
> >+     * allocate then we can't use this method to test transmit failures */
> >+    if (mtu > ODP_CONFIG_PACKET_BUF_LEN_MAX - 32) {
> >+            CU_ASSERT(odp_pktio_close(pktio_tx) == 0);
> 
> should we have some print here or mark test as "skipped"? Just no
> calling test case
> and mark it as pass looks not really right thing to do.
> 
> Maxim.

As far as I know there's no way to report a test as being skipped from
the test itself (which seems odd, but this is CUnit), but perhaps this
check could be moved into the init stage. I'll have a play around with
that.

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

Reply via email to