xref: /dpdk/doc/guides/prog_guide/meson_ut.rst (revision 1752b087814f5456e288714c4e5813bd37083fab)
1adbeba36SHari Kumar Vemula..  SPDX-License-Identifier: BSD-3-Clause
2adbeba36SHari Kumar Vemula    Copyright(c) 2018-2019 Intel Corporation.
3adbeba36SHari Kumar Vemula
4adbeba36SHari Kumar VemulaRunning DPDK Unit Tests with Meson
5adbeba36SHari Kumar Vemula==================================
6adbeba36SHari Kumar Vemula
7adbeba36SHari Kumar VemulaThis section describes how to run test cases with the DPDK meson build system.
8adbeba36SHari Kumar Vemula
9adbeba36SHari Kumar VemulaSteps to build and install DPDK using meson can be referred
10adbeba36SHari Kumar Vemulain :doc:`build-sdk-meson`
11adbeba36SHari Kumar Vemula
12adbeba36SHari Kumar VemulaGrouping of test cases
13adbeba36SHari Kumar Vemula----------------------
14adbeba36SHari Kumar Vemula
15adbeba36SHari Kumar VemulaTest cases have been classified into four different groups.
16adbeba36SHari Kumar Vemula
17adbeba36SHari Kumar Vemula* Fast tests.
18adbeba36SHari Kumar Vemula* Performance tests.
19adbeba36SHari Kumar Vemula* Driver tests.
20adbeba36SHari Kumar Vemula* Tests which produce lists of objects as output, and therefore that need
21adbeba36SHari Kumar Vemula  manual checking.
22adbeba36SHari Kumar Vemula
23adbeba36SHari Kumar VemulaThese tests can be run using the argument to ``meson test`` as
24adbeba36SHari Kumar Vemula``--suite project_name:label``.
25adbeba36SHari Kumar Vemula
26adbeba36SHari Kumar VemulaFor example::
27adbeba36SHari Kumar Vemula
28adbeba36SHari Kumar Vemula    $ meson test -C <build path> --suite DPDK:fast-tests
29adbeba36SHari Kumar Vemula
30adbeba36SHari Kumar VemulaIf the ``<build path>`` is current working directory,
31adbeba36SHari Kumar Vemulathe ``-C <build path>`` option can be skipped as below::
32adbeba36SHari Kumar Vemula
33adbeba36SHari Kumar Vemula    $ meson test --suite DPDK:fast-tests
34adbeba36SHari Kumar Vemula
35adbeba36SHari Kumar VemulaThe project name is optional so the following is equivalent to the previous
36adbeba36SHari Kumar Vemulacommand::
37adbeba36SHari Kumar Vemula
38adbeba36SHari Kumar Vemula    $ meson test --suite fast-tests
39adbeba36SHari Kumar Vemula
40*1752b087SDavid MarchandIf desired, additional arguments can be passed to the test run via the meson
41*1752b087SDavid Marchand``--test-args`` option.
42*1752b087SDavid MarchandFor example, tests will by default run on as many available cores as is needed
43*1752b087SDavid Marchandfor the test, starting with the lowest number core - generally core 0.
44*1752b087SDavid MarchandTo run the fast-tests suite using only cores 8 through 16, one can use::
45*1752b087SDavid Marchand
46*1752b087SDavid Marchand    $ meson test --suite fast-tests --test-args="-l 8-16"
47*1752b087SDavid Marchand
48adbeba36SHari Kumar VemulaThe meson command to list all available tests::
49adbeba36SHari Kumar Vemula
50adbeba36SHari Kumar Vemula    $ meson test --list
51adbeba36SHari Kumar Vemula
52adbeba36SHari Kumar VemulaTest cases are run serially by default for better stability.
53adbeba36SHari Kumar Vemula
54adbeba36SHari Kumar VemulaArguments of ``test()`` that can be provided in meson.build are as below:
55adbeba36SHari Kumar Vemula
56adbeba36SHari Kumar Vemula* ``is_parallel`` is used to run test case either in parallel or non-parallel mode.
57adbeba36SHari Kumar Vemula* ``timeout`` is used to specify the timeout of test case.
58*1752b087SDavid Marchand* ``args`` is used to specify test specific parameters (see note below).
59adbeba36SHari Kumar Vemula* ``env`` is used to specify test specific environment parameters.
60adbeba36SHari Kumar Vemula
61*1752b087SDavid MarchandNote: the content of meson ``--test-args`` option and the content of ``args``
62*1752b087SDavid Marchandare appended when invoking the DPDK test binary.
63*1752b087SDavid MarchandBecause of this, it is recommended not to set any default coremask or memory
64*1752b087SDavid Marchandconfiguration in per test ``args`` and rather let users select what best fits
65*1752b087SDavid Marchandtheir environment. If a test can't run, then it should be skipped, as described
66*1752b087SDavid Marchandbelow.
67*1752b087SDavid Marchand
68adbeba36SHari Kumar Vemula
69adbeba36SHari Kumar VemulaDealing with skipped test cases
70adbeba36SHari Kumar Vemula-------------------------------
71adbeba36SHari Kumar Vemula
72adbeba36SHari Kumar VemulaSome unit test cases have a dependency on external libraries, driver modules
73adbeba36SHari Kumar Vemulaor config flags, without which the test cases cannot be run. Such test cases
74adbeba36SHari Kumar Vemulawill be reported as skipped if they cannot run. To enable those test cases,
75adbeba36SHari Kumar Vemulathe user should ensure the required dependencies are met.
76adbeba36SHari Kumar VemulaBelow are a few possible causes why tests may be skipped:
77adbeba36SHari Kumar Vemula
78adbeba36SHari Kumar Vemula#. Optional external libraries are not found.
79adbeba36SHari Kumar Vemula#. Config flags for the dependent library are not enabled.
80adbeba36SHari Kumar Vemula#. Dependent driver modules are not installed on the system.
81adbeba36SHari Kumar Vemula#. Not enough processing cores. Some tests are skipped on machines with 2 or 4 cores.
82