mbox

[RFC,0/5] replace build code for unit tests

Message ID 20230721115125.55137-1-bruce.richardson@intel.com (mailing list archive)
Headers

Message

Bruce Richardson July 21, 2023, 11:51 a.m. UTC
  While working on series such as [1] to make DPDK builds more
configurable, the majority of the complexity involved centered on the
unit tests, and ensuring that the individual files were added/removed
from the build as the components were enabled/disabled.

This complexity was exacerbated by:
* C files having multiple dependencies, specifically,
* Some libraries having one set of independent tests, while other
  library tests requiring additional components
* Having to maintain lists of tests in various suites which also needed
  to be updated, depending on component availability.
* Everything having to be checked via if-else clauses, since this was
  not data-driven

This RFC attempts to address these issues by doing the following:
* Creating a per-file dependency list for the autotests, allowing easy
  checks of when a file could be built
* Tagging the various fast-tests/perf-tests/drivers-tests suites via
  macros in the C code. Then scan the C-files we are building to
  construct the test suites based on what is available


This RFC is just an early prototype, and probably needs cleanup and
validation of the dependency lists. Windows support is probably also
broken, given the fact that our current build file maintains custom
lists there. However, I would hope it should not be too big a job to
enable the unit tests for the windows components that are already
available. (Tests for any components not being build on windows are
already removed via the dependency lists).

Another (hopefully less-impactful) side-effect of this change is that
the "test" binary has moved in the build folder. It is now put
along-side the other binaries in "build/app" rather than being in the
subdirectory "build/app/test".

Future work could also be done to scan the C files that are not being
build for tests. Those tests could then be stubbed out in an
auto-genereated file to always return "SKIPPED", meaning that all test
commands are always valid, irrespective of what components are present
or not.

[1] http://patches.dpdk.org/project/dpdk/list/?series=28628&state=10

Bruce Richardson (5):
  app/test: add new macros for various test types
  app/test: tag tests with the test type
  app/test: build using per-file dependency matrix
  app/test: define unit tests suites based on test macros
  app/test: add fast test suite to new build infrastructure

 app/meson.build                               |  15 +-
 app/test/meson.build                          | 796 +++++-------------
 app/test/suites/meson.build                   |  75 ++
 app/test/test.h                               |   9 +-
 app/test/test_acl.c                           |   2 +-
 app/test/test_atomic.c                        |   2 +-
 app/test/test_barrier.c                       |   2 +-
 app/test/test_bitmap.c                        |   2 +-
 app/test/test_bitops.c                        |   2 +-
 app/test/test_bpf.c                           |   4 +-
 app/test/test_byteorder.c                     |   2 +-
 app/test/test_cksum.c                         |   2 +-
 app/test/test_cmdline.c                       |   2 +-
 app/test/test_common.c                        |   2 +-
 app/test/test_cpuflags.c                      |   2 +-
 app/test/test_crc.c                           |   2 +-
 app/test/test_cryptodev.c                     |  38 +-
 app/test/test_cryptodev_asym.c                |   2 +-
 app/test/test_cycles.c                        |   2 +-
 app/test/test_debug.c                         |   2 +-
 app/test/test_devargs.c                       |   2 +-
 app/test/test_distributor.c                   |   2 +-
 app/test/test_distributor_perf.c              |   2 +-
 app/test/test_dmadev.c                        |   2 +-
 app/test/test_eal_flags.c                     |  24 +-
 app/test/test_eal_fs.c                        |   2 +-
 app/test/test_efd.c                           |   2 +-
 app/test/test_efd_perf.c                      |   2 +-
 app/test/test_errno.c                         |   2 +-
 app/test/test_ethdev_link.c                   |   2 +-
 app/test/test_event_ring.c                    |   2 +-
 app/test/test_eventdev.c                      |   2 +-
 app/test/test_fbarray.c                       |   2 +-
 app/test/test_fib.c                           |   4 +-
 app/test/test_fib6.c                          |   4 +-
 app/test/test_fib6_perf.c                     |   2 +-
 app/test/test_fib_perf.c                      |   2 +-
 app/test/test_func_reentrancy.c               |   2 +-
 app/test/test_hash.c                          |   2 +-
 app/test/test_hash_functions.c                |   2 +-
 app/test/test_hash_multiwriter.c              |   2 +-
 app/test/test_hash_perf.c                     |   2 +-
 app/test/test_hash_readwrite.c                |   4 +-
 app/test/test_hash_readwrite_lf_perf.c        |   2 +-
 app/test/test_interrupts.c                    |   2 +-
 app/test/test_ipfrag.c                        |   2 +-
 app/test/test_ipsec.c                         |   2 +-
 app/test/test_ipsec_perf.c                    |   2 +-
 app/test/test_kni.c                           |   2 +-
 app/test/test_kvargs.c                        |   2 +-
 app/test/test_lcores.c                        |   2 +-
 app/test/test_logs.c                          |   2 +-
 app/test/test_lpm.c                           |   2 +-
 app/test/test_lpm6.c                          |   2 +-
 app/test/test_lpm6_perf.c                     |   2 +-
 app/test/test_lpm_perf.c                      |   2 +-
 app/test/test_malloc.c                        |   2 +-
 app/test/test_malloc_perf.c                   |   2 +-
 app/test/test_mbuf.c                          |   2 +-
 app/test/test_mcslock.c                       |   2 +-
 app/test/test_member.c                        |   2 +-
 app/test/test_member_perf.c                   |   2 +-
 app/test/test_memcpy.c                        |   2 +-
 app/test/test_memcpy_perf.c                   |   2 +-
 app/test/test_memory.c                        |   2 +-
 app/test/test_mempool.c                       |   2 +-
 app/test/test_mempool_perf.c                  |   2 +-
 app/test/test_memzone.c                       |   2 +-
 app/test/test_meter.c                         |   2 +-
 app/test/test_mp_secondary.c                  |   2 +-
 app/test/test_per_lcore.c                     |   2 +-
 app/test/test_pflock.c                        |   2 +-
 app/test/test_pie.c                           |   6 +-
 app/test/test_pmd_perf.c                      |   2 +-
 app/test/test_power.c                         |   2 +-
 app/test/test_power_cpufreq.c                 |   2 +-
 app/test/test_power_intel_uncore.c            |   2 +-
 app/test/test_power_kvm_vm.c                  |   2 +-
 app/test/test_prefetch.c                      |   2 +-
 app/test/test_rand_perf.c                     |   2 +-
 app/test/test_rcu_qsbr.c                      |   2 +-
 app/test/test_rcu_qsbr_perf.c                 |   2 +-
 app/test/test_reassembly_perf.c               |   2 +-
 app/test/test_reciprocal_division.c           |   2 +-
 app/test/test_reciprocal_division_perf.c      |   2 +-
 app/test/test_red.c                           |   4 +-
 app/test/test_reorder.c                       |   2 +-
 app/test/test_rib.c                           |   4 +-
 app/test/test_rib6.c                          |   4 +-
 app/test/test_ring.c                          |   2 +-
 app/test/test_ring_perf.c                     |   2 +-
 app/test/test_rwlock.c                        |   8 +-
 app/test/test_sched.c                         |   2 +-
 app/test/test_security.c                      |   2 +-
 app/test/test_seqlock.c                       |   2 +-
 app/test/test_service_cores.c                 |   4 +-
 app/test/test_spinlock.c                      |   2 +-
 app/test/test_stack.c                         |   4 +-
 app/test/test_stack_perf.c                    |   4 +-
 app/test/test_string_fns.c                    |   2 +-
 app/test/test_tailq.c                         |   2 +-
 app/test/test_thash.c                         |   2 +-
 app/test/test_thash_perf.c                    |   2 +-
 app/test/test_threads.c                       |   2 +-
 app/test/test_ticketlock.c                    |   2 +-
 app/test/test_timer.c                         |   2 +-
 app/test/test_timer_perf.c                    |   2 +-
 app/test/test_timer_racecond.c                |   2 +-
 app/test/test_trace.c                         |   2 +-
 app/test/test_trace_perf.c                    |   2 +-
 app/test/test_version.c                       |   2 +-
 buildtools/get-test-suites.py                 |  33 +
 .../has-hugepages.py                          |   0
 buildtools/meson.build                        |   2 +
 114 files changed, 478 insertions(+), 754 deletions(-)
 create mode 100644 app/test/suites/meson.build
 create mode 100644 buildtools/get-test-suites.py
 rename app/test/has_hugepage.py => buildtools/has-hugepages.py (100%)

--
2.39.2
  

Comments

David Marchand Aug. 8, 2023, 8:46 a.m. UTC | #1
Hello Bruce,

On Fri, Jul 21, 2023 at 1:51 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> While working on series such as [1] to make DPDK builds more
> configurable, the majority of the complexity involved centered on the
> unit tests, and ensuring that the individual files were added/removed
> from the build as the components were enabled/disabled.
>
> This complexity was exacerbated by:
> * C files having multiple dependencies, specifically,
> * Some libraries having one set of independent tests, while other
>   library tests requiring additional components
> * Having to maintain lists of tests in various suites which also needed
>   to be updated, depending on component availability.
> * Everything having to be checked via if-else clauses, since this was
>   not data-driven
>
> This RFC attempts to address these issues by doing the following:
> * Creating a per-file dependency list for the autotests, allowing easy
>   checks of when a file could be built
> * Tagging the various fast-tests/perf-tests/drivers-tests suites via
>   macros in the C code. Then scan the C-files we are building to
>   construct the test suites based on what is available

I did not look into the implementation details too much but I like the idea.

>
>
> This RFC is just an early prototype, and probably needs cleanup and
> validation of the dependency lists. Windows support is probably also
> broken, given the fact that our current build file maintains custom
> lists there. However, I would hope it should not be too big a job to
> enable the unit tests for the windows components that are already
> available. (Tests for any components not being build on windows are
> already removed via the dependency lists).
>
> Another (hopefully less-impactful) side-effect of this change is that
> the "test" binary has moved in the build folder. It is now put
> along-side the other binaries in "build/app" rather than being in the
> subdirectory "build/app/test".

Cc: ci people.

It may break some CI scripts but it is hard to tell which one.
As far as testsuites we run in GHA or UNH are concerned, it is done
through meson test so we are good on this side.


>
> Future work could also be done to scan the C files that are not being
> build for tests. Those tests could then be stubbed out in an
> auto-genereated file to always return "SKIPPED", meaning that all test
> commands are always valid, irrespective of what components are present
> or not.
>
> [1] http://patches.dpdk.org/project/dpdk/list/?series=28628&state=10
>
> Bruce Richardson (5):
>   app/test: add new macros for various test types
>   app/test: tag tests with the test type
>   app/test: build using per-file dependency matrix
>   app/test: define unit tests suites based on test macros
>   app/test: add fast test suite to new build infrastructure
>
>  app/meson.build                               |  15 +-
>  app/test/meson.build                          | 796 +++++-------------
>  app/test/suites/meson.build                   |  75 ++
>  app/test/test.h                               |   9 +-
>  app/test/test_acl.c                           |   2 +-
>  app/test/test_atomic.c                        |   2 +-
>  app/test/test_barrier.c                       |   2 +-
>  app/test/test_bitmap.c                        |   2 +-
>  app/test/test_bitops.c                        |   2 +-
>  app/test/test_bpf.c                           |   4 +-
>  app/test/test_byteorder.c                     |   2 +-
>  app/test/test_cksum.c                         |   2 +-
>  app/test/test_cmdline.c                       |   2 +-
>  app/test/test_common.c                        |   2 +-
>  app/test/test_cpuflags.c                      |   2 +-
>  app/test/test_crc.c                           |   2 +-
>  app/test/test_cryptodev.c                     |  38 +-
>  app/test/test_cryptodev_asym.c                |   2 +-
>  app/test/test_cycles.c                        |   2 +-
>  app/test/test_debug.c                         |   2 +-
>  app/test/test_devargs.c                       |   2 +-
>  app/test/test_distributor.c                   |   2 +-
>  app/test/test_distributor_perf.c              |   2 +-
>  app/test/test_dmadev.c                        |   2 +-
>  app/test/test_eal_flags.c                     |  24 +-
>  app/test/test_eal_fs.c                        |   2 +-
>  app/test/test_efd.c                           |   2 +-
>  app/test/test_efd_perf.c                      |   2 +-
>  app/test/test_errno.c                         |   2 +-
>  app/test/test_ethdev_link.c                   |   2 +-
>  app/test/test_event_ring.c                    |   2 +-
>  app/test/test_eventdev.c                      |   2 +-
>  app/test/test_fbarray.c                       |   2 +-
>  app/test/test_fib.c                           |   4 +-
>  app/test/test_fib6.c                          |   4 +-
>  app/test/test_fib6_perf.c                     |   2 +-
>  app/test/test_fib_perf.c                      |   2 +-
>  app/test/test_func_reentrancy.c               |   2 +-
>  app/test/test_hash.c                          |   2 +-
>  app/test/test_hash_functions.c                |   2 +-
>  app/test/test_hash_multiwriter.c              |   2 +-
>  app/test/test_hash_perf.c                     |   2 +-
>  app/test/test_hash_readwrite.c                |   4 +-
>  app/test/test_hash_readwrite_lf_perf.c        |   2 +-
>  app/test/test_interrupts.c                    |   2 +-
>  app/test/test_ipfrag.c                        |   2 +-
>  app/test/test_ipsec.c                         |   2 +-
>  app/test/test_ipsec_perf.c                    |   2 +-
>  app/test/test_kni.c                           |   2 +-
>  app/test/test_kvargs.c                        |   2 +-
>  app/test/test_lcores.c                        |   2 +-
>  app/test/test_logs.c                          |   2 +-
>  app/test/test_lpm.c                           |   2 +-
>  app/test/test_lpm6.c                          |   2 +-
>  app/test/test_lpm6_perf.c                     |   2 +-
>  app/test/test_lpm_perf.c                      |   2 +-
>  app/test/test_malloc.c                        |   2 +-
>  app/test/test_malloc_perf.c                   |   2 +-
>  app/test/test_mbuf.c                          |   2 +-
>  app/test/test_mcslock.c                       |   2 +-
>  app/test/test_member.c                        |   2 +-
>  app/test/test_member_perf.c                   |   2 +-
>  app/test/test_memcpy.c                        |   2 +-
>  app/test/test_memcpy_perf.c                   |   2 +-
>  app/test/test_memory.c                        |   2 +-
>  app/test/test_mempool.c                       |   2 +-
>  app/test/test_mempool_perf.c                  |   2 +-
>  app/test/test_memzone.c                       |   2 +-
>  app/test/test_meter.c                         |   2 +-
>  app/test/test_mp_secondary.c                  |   2 +-
>  app/test/test_per_lcore.c                     |   2 +-
>  app/test/test_pflock.c                        |   2 +-
>  app/test/test_pie.c                           |   6 +-
>  app/test/test_pmd_perf.c                      |   2 +-
>  app/test/test_power.c                         |   2 +-
>  app/test/test_power_cpufreq.c                 |   2 +-
>  app/test/test_power_intel_uncore.c            |   2 +-
>  app/test/test_power_kvm_vm.c                  |   2 +-
>  app/test/test_prefetch.c                      |   2 +-
>  app/test/test_rand_perf.c                     |   2 +-
>  app/test/test_rcu_qsbr.c                      |   2 +-
>  app/test/test_rcu_qsbr_perf.c                 |   2 +-
>  app/test/test_reassembly_perf.c               |   2 +-
>  app/test/test_reciprocal_division.c           |   2 +-
>  app/test/test_reciprocal_division_perf.c      |   2 +-
>  app/test/test_red.c                           |   4 +-
>  app/test/test_reorder.c                       |   2 +-
>  app/test/test_rib.c                           |   4 +-
>  app/test/test_rib6.c                          |   4 +-
>  app/test/test_ring.c                          |   2 +-
>  app/test/test_ring_perf.c                     |   2 +-
>  app/test/test_rwlock.c                        |   8 +-
>  app/test/test_sched.c                         |   2 +-
>  app/test/test_security.c                      |   2 +-
>  app/test/test_seqlock.c                       |   2 +-
>  app/test/test_service_cores.c                 |   4 +-
>  app/test/test_spinlock.c                      |   2 +-
>  app/test/test_stack.c                         |   4 +-
>  app/test/test_stack_perf.c                    |   4 +-
>  app/test/test_string_fns.c                    |   2 +-
>  app/test/test_tailq.c                         |   2 +-
>  app/test/test_thash.c                         |   2 +-
>  app/test/test_thash_perf.c                    |   2 +-
>  app/test/test_threads.c                       |   2 +-
>  app/test/test_ticketlock.c                    |   2 +-
>  app/test/test_timer.c                         |   2 +-
>  app/test/test_timer_perf.c                    |   2 +-
>  app/test/test_timer_racecond.c                |   2 +-
>  app/test/test_trace.c                         |   2 +-
>  app/test/test_trace_perf.c                    |   2 +-
>  app/test/test_version.c                       |   2 +-
>  buildtools/get-test-suites.py                 |  33 +
>  .../has-hugepages.py                          |   0
>  buildtools/meson.build                        |   2 +
>  114 files changed, 478 insertions(+), 754 deletions(-)
>  create mode 100644 app/test/suites/meson.build
>  create mode 100644 buildtools/get-test-suites.py
>  rename app/test/has_hugepage.py => buildtools/has-hugepages.py (100%)
>
> --
> 2.39.2
>
  
Patrick Robb Aug. 9, 2023, 2:53 p.m. UTC | #2
It will break our 32 bit arm testing because we are unable to use meson
test after building for that SoC, so we run through unit tests with a
custom list using just dpdk test. It's not a problem, I just need to know
when this is going to reach main so I can make the corresponding change to
the 32 bit unit testing script beforehand.
  
Bruce Richardson Aug. 9, 2023, 3:05 p.m. UTC | #3
On Wed, Aug 09, 2023 at 10:53:21AM -0400, Patrick Robb wrote:
>    It will break our 32 bit arm testing because we are unable to use meson
>    test after building for that SoC, so we run through unit tests with a
>    custom list using just dpdk test. It's not a problem, I just need to
>    know when this is going to reach main so I can make the corresponding
>    change to the 32 bit unit testing script beforehand.

The change is necessary because the test binary has moved? Just want to
check there are no other issues. I might see if I can provide a symlink or
something for compatibility if it helps.
  
Patrick Robb Aug. 9, 2023, 3:39 p.m. UTC | #4
On Wed, Aug 9, 2023 at 11:05 AM Bruce Richardson <bruce.richardson@intel.com>
wrote:

> On Wed, Aug 09, 2023 at 10:53:21AM -0400, Patrick Robb wrote:
> >    It will break our 32 bit arm testing because we are unable to use
> meson
> >    test after building for that SoC, so we run through unit tests with a
> >    custom list using just dpdk test. It's not a problem, I just need to
> >    know when this is going to reach main so I can make the corresponding
> >    change to the 32 bit unit testing script beforehand.
>
> The change is necessary because the test binary has moved? Just want to
> check there are no other issues. I might see if I can provide a symlink or
> something for compatibility if it helps.
>

That's correct, there are no other issues, so it really is simple to
correct the patch in our script. A symlink should work, but I guess it
becomes clutter.
  
Bruce Richardson Aug. 14, 2023, 3:16 p.m. UTC | #5
This patchset contains changes to DPDK to make the build more configurable
overall. The changes can be grouped into two areas:

* Firstly, there are changes to make the build of the unit tests more
  flexible and maintainable. These 5 patches switch the unit tests from
  having separate hard-coded lists of files and tests, with lots of
  conditional logic to add/remove items from the list, to instead being
  a single list of files and dependencies per-file. The actual lists of
  test-suites are built up dynamically from the list of files whose
  dependencies are met and therefore will be part of the build.
  This rework enables...
* The second set of patches which expands the list of libraries which
  can be disabled at build-time, while still giving a successful build
  of DPDK. Overall, after this set is applied, the list of optional
  libraries in DPDK is approx doubled in size. [15 additions giving
  31 optional libs]

NOTES:
* as stated in the RFC, the test binary moves in the build as a result
  of this set - from app/test/dpdk-test to app/dpdk-test.
* running the suites of tests no longer works after patch 4 until patch
  5 is applied. If this is an issue, the two patches can be merged on
  apply. However, the individual tests are still runnable through the
  test binary - it's only through "meson test" that there are issues, so
  I'm keeping the patches separate since each is relatively complex in its
  own right.

V2:
- Changes since RFC:
   -  merged two previous sets - reworking test build, and disabling
      libs - into one, since they depend on each other
   -  Reworked the list of dependencies for each file in the tests,
      so that files that depend on other files have those deps called
      out.
   -  Added list of external dependencies to the test builds
   -  For disabling libs, merged patches disabling individual libs
      together into one patch, since all unit test build changes were
      unnecessary. This made each patch a single-line addition to
      the optional list in lib/meson.build.

Bruce Richardson (8):
  app/test: add new macros for various test types
  app/test: tag tests with the test type
  app/test: make telemetry data test buildable on windows
  app/test: build using per-file dependency matrix
  app/test: define unit tests suites based on test macros
  examples/l3fwd: make eventdev an optional dependency
  build: make most device classes optional
  build: expand list of optional libraries

 app/meson.build                               |  15 +-
 app/test/meson.build                          | 818 +++++-------------
 app/test/suites/meson.build                   |  76 ++
 app/test/test.h                               |   9 +-
 app/test/test_acl.c                           |   2 +-
 app/test/test_atomic.c                        |   2 +-
 app/test/test_barrier.c                       |   2 +-
 app/test/test_bitmap.c                        |   2 +-
 app/test/test_bitops.c                        |   2 +-
 app/test/test_bpf.c                           |   4 +-
 app/test/test_byteorder.c                     |   2 +-
 app/test/test_cksum.c                         |   2 +-
 app/test/test_cmdline.c                       |   2 +-
 app/test/test_common.c                        |   2 +-
 app/test/test_cpuflags.c                      |   2 +-
 app/test/test_crc.c                           |   2 +-
 app/test/test_cryptodev.c                     |  38 +-
 app/test/test_cryptodev_asym.c                |   2 +-
 app/test/test_cycles.c                        |   2 +-
 app/test/test_debug.c                         |   2 +-
 app/test/test_devargs.c                       |   2 +-
 app/test/test_distributor.c                   |   2 +-
 app/test/test_distributor_perf.c              |   2 +-
 app/test/test_dmadev.c                        |   2 +-
 app/test/test_eal_flags.c                     |  24 +-
 app/test/test_eal_fs.c                        |   2 +-
 app/test/test_efd.c                           |   2 +-
 app/test/test_efd_perf.c                      |   2 +-
 app/test/test_errno.c                         |   2 +-
 app/test/test_ethdev_link.c                   |   2 +-
 app/test/test_event_ring.c                    |   2 +-
 app/test/test_eventdev.c                      |   2 +-
 app/test/test_fbarray.c                       |   2 +-
 app/test/test_fib.c                           |   4 +-
 app/test/test_fib6.c                          |   4 +-
 app/test/test_fib6_perf.c                     |   2 +-
 app/test/test_fib_perf.c                      |   2 +-
 app/test/test_func_reentrancy.c               |   2 +-
 app/test/test_hash.c                          |   2 +-
 app/test/test_hash_functions.c                |   2 +-
 app/test/test_hash_multiwriter.c              |   2 +-
 app/test/test_hash_perf.c                     |   2 +-
 app/test/test_hash_readwrite.c                |   4 +-
 app/test/test_hash_readwrite_lf_perf.c        |   2 +-
 app/test/test_interrupts.c                    |   2 +-
 app/test/test_ipfrag.c                        |   2 +-
 app/test/test_ipsec.c                         |   2 +-
 app/test/test_ipsec_perf.c                    |   2 +-
 app/test/test_kvargs.c                        |   2 +-
 app/test/test_lcores.c                        |   2 +-
 app/test/test_logs.c                          |   2 +-
 app/test/test_lpm.c                           |   2 +-
 app/test/test_lpm6.c                          |   2 +-
 app/test/test_lpm6_perf.c                     |   2 +-
 app/test/test_lpm_perf.c                      |   2 +-
 app/test/test_malloc.c                        |   2 +-
 app/test/test_malloc_perf.c                   |   2 +-
 app/test/test_mbuf.c                          |   2 +-
 app/test/test_mcslock.c                       |   2 +-
 app/test/test_member.c                        |   2 +-
 app/test/test_member_perf.c                   |   2 +-
 app/test/test_memcpy.c                        |   2 +-
 app/test/test_memcpy_perf.c                   |   2 +-
 app/test/test_memory.c                        |   2 +-
 app/test/test_mempool.c                       |   2 +-
 app/test/test_mempool_perf.c                  |   2 +-
 app/test/test_memzone.c                       |   2 +-
 app/test/test_meter.c                         |   2 +-
 app/test/test_mp_secondary.c                  |   2 +-
 app/test/test_per_lcore.c                     |   2 +-
 app/test/test_pflock.c                        |   2 +-
 app/test/test_pie.c                           |   6 +-
 app/test/test_pmd_perf.c                      |   2 +-
 app/test/test_power.c                         |   2 +-
 app/test/test_power_cpufreq.c                 |   2 +-
 app/test/test_power_intel_uncore.c            |   2 +-
 app/test/test_power_kvm_vm.c                  |   2 +-
 app/test/test_prefetch.c                      |   2 +-
 app/test/test_rand_perf.c                     |   2 +-
 app/test/test_rcu_qsbr.c                      |   2 +-
 app/test/test_rcu_qsbr_perf.c                 |   2 +-
 app/test/test_reassembly_perf.c               |   2 +-
 app/test/test_reciprocal_division.c           |   2 +-
 app/test/test_reciprocal_division_perf.c      |   2 +-
 app/test/test_red.c                           |   4 +-
 app/test/test_reorder.c                       |   2 +-
 app/test/test_rib.c                           |   4 +-
 app/test/test_rib6.c                          |   4 +-
 app/test/test_ring.c                          |   2 +-
 app/test/test_ring_perf.c                     |   2 +-
 app/test/test_rwlock.c                        |   8 +-
 app/test/test_sched.c                         |   2 +-
 app/test/test_security.c                      |   2 +-
 app/test/test_seqlock.c                       |   2 +-
 app/test/test_service_cores.c                 |   4 +-
 app/test/test_spinlock.c                      |   2 +-
 app/test/test_stack.c                         |   4 +-
 app/test/test_stack_perf.c                    |   4 +-
 app/test/test_string_fns.c                    |   2 +-
 app/test/test_tailq.c                         |   2 +-
 app/test/test_telemetry_data.c                |  14 +-
 app/test/test_thash.c                         |   2 +-
 app/test/test_thash_perf.c                    |   2 +-
 app/test/test_threads.c                       |   2 +-
 app/test/test_ticketlock.c                    |   2 +-
 app/test/test_timer.c                         |   2 +-
 app/test/test_timer_perf.c                    |   2 +-
 app/test/test_timer_racecond.c                |   2 +-
 app/test/test_trace.c                         |   2 +-
 app/test/test_trace_perf.c                    |   2 +-
 app/test/test_version.c                       |   2 +-
 buildtools/get-test-suites.py                 |  33 +
 .../has-hugepages.py                          |   0
 buildtools/meson.build                        |   2 +
 examples/l3fwd/l3fwd_em.c                     |   2 +
 examples/l3fwd/l3fwd_em_hlm.h                 |   2 +
 examples/l3fwd/l3fwd_event.c                  |   2 +
 examples/l3fwd/l3fwd_event.h                  |   7 +-
 examples/l3fwd/l3fwd_event_generic.c          |   2 +
 examples/l3fwd/l3fwd_event_internal_port.c    |   2 +
 examples/l3fwd/l3fwd_fib.c                    |   2 +
 examples/l3fwd/l3fwd_lpm.c                    |   2 +
 examples/l3fwd/main.c                         |  65 +-
 examples/l3fwd/meson.build                    |   5 +-
 lib/meson.build                               |  15 +
 125 files changed, 607 insertions(+), 766 deletions(-)
 create mode 100644 app/test/suites/meson.build
 create mode 100644 buildtools/get-test-suites.py
 rename app/test/has_hugepage.py => buildtools/has-hugepages.py (100%)

--
2.39.2
  
Bruce Richardson Aug. 14, 2023, 3:22 p.m. UTC | #6
On Mon, Aug 14, 2023 at 04:16:01PM +0100, Bruce Richardson wrote:
> This patchset contains changes to DPDK to make the build more configurable
> overall. The changes can be grouped into two areas:
> 
> * Firstly, there are changes to make the build of the unit tests more
>   flexible and maintainable. These 5 patches switch the unit tests from
>   having separate hard-coded lists of files and tests, with lots of
>   conditional logic to add/remove items from the list, to instead being
>   a single list of files and dependencies per-file. The actual lists of
>   test-suites are built up dynamically from the list of files whose
>   dependencies are met and therefore will be part of the build.
>   This rework enables...
> * The second set of patches which expands the list of libraries which
>   can be disabled at build-time, while still giving a successful build
>   of DPDK. Overall, after this set is applied, the list of optional
>   libraries in DPDK is approx doubled in size. [15 additions giving
>   31 optional libs]
> 
> NOTES:
> * as stated in the RFC, the test binary moves in the build as a result
>   of this set - from app/test/dpdk-test to app/dpdk-test.
> * running the suites of tests no longer works after patch 4 until patch
>   5 is applied. If this is an issue, the two patches can be merged on
>   apply. However, the individual tests are still runnable through the
>   test binary - it's only through "meson test" that there are issues, so
>   I'm keeping the patches separate since each is relatively complex in its
>   own right.
> 
Apologies, some other things I neglected to mention in the notes above.

This patchset has revealed some issues with the building and running of
unit tests:
* Some files/tests were not getting built, and look to have been missed
  years ago in the move from make to meson. Specifically those tests using
  external resources, e.g. the cfgfile tests, are not buildable and have
  not been for years.
* There are quite a number of tests defined that are not registered in a
  test suite in meson and which cannot be run through meson test. Since the
  test cases were automatically tagged via script when generating this
  patchset, the offending test cases can now be found by grepping the
  sources for use of the old "REGISTER_TEST_COMMAND" macro.

The fixing of these issues I consider outside the scope of this set, and
won't be looking at in subsequent revisions. Hopefully #2 should be fairly
easy to rectify in future, but #1 may be more complex.

/Bruce
  
Bruce Richardson Aug. 14, 2023, 6:20 p.m. UTC | #7
This patchset contains changes to DPDK to make the build more configurable
overall. The changes can be grouped into two areas:

* Firstly, there are changes to make the build of the unit tests more
  flexible and maintainable. These 5 patches switch the unit tests from
  having separate hard-coded lists of files and tests, with lots of
  conditional logic to add/remove items from the list, to instead being
  a single list of files and dependencies per-file. The actual lists of
  test-suites are built up dynamically from the list of files whose
  dependencies are met and therefore will be part of the build.
  This rework enables...
* The second set of patches which expands the list of libraries which
  can be disabled at build-time, while still giving a successful build
  of DPDK. Overall, after this set is applied, the list of optional
  libraries in DPDK is approx doubled in size. [15 additions giving
  31 optional libs]

NOTES:
* as stated in the RFC, the test binary moves in the build as a result
  of this set - from app/test/dpdk-test to app/dpdk-test.
* running the suites of tests no longer works after patch 4 until patch
  5 is applied. If this is an issue, the two patches can be merged on
  apply. However, the individual tests are still runnable through the
  test binary - it's only through "meson test" that there are issues, so
  I'm keeping the patches separate since each is relatively complex in its
  own right.
* A number of files in the test directory were not being built, and seem
  to have never been built with meson. This requires separate work, outside
  the scope of the patchset to fix.
* Similarly, some unit tests were never added to test suites. These can
  now be found by using grep to find the old REGISTER_TEST_COMMAND macro.
  Again, adding orphan tests to suites is outside the scope of this set.

V3:
- Create symlink to old path to test binary, to ensure all automated CI,
  and any other use of the test binary still works.

V2:
- Changes since RFC:
   -  merged two previous sets - reworking test build, and disabling
      libs - into one, since they depend on each other
   -  Reworked the list of dependencies for each file in the tests,
      so that files that depend on other files have those deps called
      out.
   -  Added list of external dependencies to the test builds
   -  For disabling libs, merged patches disabling individual libs
      together into one patch, since all unit test build changes were
      unnecessary. This made each patch a single-line addition to
      the optional list in lib/meson.build.

Bruce Richardson (8):
  app/test: add new macros for various test types
  app/test: tag tests with the test type
  app/test: make telemetry data test buildable on windows
  app/test: build using per-file dependency matrix
  app/test: define unit tests suites based on test macros
  examples/l3fwd: make eventdev an optional dependency
  build: make most device classes optional
  build: expand list of optional libraries

 app/meson.build                               |  15 +-
 app/test/meson.build                          | 823 +++++-------------
 app/test/suites/meson.build                   |  76 ++
 app/test/test.h                               |   9 +-
 app/test/test_acl.c                           |   2 +-
 app/test/test_atomic.c                        |   2 +-
 app/test/test_barrier.c                       |   2 +-
 app/test/test_bitmap.c                        |   2 +-
 app/test/test_bitops.c                        |   2 +-
 app/test/test_bpf.c                           |   4 +-
 app/test/test_byteorder.c                     |   2 +-
 app/test/test_cksum.c                         |   2 +-
 app/test/test_cmdline.c                       |   2 +-
 app/test/test_common.c                        |   2 +-
 app/test/test_cpuflags.c                      |   2 +-
 app/test/test_crc.c                           |   2 +-
 app/test/test_cryptodev.c                     |  38 +-
 app/test/test_cryptodev_asym.c                |   2 +-
 app/test/test_cycles.c                        |   2 +-
 app/test/test_debug.c                         |   2 +-
 app/test/test_devargs.c                       |   2 +-
 app/test/test_distributor.c                   |   2 +-
 app/test/test_distributor_perf.c              |   2 +-
 app/test/test_dmadev.c                        |   2 +-
 app/test/test_eal_flags.c                     |  24 +-
 app/test/test_eal_fs.c                        |   2 +-
 app/test/test_efd.c                           |   2 +-
 app/test/test_efd_perf.c                      |   2 +-
 app/test/test_errno.c                         |   2 +-
 app/test/test_ethdev_link.c                   |   2 +-
 app/test/test_event_ring.c                    |   2 +-
 app/test/test_eventdev.c                      |   2 +-
 app/test/test_fbarray.c                       |   2 +-
 app/test/test_fib.c                           |   4 +-
 app/test/test_fib6.c                          |   4 +-
 app/test/test_fib6_perf.c                     |   2 +-
 app/test/test_fib_perf.c                      |   2 +-
 app/test/test_func_reentrancy.c               |   2 +-
 app/test/test_hash.c                          |   2 +-
 app/test/test_hash_functions.c                |   2 +-
 app/test/test_hash_multiwriter.c              |   2 +-
 app/test/test_hash_perf.c                     |   2 +-
 app/test/test_hash_readwrite.c                |   4 +-
 app/test/test_hash_readwrite_lf_perf.c        |   2 +-
 app/test/test_interrupts.c                    |   2 +-
 app/test/test_ipfrag.c                        |   2 +-
 app/test/test_ipsec.c                         |   2 +-
 app/test/test_ipsec_perf.c                    |   2 +-
 app/test/test_kvargs.c                        |   2 +-
 app/test/test_lcores.c                        |   2 +-
 app/test/test_logs.c                          |   2 +-
 app/test/test_lpm.c                           |   2 +-
 app/test/test_lpm6.c                          |   2 +-
 app/test/test_lpm6_perf.c                     |   2 +-
 app/test/test_lpm_perf.c                      |   2 +-
 app/test/test_malloc.c                        |   2 +-
 app/test/test_malloc_perf.c                   |   2 +-
 app/test/test_mbuf.c                          |   2 +-
 app/test/test_mcslock.c                       |   2 +-
 app/test/test_member.c                        |   2 +-
 app/test/test_member_perf.c                   |   2 +-
 app/test/test_memcpy.c                        |   2 +-
 app/test/test_memcpy_perf.c                   |   2 +-
 app/test/test_memory.c                        |   2 +-
 app/test/test_mempool.c                       |   2 +-
 app/test/test_mempool_perf.c                  |   2 +-
 app/test/test_memzone.c                       |   2 +-
 app/test/test_meter.c                         |   2 +-
 app/test/test_mp_secondary.c                  |   2 +-
 app/test/test_per_lcore.c                     |   2 +-
 app/test/test_pflock.c                        |   2 +-
 app/test/test_pie.c                           |   6 +-
 app/test/test_pmd_perf.c                      |   2 +-
 app/test/test_power.c                         |   2 +-
 app/test/test_power_cpufreq.c                 |   2 +-
 app/test/test_power_intel_uncore.c            |   2 +-
 app/test/test_power_kvm_vm.c                  |   2 +-
 app/test/test_prefetch.c                      |   2 +-
 app/test/test_rand_perf.c                     |   2 +-
 app/test/test_rcu_qsbr.c                      |   2 +-
 app/test/test_rcu_qsbr_perf.c                 |   2 +-
 app/test/test_reassembly_perf.c               |   2 +-
 app/test/test_reciprocal_division.c           |   2 +-
 app/test/test_reciprocal_division_perf.c      |   2 +-
 app/test/test_red.c                           |   4 +-
 app/test/test_reorder.c                       |   2 +-
 app/test/test_rib.c                           |   4 +-
 app/test/test_rib6.c                          |   4 +-
 app/test/test_ring.c                          |   2 +-
 app/test/test_ring_perf.c                     |   2 +-
 app/test/test_rwlock.c                        |   8 +-
 app/test/test_sched.c                         |   2 +-
 app/test/test_security.c                      |   2 +-
 app/test/test_seqlock.c                       |   2 +-
 app/test/test_service_cores.c                 |   4 +-
 app/test/test_spinlock.c                      |   2 +-
 app/test/test_stack.c                         |   4 +-
 app/test/test_stack_perf.c                    |   4 +-
 app/test/test_string_fns.c                    |   2 +-
 app/test/test_tailq.c                         |   2 +-
 app/test/test_telemetry_data.c                |  14 +-
 app/test/test_thash.c                         |   2 +-
 app/test/test_thash_perf.c                    |   2 +-
 app/test/test_threads.c                       |   2 +-
 app/test/test_ticketlock.c                    |   2 +-
 app/test/test_timer.c                         |   2 +-
 app/test/test_timer_perf.c                    |   2 +-
 app/test/test_timer_racecond.c                |   2 +-
 app/test/test_trace.c                         |   2 +-
 app/test/test_trace_perf.c                    |   2 +-
 app/test/test_version.c                       |   2 +-
 buildtools/get-test-suites.py                 |  33 +
 .../has-hugepages.py                          |   0
 buildtools/meson.build                        |   2 +
 examples/l3fwd/l3fwd_em.c                     |   2 +
 examples/l3fwd/l3fwd_em_hlm.h                 |   2 +
 examples/l3fwd/l3fwd_event.c                  |   2 +
 examples/l3fwd/l3fwd_event.h                  |   7 +-
 examples/l3fwd/l3fwd_event_generic.c          |   2 +
 examples/l3fwd/l3fwd_event_internal_port.c    |   2 +
 examples/l3fwd/l3fwd_fib.c                    |   2 +
 examples/l3fwd/l3fwd_lpm.c                    |   2 +
 examples/l3fwd/main.c                         |  65 +-
 examples/l3fwd/meson.build                    |   5 +-
 lib/meson.build                               |  15 +
 125 files changed, 614 insertions(+), 764 deletions(-)
 create mode 100644 app/test/suites/meson.build
 create mode 100644 buildtools/get-test-suites.py
 rename app/test/has_hugepage.py => buildtools/has-hugepages.py (100%)

--
2.39.2
  
Morten Brørup Aug. 14, 2023, 6:33 p.m. UTC | #8
> From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> Sent: Monday, 14 August 2023 20.21
> 
> This patchset contains changes to DPDK to make the build more
> configurable
> overall. The changes can be grouped into two areas:
> 
> * Firstly, there are changes to make the build of the unit tests more
>   flexible and maintainable. These 5 patches switch the unit tests from
>   having separate hard-coded lists of files and tests, with lots of
>   conditional logic to add/remove items from the list, to instead being
>   a single list of files and dependencies per-file. The actual lists of
>   test-suites are built up dynamically from the list of files whose
>   dependencies are met and therefore will be part of the build.
>   This rework enables...
> * The second set of patches which expands the list of libraries which
>   can be disabled at build-time, while still giving a successful build
>   of DPDK. Overall, after this set is applied, the list of optional
>   libraries in DPDK is approx doubled in size. [15 additions giving
>   31 optional libs]
> 
> NOTES:
> * as stated in the RFC, the test binary moves in the build as a result
>   of this set - from app/test/dpdk-test to app/dpdk-test.
> * running the suites of tests no longer works after patch 4 until patch
>   5 is applied. If this is an issue, the two patches can be merged on
>   apply. However, the individual tests are still runnable through the
>   test binary - it's only through "meson test" that there are issues, so
>   I'm keeping the patches separate since each is relatively complex in
> its
>   own right.
> * A number of files in the test directory were not being built, and seem
>   to have never been built with meson. This requires separate work,
> outside
>   the scope of the patchset to fix.
> * Similarly, some unit tests were never added to test suites. These can
>   now be found by using grep to find the old REGISTER_TEST_COMMAND
> macro.
>   Again, adding orphan tests to suites is outside the scope of this set.
> 
> V3:
> - Create symlink to old path to test binary, to ensure all automated CI,
>   and any other use of the test binary still works.
> 
> V2:
> - Changes since RFC:
>    -  merged two previous sets - reworking test build, and disabling
>       libs - into one, since they depend on each other
>    -  Reworked the list of dependencies for each file in the tests,
>       so that files that depend on other files have those deps called
>       out.
>    -  Added list of external dependencies to the test builds
>    -  For disabling libs, merged patches disabling individual libs
>       together into one patch, since all unit test build changes were
>       unnecessary. This made each patch a single-line addition to
>       the optional list in lib/meson.build.

Series-acked-by: Morten Brørup <mb@smartsharesystems.com>
  
Bruce Richardson Aug. 15, 2023, 1:13 p.m. UTC | #9
This patchset contains changes to DPDK to make the build more configurable
overall. The changes can be grouped into two areas:

* Firstly, there are changes to make the build of the unit tests more
  flexible and maintainable. These 5 patches switch the unit tests from
  having separate hard-coded lists of files and tests, with lots of
  conditional logic to add/remove items from the list, to instead being
  a single list of files and dependencies per-file. The actual lists of
  test-suites are built up dynamically from the list of files whose
  dependencies are met and therefore will be part of the build.
  This rework enables...
* The second set of patches which expands the list of libraries which
  can be disabled at build-time, while still giving a successful build
  of DPDK. Overall, after this set is applied, the list of optional
  libraries in DPDK is approx doubled in size. [15 additions giving
  31 optional libs]

NOTES:
* as stated in the RFC, the test binary moves in the build as a result
  of this set - from app/test/dpdk-test to app/dpdk-test.
* running the suites of tests no longer works after patch 4 until patch
  5 is applied. If this is an issue, the two patches can be merged on
  apply. However, the individual tests are still runnable through the
  test binary - it's only through "meson test" that there are issues, so
  I'm keeping the patches separate since each is relatively complex in its
  own right.
* A number of files in the test directory were not being built, and seem
  to have never been built with meson. This requires separate work, outside
  the scope of the patchset to fix.
* Similarly, some unit tests were never added to test suites. These can
  now be found by using grep to find the old REGISTER_TEST_COMMAND macro.
  Again, adding orphan tests to suites is outside the scope of this set.

V4:
- improve test suite definition, hopefully improving test pass rate:
  - drop unnecessary file-prefix for fast tests, since tests are not parallel
  - always pass driver path flag in "meson test" for shared builds.

V3:
- Create symlink to old path to test binary, to ensure all automated CI,
  and any other use of the test binary still works.

V2:
- Changes since RFC:
   -  merged two previous sets - reworking test build, and disabling
      libs - into one, since they depend on each other
   -  Reworked the list of dependencies for each file in the tests,
      so that files that depend on other files have those deps called
      out.
   -  Added list of external dependencies to the test builds
   -  For disabling libs, merged patches disabling individual libs
      together into one patch, since all unit test build changes were
      unnecessary. This made each patch a single-line addition to
      the optional list in lib/meson.build.

Bruce Richardson (8):
  app/test: add new macros for various test types
  app/test: tag tests with the test type
  app/test: make telemetry data test buildable on windows
  app/test: build using per-file dependency matrix
  app/test: define unit tests suites based on test macros
  examples/l3fwd: make eventdev an optional dependency
  build: make most device classes optional
  build: expand list of optional libraries

 app/meson.build                               |  15 +-
 app/test/meson.build                          | 823 +++++-------------
 app/test/suites/meson.build                   |  72 ++
 app/test/test.h                               |   9 +-
 app/test/test_acl.c                           |   2 +-
 app/test/test_atomic.c                        |   2 +-
 app/test/test_barrier.c                       |   2 +-
 app/test/test_bitmap.c                        |   2 +-
 app/test/test_bitops.c                        |   2 +-
 app/test/test_bpf.c                           |   4 +-
 app/test/test_byteorder.c                     |   2 +-
 app/test/test_cksum.c                         |   2 +-
 app/test/test_cmdline.c                       |   2 +-
 app/test/test_common.c                        |   2 +-
 app/test/test_cpuflags.c                      |   2 +-
 app/test/test_crc.c                           |   2 +-
 app/test/test_cryptodev.c                     |  38 +-
 app/test/test_cryptodev_asym.c                |   2 +-
 app/test/test_cycles.c                        |   2 +-
 app/test/test_debug.c                         |   2 +-
 app/test/test_devargs.c                       |   2 +-
 app/test/test_distributor.c                   |   2 +-
 app/test/test_distributor_perf.c              |   2 +-
 app/test/test_dmadev.c                        |   2 +-
 app/test/test_eal_flags.c                     |  24 +-
 app/test/test_eal_fs.c                        |   2 +-
 app/test/test_efd.c                           |   2 +-
 app/test/test_efd_perf.c                      |   2 +-
 app/test/test_errno.c                         |   2 +-
 app/test/test_ethdev_link.c                   |   2 +-
 app/test/test_event_ring.c                    |   2 +-
 app/test/test_eventdev.c                      |   2 +-
 app/test/test_fbarray.c                       |   2 +-
 app/test/test_fib.c                           |   4 +-
 app/test/test_fib6.c                          |   4 +-
 app/test/test_fib6_perf.c                     |   2 +-
 app/test/test_fib_perf.c                      |   2 +-
 app/test/test_func_reentrancy.c               |   2 +-
 app/test/test_hash.c                          |   2 +-
 app/test/test_hash_functions.c                |   2 +-
 app/test/test_hash_multiwriter.c              |   2 +-
 app/test/test_hash_perf.c                     |   2 +-
 app/test/test_hash_readwrite.c                |   4 +-
 app/test/test_hash_readwrite_lf_perf.c        |   2 +-
 app/test/test_interrupts.c                    |   2 +-
 app/test/test_ipfrag.c                        |   2 +-
 app/test/test_ipsec.c                         |   2 +-
 app/test/test_ipsec_perf.c                    |   2 +-
 app/test/test_kvargs.c                        |   2 +-
 app/test/test_lcores.c                        |   2 +-
 app/test/test_logs.c                          |   2 +-
 app/test/test_lpm.c                           |   2 +-
 app/test/test_lpm6.c                          |   2 +-
 app/test/test_lpm6_perf.c                     |   2 +-
 app/test/test_lpm_perf.c                      |   2 +-
 app/test/test_malloc.c                        |   2 +-
 app/test/test_malloc_perf.c                   |   2 +-
 app/test/test_mbuf.c                          |   2 +-
 app/test/test_mcslock.c                       |   2 +-
 app/test/test_member.c                        |   2 +-
 app/test/test_member_perf.c                   |   2 +-
 app/test/test_memcpy.c                        |   2 +-
 app/test/test_memcpy_perf.c                   |   2 +-
 app/test/test_memory.c                        |   2 +-
 app/test/test_mempool.c                       |   2 +-
 app/test/test_mempool_perf.c                  |   2 +-
 app/test/test_memzone.c                       |   2 +-
 app/test/test_meter.c                         |   2 +-
 app/test/test_mp_secondary.c                  |   2 +-
 app/test/test_per_lcore.c                     |   2 +-
 app/test/test_pflock.c                        |   2 +-
 app/test/test_pie.c                           |   6 +-
 app/test/test_pmd_perf.c                      |   2 +-
 app/test/test_power.c                         |   2 +-
 app/test/test_power_cpufreq.c                 |   2 +-
 app/test/test_power_intel_uncore.c            |   2 +-
 app/test/test_power_kvm_vm.c                  |   2 +-
 app/test/test_prefetch.c                      |   2 +-
 app/test/test_rand_perf.c                     |   2 +-
 app/test/test_rcu_qsbr.c                      |   2 +-
 app/test/test_rcu_qsbr_perf.c                 |   2 +-
 app/test/test_reassembly_perf.c               |   2 +-
 app/test/test_reciprocal_division.c           |   2 +-
 app/test/test_reciprocal_division_perf.c      |   2 +-
 app/test/test_red.c                           |   4 +-
 app/test/test_reorder.c                       |   2 +-
 app/test/test_rib.c                           |   4 +-
 app/test/test_rib6.c                          |   4 +-
 app/test/test_ring.c                          |   2 +-
 app/test/test_ring_perf.c                     |   2 +-
 app/test/test_rwlock.c                        |   8 +-
 app/test/test_sched.c                         |   2 +-
 app/test/test_security.c                      |   2 +-
 app/test/test_seqlock.c                       |   2 +-
 app/test/test_service_cores.c                 |   4 +-
 app/test/test_spinlock.c                      |   2 +-
 app/test/test_stack.c                         |   4 +-
 app/test/test_stack_perf.c                    |   4 +-
 app/test/test_string_fns.c                    |   2 +-
 app/test/test_tailq.c                         |   2 +-
 app/test/test_telemetry_data.c                |  14 +-
 app/test/test_thash.c                         |   2 +-
 app/test/test_thash_perf.c                    |   2 +-
 app/test/test_threads.c                       |   2 +-
 app/test/test_ticketlock.c                    |   2 +-
 app/test/test_timer.c                         |   2 +-
 app/test/test_timer_perf.c                    |   2 +-
 app/test/test_timer_racecond.c                |   2 +-
 app/test/test_trace.c                         |   2 +-
 app/test/test_trace_perf.c                    |   2 +-
 app/test/test_version.c                       |   2 +-
 buildtools/get-test-suites.py                 |  33 +
 .../has-hugepages.py                          |   0
 buildtools/meson.build                        |   2 +
 examples/l3fwd/l3fwd_em.c                     |   2 +
 examples/l3fwd/l3fwd_em_hlm.h                 |   2 +
 examples/l3fwd/l3fwd_event.c                  |   2 +
 examples/l3fwd/l3fwd_event.h                  |   7 +-
 examples/l3fwd/l3fwd_event_generic.c          |   2 +
 examples/l3fwd/l3fwd_event_internal_port.c    |   2 +
 examples/l3fwd/l3fwd_fib.c                    |   2 +
 examples/l3fwd/l3fwd_lpm.c                    |   2 +
 examples/l3fwd/main.c                         |  65 +-
 examples/l3fwd/meson.build                    |   5 +-
 lib/meson.build                               |  15 +
 125 files changed, 610 insertions(+), 764 deletions(-)
 create mode 100644 app/test/suites/meson.build
 create mode 100644 buildtools/get-test-suites.py
 rename app/test/has_hugepage.py => buildtools/has-hugepages.py (100%)

--
2.39.2
  
Bruce Richardson Aug. 15, 2023, 1:15 p.m. UTC | #10
On Tue, Aug 15, 2023 at 02:13:12PM +0100, Bruce Richardson wrote:
> This patchset contains changes to DPDK to make the build more configurable
> overall. The changes can be grouped into two areas:
> 
> * Firstly, there are changes to make the build of the unit tests more
>   flexible and maintainable. These 5 patches switch the unit tests from
>   having separate hard-coded lists of files and tests, with lots of
>   conditional logic to add/remove items from the list, to instead being
>   a single list of files and dependencies per-file. The actual lists of
>   test-suites are built up dynamically from the list of files whose
>   dependencies are met and therefore will be part of the build.
>   This rework enables...
> * The second set of patches which expands the list of libraries which
>   can be disabled at build-time, while still giving a successful build
>   of DPDK. Overall, after this set is applied, the list of optional
>   libraries in DPDK is approx doubled in size. [15 additions giving
>   31 optional libs]
> 
> NOTES:
> * as stated in the RFC, the test binary moves in the build as a result
>   of this set - from app/test/dpdk-test to app/dpdk-test.
> * running the suites of tests no longer works after patch 4 until patch
>   5 is applied. If this is an issue, the two patches can be merged on
>   apply. However, the individual tests are still runnable through the
>   test binary - it's only through "meson test" that there are issues, so
>   I'm keeping the patches separate since each is relatively complex in its
>   own right.
> * A number of files in the test directory were not being built, and seem
>   to have never been built with meson. This requires separate work, outside
>   the scope of the patchset to fix.
> * Similarly, some unit tests were never added to test suites. These can
>   now be found by using grep to find the old REGISTER_TEST_COMMAND macro.
>   Again, adding orphan tests to suites is outside the scope of this set.
> 
> V4:
> - improve test suite definition, hopefully improving test pass rate:
>   - drop unnecessary file-prefix for fast tests, since tests are not parallel
>   - always pass driver path flag in "meson test" for shared builds.
> 
Missed applying Morten's ack to the series in V4. Adding it here.

Series-acked-by: Morten Brørup <mb@smartsharesystems.com>
  
Bruce Richardson Aug. 15, 2023, 3:10 p.m. UTC | #11
This patchset contains changes to DPDK to make the build more configurable
overall. The changes can be grouped into two areas:

* Firstly, there are changes to make the build of the unit tests more
  flexible and maintainable. These 7 patches switch the unit tests from
  having separate hard-coded lists of files and tests, with lots of
  conditional logic to add/remove items from the list, to instead being
  a single list of files and dependencies per-file. The actual lists of
  test-suites are built up dynamically from the list of files whose
  dependencies are met and therefore will be part of the build.
  This rework enables...
* The second set of patches which expands the list of libraries which
  can be disabled at build-time, while still giving a successful build
  of DPDK. Overall, after this set is applied, the list of optional
  libraries in DPDK is approx doubled in size. [15 additions giving
  31 optional libs]

NOTES:
* as stated in the RFC, the test binary moves in the build as a result
  of this set - from app/test/dpdk-test to app/dpdk-test.
* running the suites of tests no longer works after patch 4 until patch
  5-7 is applied. If this is an issue, the patches can be merged on
  apply. However, the individual tests are still runnable through the
  test binary - it's only through "meson test" that there are issues, so
  I'm keeping the patches separate since each is relatively complex in its
  own right.
* A number of files in the test directory were not being built, and seem
  to have never been built with meson. This requires separate work, outside
  the scope of the patchset to fix.
* Similarly, some unit tests were never added to test suites. These can
  now be found by using grep to find the old REGISTER_TEST_COMMAND macro.
  Again, adding orphan tests to suites is outside the scope of this set.

V5:
- revert back to using the environment to pass the test names rather than
  the commandline. This allows use of "--test-args" with meson test to
  pass additional EAL parameters, such as coremasks, to the test run.
- add back in support for the script for checking telemetry commands
- add support for the dump-* tests in the "debug-tests" suite. Sadly,
  even though these are hardcoded in commands.c, they aren't easily
  discoverable at build-time, so we have to use a hard-coded list.

V4:
- improve test suite definition, hopefully improving test pass rate:
  - drop unnecessary file-prefix for fast tests, since tests are not parallel
  - always pass driver path flag in "meson test" for shared builds.

V3:
- Create symlink to old path to test binary, to ensure all automated CI,
  and any other use of the test binary still works.

V2:
- Changes since RFC:
   -  merged two previous sets - reworking test build, and disabling
      libs - into one, since they depend on each other
   -  Reworked the list of dependencies for each file in the tests,
      so that files that depend on other files have those deps called
      out.
   -  Added list of external dependencies to the test builds
   -  For disabling libs, merged patches disabling individual libs
      together into one patch, since all unit test build changes were
      unnecessary. This made each patch a single-line addition to
      the optional list in lib/meson.build.

Bruce Richardson (10):
  app/test: add new macros for various test types
  app/test: tag tests with the test type
  app/test: make telemetry data test buildable on windows
  app/test: build using per-file dependency matrix
  app/test: define unit tests suites based on test macros
  app/test: add test case for scripted telemetry commands
  app/test: add debug test suite
  examples/l3fwd: make eventdev an optional dependency
  build: make most device classes optional
  build: expand list of optional libraries

 app/meson.build                               |  15 +-
 app/test/meson.build                          | 823 +++++-------------
 app/test/suites/meson.build                   | 124 +++
 app/test/{ => suites}/test_telemetry.sh       |   0
 app/test/test.h                               |   9 +-
 app/test/test_acl.c                           |   2 +-
 app/test/test_atomic.c                        |   2 +-
 app/test/test_barrier.c                       |   2 +-
 app/test/test_bitmap.c                        |   2 +-
 app/test/test_bitops.c                        |   2 +-
 app/test/test_bpf.c                           |   4 +-
 app/test/test_byteorder.c                     |   2 +-
 app/test/test_cksum.c                         |   2 +-
 app/test/test_cmdline.c                       |   2 +-
 app/test/test_common.c                        |   2 +-
 app/test/test_cpuflags.c                      |   2 +-
 app/test/test_crc.c                           |   2 +-
 app/test/test_cryptodev.c                     |  38 +-
 app/test/test_cryptodev_asym.c                |   2 +-
 app/test/test_cycles.c                        |   2 +-
 app/test/test_debug.c                         |   2 +-
 app/test/test_devargs.c                       |   2 +-
 app/test/test_distributor.c                   |   2 +-
 app/test/test_distributor_perf.c              |   2 +-
 app/test/test_dmadev.c                        |   2 +-
 app/test/test_eal_flags.c                     |  24 +-
 app/test/test_eal_fs.c                        |   2 +-
 app/test/test_efd.c                           |   2 +-
 app/test/test_efd_perf.c                      |   2 +-
 app/test/test_errno.c                         |   2 +-
 app/test/test_ethdev_link.c                   |   2 +-
 app/test/test_event_ring.c                    |   2 +-
 app/test/test_eventdev.c                      |   2 +-
 app/test/test_fbarray.c                       |   2 +-
 app/test/test_fib.c                           |   4 +-
 app/test/test_fib6.c                          |   4 +-
 app/test/test_fib6_perf.c                     |   2 +-
 app/test/test_fib_perf.c                      |   2 +-
 app/test/test_func_reentrancy.c               |   2 +-
 app/test/test_hash.c                          |   2 +-
 app/test/test_hash_functions.c                |   2 +-
 app/test/test_hash_multiwriter.c              |   2 +-
 app/test/test_hash_perf.c                     |   2 +-
 app/test/test_hash_readwrite.c                |   4 +-
 app/test/test_hash_readwrite_lf_perf.c        |   2 +-
 app/test/test_interrupts.c                    |   2 +-
 app/test/test_ipfrag.c                        |   2 +-
 app/test/test_ipsec.c                         |   2 +-
 app/test/test_ipsec_perf.c                    |   2 +-
 app/test/test_kvargs.c                        |   2 +-
 app/test/test_lcores.c                        |   2 +-
 app/test/test_logs.c                          |   2 +-
 app/test/test_lpm.c                           |   2 +-
 app/test/test_lpm6.c                          |   2 +-
 app/test/test_lpm6_perf.c                     |   2 +-
 app/test/test_lpm_perf.c                      |   2 +-
 app/test/test_malloc.c                        |   2 +-
 app/test/test_malloc_perf.c                   |   2 +-
 app/test/test_mbuf.c                          |   2 +-
 app/test/test_mcslock.c                       |   2 +-
 app/test/test_member.c                        |   2 +-
 app/test/test_member_perf.c                   |   2 +-
 app/test/test_memcpy.c                        |   2 +-
 app/test/test_memcpy_perf.c                   |   2 +-
 app/test/test_memory.c                        |   2 +-
 app/test/test_mempool.c                       |   2 +-
 app/test/test_mempool_perf.c                  |   2 +-
 app/test/test_memzone.c                       |   2 +-
 app/test/test_meter.c                         |   2 +-
 app/test/test_mp_secondary.c                  |   2 +-
 app/test/test_per_lcore.c                     |   2 +-
 app/test/test_pflock.c                        |   2 +-
 app/test/test_pie.c                           |   6 +-
 app/test/test_pmd_perf.c                      |   2 +-
 app/test/test_power.c                         |   2 +-
 app/test/test_power_cpufreq.c                 |   2 +-
 app/test/test_power_intel_uncore.c            |   2 +-
 app/test/test_power_kvm_vm.c                  |   2 +-
 app/test/test_prefetch.c                      |   2 +-
 app/test/test_rand_perf.c                     |   2 +-
 app/test/test_rcu_qsbr.c                      |   2 +-
 app/test/test_rcu_qsbr_perf.c                 |   2 +-
 app/test/test_reassembly_perf.c               |   2 +-
 app/test/test_reciprocal_division.c           |   2 +-
 app/test/test_reciprocal_division_perf.c      |   2 +-
 app/test/test_red.c                           |   4 +-
 app/test/test_reorder.c                       |   2 +-
 app/test/test_rib.c                           |   4 +-
 app/test/test_rib6.c                          |   4 +-
 app/test/test_ring.c                          |   2 +-
 app/test/test_ring_perf.c                     |   2 +-
 app/test/test_rwlock.c                        |   8 +-
 app/test/test_sched.c                         |   2 +-
 app/test/test_security.c                      |   2 +-
 app/test/test_seqlock.c                       |   2 +-
 app/test/test_service_cores.c                 |   4 +-
 app/test/test_spinlock.c                      |   2 +-
 app/test/test_stack.c                         |   4 +-
 app/test/test_stack_perf.c                    |   4 +-
 app/test/test_string_fns.c                    |   2 +-
 app/test/test_tailq.c                         |   2 +-
 app/test/test_telemetry_data.c                |  14 +-
 app/test/test_thash.c                         |   2 +-
 app/test/test_thash_perf.c                    |   2 +-
 app/test/test_threads.c                       |   2 +-
 app/test/test_ticketlock.c                    |   2 +-
 app/test/test_timer.c                         |   2 +-
 app/test/test_timer_perf.c                    |   2 +-
 app/test/test_timer_racecond.c                |   2 +-
 app/test/test_trace.c                         |   2 +-
 app/test/test_trace_perf.c                    |   2 +-
 app/test/test_version.c                       |   2 +-
 buildtools/get-test-suites.py                 |  33 +
 .../has-hugepages.py                          |   0
 buildtools/meson.build                        |   2 +
 examples/l3fwd/l3fwd_em.c                     |   2 +
 examples/l3fwd/l3fwd_em_hlm.h                 |   2 +
 examples/l3fwd/l3fwd_event.c                  |   2 +
 examples/l3fwd/l3fwd_event.h                  |   7 +-
 examples/l3fwd/l3fwd_event_generic.c          |   2 +
 examples/l3fwd/l3fwd_event_internal_port.c    |   2 +
 examples/l3fwd/l3fwd_fib.c                    |   2 +
 examples/l3fwd/l3fwd_lpm.c                    |   2 +
 examples/l3fwd/main.c                         |  65 +-
 examples/l3fwd/meson.build                    |   5 +-
 lib/meson.build                               |  15 +
 126 files changed, 662 insertions(+), 764 deletions(-)
 create mode 100644 app/test/suites/meson.build
 rename app/test/{ => suites}/test_telemetry.sh (100%)
 create mode 100644 buildtools/get-test-suites.py
 rename app/test/has_hugepage.py => buildtools/has-hugepages.py (100%)

--
2.39.2
  
David Marchand Aug. 23, 2023, 7:33 a.m. UTC | #12
Hello Bruce,

On Wed, Aug 16, 2023 at 5:35 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> This patchset contains changes to DPDK to make the build more configurable
> overall. The changes can be grouped into two areas:
>
> * Firstly, there are changes to make the build of the unit tests more
>   flexible and maintainable. These 7 patches switch the unit tests from
>   having separate hard-coded lists of files and tests, with lots of
>   conditional logic to add/remove items from the list, to instead being
>   a single list of files and dependencies per-file. The actual lists of
>   test-suites are built up dynamically from the list of files whose
>   dependencies are met and therefore will be part of the build.
>   This rework enables...
> * The second set of patches which expands the list of libraries which
>   can be disabled at build-time, while still giving a successful build
>   of DPDK. Overall, after this set is applied, the list of optional
>   libraries in DPDK is approx doubled in size. [15 additions giving
>   31 optional libs]
>
> NOTES:
> * as stated in the RFC, the test binary moves in the build as a result
>   of this set - from app/test/dpdk-test to app/dpdk-test.
> * running the suites of tests no longer works after patch 4 until patch
>   5-7 is applied. If this is an issue, the patches can be merged on
>   apply. However, the individual tests are still runnable through the
>   test binary - it's only through "meson test" that there are issues, so
>   I'm keeping the patches separate since each is relatively complex in its
>   own right.

Compilation is fine between those patches (which is the minimum).
Seeing the size of the changes, I agree it is more readable to keep
them separate.
And I think we can live with unit tests being "broken" (well, absent)
between those patches.


> * A number of files in the test directory were not being built, and seem
>   to have never been built with meson. This requires separate work, outside
>   the scope of the patchset to fix.
> * Similarly, some unit tests were never added to test suites. These can
>   now be found by using grep to find the old REGISTER_TEST_COMMAND macro.
>   Again, adding orphan tests to suites is outside the scope of this set.

As discussed in the thread for patch 5
(https://inbox.dpdk.org/dev/CAJvnSUBcsA3=9CZvnU+g5CJ261X=tJMivcvygO-D=jcu+akEGg@mail.gmail.com/),
merging this series renders ARM container unit tests unavailable at
UNH.
This is not perfect, but I prefer we make progress on the build
framework changes the sooner possible.

This is a temporary state until either the possibility to skip test is
added (and UNH makes use of it instead of patching
app/test/meson.build) or the fixes I proposed for ethdev cleanup are
merged (and UNH removes the patching of meson).
Hopefully, we will solve this remaining issue in the next weeks.


Series applied, thanks for this nice cleanup and enhancement Bruce.

As a followup on the optional libraries topic, next, I will merge the
enable_libs option:
https://patchwork.dpdk.org/project/dpdk/list/?series=29044