X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest%2Ftest_mbuf.c;h=e09b2549ca40dc93703a02be170d02610cf247a9;hb=7dc92d17298d8fd05a912606f02a094566ec0b3f;hp=f54d1d7c006a1c1d57acaacf25e9bf2815ace4bf;hpb=1f8cc1a388610c348da7e379dbff62f1a28690d1;p=dpdk.git diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c index f54d1d7c00..e09b2549ca 100644 --- a/app/test/test_mbuf.c +++ b/app/test/test_mbuf.c @@ -2,6 +2,8 @@ * Copyright(c) 2010-2014 Intel Corporation */ +#include "test.h" + #include #include #include @@ -33,8 +35,6 @@ #include #include -#include "test.h" - #define MEMPOOL_CACHE_SIZE 32 #define MBUF_DATA_SIZE 2048 #define NB_MBUF 128 @@ -304,8 +304,7 @@ test_one_pktmbuf(struct rte_mempool *pktmbuf_pool) return 0; fail: - if (m) - rte_pktmbuf_free(m); + rte_pktmbuf_free(m); return -1; } @@ -416,12 +415,9 @@ testclone_testupdate_testdetach(struct rte_mempool *pktmbuf_pool, return 0; fail: - if (m) - rte_pktmbuf_free(m); - if (clone) - rte_pktmbuf_free(clone); - if (clone2) - rte_pktmbuf_free(clone2); + rte_pktmbuf_free(m); + rte_pktmbuf_free(clone); + rte_pktmbuf_free(clone2); return -1; } @@ -572,12 +568,9 @@ test_pktmbuf_copy(struct rte_mempool *pktmbuf_pool, return 0; fail: - if (m) - rte_pktmbuf_free(m); - if (copy) - rte_pktmbuf_free(copy); - if (copy2) - rte_pktmbuf_free(copy2); + rte_pktmbuf_free(m); + rte_pktmbuf_free(copy); + rte_pktmbuf_free(copy2); return -1; } @@ -679,12 +672,9 @@ test_attach_from_different_pool(struct rte_mempool *pktmbuf_pool, return 0; fail: - if (m) - rte_pktmbuf_free(m); - if (clone) - rte_pktmbuf_free(clone); - if (clone2) - rte_pktmbuf_free(clone2); + rte_pktmbuf_free(m); + rte_pktmbuf_free(clone); + rte_pktmbuf_free(clone2); return -1; } @@ -722,8 +712,7 @@ test_pktmbuf_pool(struct rte_mempool *pktmbuf_pool) } /* free them */ for (i=0; i #include #include @@ -1267,6 +1263,8 @@ test_failing_mbuf_sanity_check(struct rte_mempool *pktmbuf_pool) return 0; } +#endif /* !RTE_EXEC_ENV_WINDOWS */ + static int test_mbuf_linearize(struct rte_mempool *pktmbuf_pool, int pkt_len, int nb_segs) @@ -1355,8 +1353,7 @@ test_mbuf_linearize(struct rte_mempool *pktmbuf_pool, int pkt_len, return 0; fail: - if (mbuf) - rte_pktmbuf_free(mbuf); + rte_pktmbuf_free(mbuf); return -1; } @@ -2031,8 +2028,6 @@ test_pktmbuf_read_from_offset(struct rte_mempool *pktmbuf_pool) NULL); if (data_copy == NULL) GOTO_FAIL("%s: Error in reading packet data!\n", __func__); - if (strlen(data_copy) != MBUF_TEST_DATA_LEN2 - 5) - GOTO_FAIL("%s: Incorrect data length!\n", __func__); for (off = 0; off < MBUF_TEST_DATA_LEN2 - 5; off++) { if (data_copy[off] != (char)0xcc) GOTO_FAIL("Data corrupted at offset %u", off); @@ -2054,8 +2049,6 @@ test_pktmbuf_read_from_offset(struct rte_mempool *pktmbuf_pool) data_copy = rte_pktmbuf_read(m, hdr_len, 0, NULL); if (data_copy == NULL) GOTO_FAIL("%s: Error in reading packet data!\n", __func__); - if (strlen(data_copy) != MBUF_TEST_DATA_LEN2) - GOTO_FAIL("%s: Corrupted data content!\n", __func__); for (off = 0; off < MBUF_TEST_DATA_LEN2; off++) { if (data_copy[off] != (char)0xcc) GOTO_FAIL("Data corrupted at offset %u", off); @@ -2772,8 +2765,7 @@ test_nb_segs_and_next_reset(void) return 0; fail: - if (pool != NULL) - rte_mempool_free(pool); + rte_mempool_free(pool); return -1; }