From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from e28smtp09.in.ibm.com (e28smtp09.in.ibm.com [122.248.162.9]) by dpdk.org (Postfix) with ESMTP id CB39C7F44 for ; Tue, 25 Nov 2014 11:05:36 +0100 (CET) Received: from /spool/local by e28smtp09.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 25 Nov 2014 15:46:26 +0530 Received: from d28dlp03.in.ibm.com (9.184.220.128) by e28smtp09.in.ibm.com (192.168.1.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 25 Nov 2014 15:46:23 +0530 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id A92151258053 for ; Tue, 25 Nov 2014 15:46:34 +0530 (IST) Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay03.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id sAPAIV1e61603938 for ; Tue, 25 Nov 2014 15:48:31 +0530 Received: from d28av05.in.ibm.com (localhost [127.0.0.1]) by d28av05.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id sAPAGKTc021691 for ; Tue, 25 Nov 2014 15:46:20 +0530 Received: from os_controller.crl.ibm.com ([9.186.57.58]) by d28av05.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id sAPAG3kw020283 for ; Tue, 25 Nov 2014 15:46:19 +0530 From: Chao Zhu To: dev@dpdk.org Date: Tue, 25 Nov 2014 17:17:16 -0500 Message-Id: <1416953837-15894-14-git-send-email-chaozhu@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1416953837-15894-1-git-send-email-chaozhu@linux.vnet.ibm.com> References: <1416953837-15894-1-git-send-email-chaozhu@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14112510-0033-0000-0000-000002FE8FF2 Subject: [dpdk-dev] [PATCH v5 13/14] test_memzone:fix finding the second smallest segment 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, 25 Nov 2014 10:05:38 -0000 Curent implementation in test_memzone.c has bugs in finding the second smallest memory segment. It's the last smallest memory segment, but it's not the second smallest memory segment. This bug may cause test failure in some cases. This patch fixes this bug. Signed-off-by: Chao Zhu --- app/test/test_memzone.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/test/test_memzone.c b/app/test/test_memzone.c index 387dbbc..1658006 100644 --- a/app/test/test_memzone.c +++ b/app/test/test_memzone.c @@ -797,10 +797,9 @@ test_memzone_reserve_memory_in_smallest_segment(void) /* set new smallest */ min_ms = ms; - } - else if (prev_min_ms == NULL) { + } else if ((prev_min_ms == NULL) + || (prev_min_ms->len > ms->len)) prev_min_ms = ms; - } } if (min_ms == NULL || prev_min_ms == NULL) { @@ -877,8 +876,8 @@ test_memzone_reserve_memory_with_smallest_offset(void) /* set new smallest */ min_ms = ms; - } - else if (prev_min_ms == NULL) { + } else if ((prev_min_ms == NULL) + || (prev_min_ms->len > ms->len)) { prev_min_ms = ms; } } -- 1.7.1