From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com [209.85.212.174]) by dpdk.org (Postfix) with ESMTP id 864F9C362 for ; Tue, 21 Apr 2015 11:55:58 +0200 (CEST) Received: by wicmx19 with SMTP id mx19so59788924wic.1 for ; Tue, 21 Apr 2015 02:55:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Ql8VTXTVQF2SLUX42wC//taYN9xF3JzRoJWp56EPlBE=; b=KLrvH1Bh78gHF0RyjdhF7u1tANM7LlmNBiT4ZObBLARTpAQyMb8BGxg5OXPWNQvW6p Im+dRLq6j4tztn5ALfGV0BmFggnkLK+yaJHxK43FB2hMwYn9m3ujx3seSnx0de99n2Bn 6En8e7pyngFyNkt5kBYChKtt58D6nDTK/DKtgPy2Wg2FP6ikRB5cqdCB/MSOppLInlZ/ ZpT0lfRiu79h0WX61YrY4m8o75uPLqCZ5KGs1tk3yirB0L2Zxe2/ECKy85LHLB+P+ZFL Ul/T2SAbXEBbWWnXqPxlr5IO0ZJ7ZhQZn9Wj5ilw6PfbtyMR/qlPpN/WGC8H4LWzddG/ c/ag== X-Gm-Message-State: ALoCoQnYl/sSwl6ELNgrhh3vyDqmLKKboCMNADX9Wl1SIvY0cuTxAXQXWMH2zrZAJOHcz7pvuqNR X-Received: by 10.180.99.67 with SMTP id eo3mr34007510wib.28.1429610158440; Tue, 21 Apr 2015 02:55:58 -0700 (PDT) Received: from glumotte.dev.6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id i6sm1855867wjf.29.2015.04.21.02.55.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Apr 2015 02:55:57 -0700 (PDT) From: Olivier Matz To: dev@dpdk.org Date: Tue, 21 Apr 2015 11:55:22 +0200 Message-Id: <1429610122-30943-13-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1429610122-30943-1-git-send-email-olivier.matz@6wind.com> References: <1429544496-22532-1-git-send-email-olivier.matz@6wind.com> <1429610122-30943-1-git-send-email-olivier.matz@6wind.com> Subject: [dpdk-dev] [PATCH v5 12/12] test/mbuf: verify that cloning a clone works properly X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Apr 2015 09:55:59 -0000 Signed-off-by: Olivier Matz --- app/test/test_mbuf.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c index 01838c6..b5ae5b7 100644 --- a/app/test/test_mbuf.c +++ b/app/test/test_mbuf.c @@ -324,6 +324,7 @@ testclone_testupdate_testdetach(void) { struct rte_mbuf *m = NULL; struct rte_mbuf *clone = NULL; + struct rte_mbuf *clone2 = NULL; uint32_t *data; /* alloc a mbuf */ @@ -381,11 +382,34 @@ testclone_testupdate_testdetach(void) if (rte_mbuf_refcnt_read(m->next) != 2) GOTO_FAIL("invalid refcnt in m->next\n"); + /* try to clone the clone */ + + clone2 = rte_pktmbuf_clone(clone, pktmbuf_pool); + if (clone2 == NULL) + GOTO_FAIL("cannot clone the clone\n"); + + data = rte_pktmbuf_mtod(clone2, uint32_t *); + if (*data != MAGIC_DATA) + GOTO_FAIL("invalid data in clone2\n"); + + data = rte_pktmbuf_mtod(clone2->next, uint32_t *); + if (*data != MAGIC_DATA) + GOTO_FAIL("invalid data in clone2->next\n"); + + if (rte_mbuf_refcnt_read(m) != 3) + GOTO_FAIL("invalid refcnt in m\n"); + + if (rte_mbuf_refcnt_read(m->next) != 3) + GOTO_FAIL("invalid refcnt in m->next\n"); + /* free mbuf */ rte_pktmbuf_free(m); rte_pktmbuf_free(clone); + rte_pktmbuf_free(clone2); + m = NULL; clone = NULL; + clone2 = NULL; return 0; fail: @@ -393,6 +417,8 @@ fail: rte_pktmbuf_free(m); if (clone) rte_pktmbuf_free(clone); + if (clone2) + rte_pktmbuf_free(clone2); return -1; } #undef GOTO_FAIL -- 2.1.4