From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id E573F3B5 for ; Tue, 16 Dec 2014 16:03:56 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 16 Dec 2014 07:03:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,587,1413270000"; d="scan'208";a="648505167" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 16 Dec 2014 07:03:54 -0800 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id sBGF3rSR008296; Tue, 16 Dec 2014 15:03:53 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id sBGF3rY2016829; Tue, 16 Dec 2014 15:03:53 GMT Received: (from bricha3@localhost) by sivswdev01.ir.intel.com with id sBGF3rV9016825; Tue, 16 Dec 2014 15:03:53 GMT From: Bruce Richardson To: dev@dpdk.org Date: Tue, 16 Dec 2014 15:03:50 +0000 Message-Id: <1418742233-16776-3-git-send-email-bruce.richardson@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1418742233-16776-1-git-send-email-bruce.richardson@intel.com> References: <1418742233-16776-1-git-send-email-bruce.richardson@intel.com> Subject: [dpdk-dev] [PATCH 2/5] test: check for mbuf alloc failure 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, 16 Dec 2014 15:03:57 -0000 If mbuf allocation failed for whatever reason, we would get a NULL pointer exception in test_table_acl.c:test_pipeline_single_filter test case. We fix this by causing an early break out of the application loop. If we quit the test immediately we would leak any existing allocated mbufs, but by breaking instead, we allow the test to continue and clean up the mbufs already in the pipeline, while still having a test failure as the mbuf counts should not match. Signed-off-by: Bruce Richardson --- app/test/test_table_acl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/test/test_table_acl.c b/app/test/test_table_acl.c index 0f2b57e..e4e9b9c 100644 --- a/app/test/test_table_acl.c +++ b/app/test/test_table_acl.c @@ -513,6 +513,11 @@ test_pipeline_single_filter(int expected_count) struct rte_mbuf *mbuf; mbuf = rte_pktmbuf_alloc(pool); + if (mbuf == NULL) + /* this will cause test failure after cleanup + * of already enqueued mbufs, as the mbuf + * counts won't match */ + break; memset(rte_pktmbuf_mtod(mbuf, char *), 0x00, sizeof(struct ipv4_5tuple)); -- 1.9.3