test: remove meson dependency on /proc file
authorThomas Monjalon <thomas@monjalon.net>
Thu, 9 Apr 2020 16:41:49 +0000 (18:41 +0200)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 15 Apr 2020 13:45:24 +0000 (15:45 +0200)
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@monjalon.net>
Tested-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Reviewed-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
MAINTAINERS
app/test/has-hugepage.sh [new file with mode: 0755]
app/test/meson.build

index 144cf5d..fe59f02 100644 (file)
@@ -1469,6 +1469,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 (executable)
index 0000000..d600fad
--- /dev/null
@@ -0,0 +1,11 @@
+#! /bin/sh
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 Mellanox Technologies, Ltd
+
+if [ "$(uname)" = "Linux" ] ; then
+       cat /proc/sys/vm/nr_hugepages || echo 0
+elif [ "$(uname)" = "FreeBSD" ] ; then
+       echo 1 # assume FreeBSD always has hugepages
+else
+       echo 0
+fi
index 777c536..04b59cf 100644 (file)
@@ -396,15 +396,7 @@ dpdk_test = executable('dpdk-test',
        install_rpath: driver_install_path,
        install: true)
 
-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
-endif
+has_hugepage = run_command('has-hugepage.sh').stdout().strip() != '0'
 message('hugepage availability: @0@'.format(has_hugepage))
 
 # some perf tests (eg: memcpy perf autotest)take very long