Thread (20 messages) 20 messages, 9 authors, 2021-11-26

Re: [dpdk-dev] [PATCH v2] guides: add a testing guide for developing tests

From: Aaron Conole <aconole@redhat.com>
Date: 2021-03-09 16:14:17

Aaron Conole [off-list ref] writes:
Bruce Richardson [off-list ref] writes:
quoted
On Tue, Mar 02, 2021 at 10:07:26AM +0100, David Marchand wrote:
quoted
On Wed, Feb 10, 2021 at 3:56 PM Aaron Conole [off-list ref] wrote:
quoted
diff --git a/doc/guides/contributing/testing.rst b/doc/guides/contributing/testing.rst
new file mode 100644
index 0000000000..86ca24ce43
--- /dev/null
+++ b/doc/guides/contributing/testing.rst
@@ -0,0 +1,245 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright 2018 The DPDK contributors
2021?
Whoops, I forgot to update my time machine.
quoted
quoted
quoted
+
+.. _testing_guidelines:
I can't find a call to the testing_guidelines reference, so this can be removed.
done.
quoted
quoted
[snip]
quoted
+The suites can be selected by adding the ``--suite`` option to the
+``meson test`` command.  Ex: ``meson test --suite fast-tests``::
+
+  $ meson test -C build --suite fast-tests
+  ninja: Entering directory `/home/aconole/git/dpdk/build'
+  [2543/2543] Linking target app/test/dpdk-test.
+  1/60 DPDK:fast-tests / acl_autotest          OK       3.17 s
+  2/60 DPDK:fast-tests / bitops_autotest       OK       0.22 s
+  3/60 DPDK:fast-tests / byteorder_autotest    OK       0.22 s
+  4/60 DPDK:fast-tests / cmdline_autotest      OK       0.28 s
+  5/60 DPDK:fast-tests / common_autotest       OK       0.57 s
+  6/60 DPDK:fast-tests / cpuflags_autotest     OK       0.27 s
+  ...
Trying this in my build env, I get all tests failing.
This is because I run this as a normal user, but the system has
hugepages configured.
I figured this out quickly since I know the test framework (simply
added a echo 0; exit at the top of has-hugepages.sh).
But I am not sure a reader of this doc would be able to troubleshoot this.

Not sure if this is worth explaining here, or if we can enhance the
hugepage check (permissions maybe?).
I prefer to fix the hugepage check to make the tests SKIP when we don't
have hugepages accessible (so we need some kind of permission check in
there).  I will submit it separately.
Here is my PoC for this - if you think it's good enough, I'll submit as
formal PATCH.

---
index d600fad319..1c3cfb665a 100755
--- a/app/test/has-hugepage.sh
+++ b/app/test/has-hugepage.sh
@@ -3,7 +3,17 @@
 # Copyright 2020 Mellanox Technologies, Ltd
 
 if [ "$(uname)" = "Linux" ] ; then
-       cat /proc/sys/vm/nr_hugepages || echo 0
+       nr_hugepages=$(cat /proc/sys/vm/nr_hugepages)
+       # Need to check if we have permissions to access hugepages
+       perm=""
+       for mount in `mount | grep hugetlbfs | awk '{ print $3; }'`; do
+               test ! -w $mount/. || perm="$mount"
+       done
+       if [ "$perm" = "" -o "$nr_hugepages" = "0" ]; then
+               echo 0
+       else
+               echo $nr_hugepages
+       fi
 elif [ "$(uname)" = "FreeBSD" ] ; then
        echo 1 # assume FreeBSD always has hugepages
 else
---
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help