[dpdk-dev] [PATCH v2] test: remove meson dependency on /proc file
Aaron Conole
aconole at redhat.com
Thu Apr 9 21:57:55 CEST 2020
Thomas Monjalon <thomas at monjalon.net> writes:
> Meson is detecting the path /proc/sys/vm/nr_hugepages in the call to cat
> in app/test/meson.build and then adding it as a build dependency.
> This causes build loop if the timestamp of this file keeps changing.
>
> It is fixed by hiding hugepage check in a shell script.
>
> Fixes: 77784ef0fba8 ("test: allow no-huge mode for fast-tests")
>
> Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
> Tested-by: Lukasz Wojciechowski <l.wojciechow at partner.samsung.com>
> ---
Acked-by: Aaron Conole <aconole at redhat.com>
> v2: use variable as pointed by Lukasz
>
> ---
> MAINTAINERS | 1 +
> app/test/has-hugepage.sh | 11 +++++++++++
> app/test/meson.build | 8 ++------
> 3 files changed, 14 insertions(+), 6 deletions(-)
> create mode 100755 app/test/has-hugepage.sh
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 4800f6884a..aa619b6762 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1471,6 +1471,7 @@ F: app/test/Makefile
> F: app/test/autotest*
> F: app/test/commands.c
> F: app/test/get-coremask.sh
> +F: app/test/has-hugepage.sh
> F: app/test/packet_burst_generator.c
> F: app/test/packet_burst_generator.h
> F: app/test/process.h
> diff --git a/app/test/has-hugepage.sh b/app/test/has-hugepage.sh
> new file mode 100755
> index 0000000000..fc6cb7efaa
> --- /dev/null
> +++ b/app/test/has-hugepage.sh
> @@ -0,0 +1,11 @@
> +#! /bin/sh -e
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright 2020 Mellanox Technologies, Ltd
> +
> +linux_hugepages_number=/proc/sys/vm/nr_hugepages
> +
> +if [ -r "$linux_hugepages_number" ] ; then
> + cat $linux_hugepages_number
> +else
> + echo 0
> +fi
> diff --git a/app/test/meson.build b/app/test/meson.build
> index 351d29cb65..542408d614 100644
> --- a/app/test/meson.build
> +++ b/app/test/meson.build
> @@ -399,12 +399,8 @@ dpdk_test = executable('dpdk-test',
>
> has_hugepage = true
> if is_linux
> - check_hugepage = run_command('cat',
> - '/proc/sys/vm/nr_hugepages')
> - if (check_hugepage.returncode() != 0 or
> - check_hugepage.stdout().strip() == '0')
> - has_hugepage = false
> - endif
> + check_hugepage = find_program('has-hugepage.sh')
> + has_hugepage = run_command(check_hugepage).stdout().strip() != '0'
> endif
> message('hugepage availability: @0@'.format(has_hugepage))
More information about the dev
mailing list