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

David Marchand david.marchand at redhat.com
Tue Mar 2 10:07:26 CET 2021


On Wed, Feb 10, 2021 at 3:56 PM Aaron Conole <aconole at redhat.com> wrote:
> 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?

> +
> +.. _testing_guidelines:

I can't find a call to the testing_guidelines reference, so this can be removed.


[snip]

> +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?).


[snip]

> +Checking code coverage
> +----------------------
> +The meson build system supports generating a code coverage report
> +via the `-Db_coverage=true` option, in conjunction with a package
> +like **lcov**, to generate an HTML code coverage report.  Example::
> +
> +  $ meson covered -Db_coverage=true

At first, I read "covered" as a meson command :-).
I prefer an explicit "meson setup covered -Db_coverage=true", but well
this is more a matter of taste.


> +  $ meson test -C covered --suite fast-tests
> +  $ ninja coverage-html -C covered
> +
> +The above will generate an html report in the
> +`covered/meson-logs/coveragereport/` directory that can be explored
> +for detailed code covered information.  This can be used to assist
> +in test development.
> +


The rest of the doc lgtm, and this is a good addition, feel free to
add my review tag.
Thanks Aaron.

-- 
David Marchand



More information about the dev mailing list