From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from e23smtp08.au.ibm.com (e23smtp08.au.ibm.com [202.81.31.141]) by dpdk.org (Postfix) with ESMTP id 464E17FC4 for ; Sun, 23 Nov 2014 14:11:39 +0100 (CET) Received: from /spool/local by e23smtp08.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 23 Nov 2014 23:22:21 +1000 Received: from d23dlp01.au.ibm.com (202.81.31.203) by e23smtp08.au.ibm.com (202.81.31.205) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sun, 23 Nov 2014 23:22:20 +1000 Received: from d23relay06.au.ibm.com (d23relay06.au.ibm.com [9.185.63.219]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id 6ECD02CE8050 for ; Mon, 24 Nov 2014 00:22:20 +1100 (EST) Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay06.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id sANDMBQY35520566 for ; Mon, 24 Nov 2014 00:22:20 +1100 Received: from d23av03.au.ibm.com (localhost [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id sANDLlOj017518 for ; Mon, 24 Nov 2014 00:21:47 +1100 Received: from os_controller.crl.ibm.com ([9.186.57.97]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id sANDLYg4017172 for ; Mon, 24 Nov 2014 00:21:46 +1100 From: Chao Zhu To: dev@dpdk.org Date: Sun, 23 Nov 2014 20:22:21 -0500 Message-Id: <1416792142-23132-14-git-send-email-chaozhu@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1416792142-23132-1-git-send-email-chaozhu@linux.vnet.ibm.com> References: <1416792142-23132-1-git-send-email-chaozhu@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14112313-0029-0000-0000-000000A742B5 Subject: [dpdk-dev] [PATCH v3 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: Sun, 23 Nov 2014 13:11:41 -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 | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/test/test_memzone.c b/app/test/test_memzone.c index 8668103..f3da2c1 100644 --- a/app/test/test_memzone.c +++ b/app/test/test_memzone.c @@ -794,7 +794,7 @@ 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; } } @@ -874,7 +874,7 @@ 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