From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id 67D082B84 for ; Sat, 27 Jan 2018 15:46:32 +0100 (CET) Received: by mail-wm0-f65.google.com with SMTP id 143so6320353wma.5 for ; Sat, 27 Jan 2018 06:46:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=8fZMWoaMqpaeGKYlNv8Uk7xtPxXof1cClfurbn9y38Y=; b=LOFScUHhMu50c4kY4jzWy3bdxYeMzERpvLJu6vhFiy5l0LTZoZq8yUrpMq3EVEmdXb YfOoY9Uj39xY7xktobfdZ+AsHXyxg00fL5fedeWeyKwDf8WfT9H018bh7GZNCiFB0KOk 9vQH3kHT8+y56tItR8hpfD5OkTOeeyHRk1dH8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=8fZMWoaMqpaeGKYlNv8Uk7xtPxXof1cClfurbn9y38Y=; b=Zd2rE1vJF1AIln34iv2j+MZvoW8+wPfHWEIviwgb4mmrde/+Qj7tlFpOGbCjaMzhoO OyiZjQPq9K5rdbDD/aQ5EbUQuotdZhdMrX2+9U3Gq5MFcRbIKni0CtCmhytm4ALnX0aA rdRYtZzhMexwyA0ATXz/CvkGlfJbG22Q9nQ/XrCSWN1+PVC48hu78UWt4D1pJVM0edLT F6heXGAwYm7cvt0vpFjRSY2ojKl00rBmnoI82OgtKHEyaDh7mUfrQwae9CbQqQmceB9V oVfnnjda3YKkUIEkgEIiegH3FVZi+HTf2LETVwYn1qlSjDI3FpVdUYh2elDTDjL4emAD v9AA== X-Gm-Message-State: AKwxytfhNR0vcJZnjTIjHZ1w8LiEXWU7vQ2eng4VmO6L8/sIwyHZKdUk GbNTJewxBYsHR00I6TuTGskc87bcAn5BJxLw/54Z+Q== X-Google-Smtp-Source: AH8x224Qv+IBBixQkls2UoQAYhJMZ8j5HsFxJi0Hsg3B13Lffnjg4MWEmU5c3Tfq7PC+TcphU8LmQ9fzlvhv3eiIHEI= X-Received: by 10.28.193.196 with SMTP id r187mr14864567wmf.111.1517064392042; Sat, 27 Jan 2018 06:46:32 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.167.10 with HTTP; Sat, 27 Jan 2018 06:46:11 -0800 (PST) In-Reply-To: References: From: Radoslaw Biernacki Date: Sat, 27 Jan 2018 15:46:11 +0100 Message-ID: To: Anatoly Burakov Cc: dev@dpdk.org, stable@dpdk.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH 2/2] test/memzone: handle previously allocated memzones X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jan 2018 14:46:32 -0000 Thanks, looks OK for me. Reviewed-by: Radoslaw Biernacki adoslaw.biernacki@linaro.com> On 26 January 2018 at 18:40, Anatoly Burakov wrote: > Currently, memzone autotest expects there to be no memzones > present by the time the test is run. Some hardware drivers > will allocate memzones for internal use during initialization, > resulting in tests failing due to unexpected memzones being > allocated before the test was run. > > Fix this by making callback increment a counter instead. This > also doubles as a test for correct operation of memzone_walk(). > > Fixes: 71330483a193 ("test/memzone: fix memory leak") > Cc: radoslaw.biernacki@linaro.org > Cc: stable@dpdk.org > > Signed-off-by: Anatoly Burakov > --- > test/test/test_memzone.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/test/test/test_memzone.c b/test/test/test_memzone.c > index 00d340f..5428b35 100644 > --- a/test/test/test_memzone.c > +++ b/test/test/test_memzone.c > @@ -953,16 +953,19 @@ test_memzone_basic(void) > return 0; > } > > -static int memzone_walk_called; > +static int memzone_walk_cnt; > static void memzone_walk_clb(const struct rte_memzone *mz __rte_unused, > void *arg __rte_unused) > { > - memzone_walk_called = 1; > + memzone_walk_cnt++; > } > > static int > test_memzone(void) > { > + /* take note of how many memzones were allocated before running */ > + int memzone_cnt = rte_eal_get_configuration()-> > mem_config->memzone_cnt; > + > printf("test basic memzone API\n"); > if (test_memzone_basic() < 0) > return -1; > @@ -1000,8 +1003,9 @@ test_memzone(void) > return -1; > > printf("check memzone cleanup\n"); > + memzone_walk_cnt = 0; > rte_memzone_walk(memzone_walk_clb, NULL); > - if (memzone_walk_called) { > + if (memzone_walk_cnt != memzone_cnt) { > printf("there are some memzones left after test\n"); > rte_memzone_dump(stdout); > return -1; > -- > 2.7.4 >