[dpdk-stable] [PATCH 2/2] test/memzone: handle previously allocated memzones
Radoslaw Biernacki
radoslaw.biernacki at linaro.org
Sat Jan 27 15:46:11 CET 2018
Thanks, looks OK for me.
Reviewed-by: Radoslaw Biernacki <r <ferruh.yigit at intel.com>
adoslaw.biernacki at linaro.com>
On 26 January 2018 at 18:40, Anatoly Burakov <anatoly.burakov at intel.com>
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 at linaro.org
> Cc: stable at dpdk.org
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
> ---
> 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
>
More information about the stable
mailing list