DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/4] Test examples compilation externally
@ 2023-06-13  8:17 David Marchand
  2023-06-13  8:17 ` [PATCH 1/4] examples/fips_validation: fix external build David Marchand
                   ` (6 more replies)
  0 siblings, 7 replies; 30+ messages in thread
From: David Marchand @ 2023-06-13  8:17 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

As DPDK provides examples compiled with makefiles, we need some tests in
the CI. So far, a few maintainers have been testing them but a simple
issue has been missed for some time and there was no way to try to build
all examples that were built with meson.

Additionnally, this series can help in identify issues in public headers
that the current headers check can not catch as it relies on the meson
framework for finding headers include path (which points at sources).


-- 
David Marchand

David Marchand (4):
  examples/fips_validation: fix external build
  examples/server_node_efd: simplify build configuration
  devtools: build all examples externally
  ci: build examples externally

 .ci/linux-build.sh                            | 25 ++++++++++++++++++-
 .github/workflows/build.yml                   |  6 ++---
 devtools/test-meson-builds.sh                 | 14 +++++++++++
 doc/guides/sample_app_ug/server_node_efd.rst  | 14 +++++------
 examples/fips_validation/Makefile             |  2 ++
 examples/meson.build                          |  4 +--
 examples/server_node_efd/Makefile             |  2 +-
 .../{node => efd_node}/Makefile               |  0
 .../{node => efd_node}/meson.build            |  2 --
 .../server_node_efd/{node => efd_node}/node.c |  0
 .../{server => efd_server}/Makefile           |  0
 .../{server => efd_server}/args.c             |  0
 .../{server => efd_server}/args.h             |  0
 .../{server => efd_server}/init.c             |  0
 .../{server => efd_server}/init.h             |  0
 .../{server => efd_server}/main.c             |  0
 .../{server => efd_server}/meson.build        |  2 --
 17 files changed, 53 insertions(+), 18 deletions(-)
 rename examples/server_node_efd/{node => efd_node}/Makefile (100%)
 rename examples/server_node_efd/{node => efd_node}/meson.build (95%)
 rename examples/server_node_efd/{node => efd_node}/node.c (100%)
 rename examples/server_node_efd/{server => efd_server}/Makefile (100%)
 rename examples/server_node_efd/{server => efd_server}/args.c (100%)
 rename examples/server_node_efd/{server => efd_server}/args.h (100%)
 rename examples/server_node_efd/{server => efd_server}/init.c (100%)
 rename examples/server_node_efd/{server => efd_server}/init.h (100%)
 rename examples/server_node_efd/{server => efd_server}/main.c (100%)
 rename examples/server_node_efd/{server => efd_server}/meson.build (94%)

-- 
2.40.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 1/4] examples/fips_validation: fix external build
  2023-06-13  8:17 [PATCH 0/4] Test examples compilation externally David Marchand
@ 2023-06-13  8:17 ` David Marchand
  2023-06-13 15:05   ` [EXT] " Gowrishankar Muthukrishnan
  2023-06-13  8:17 ` [PATCH 2/4] examples/server_node_efd: simplify build configuration David Marchand
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 30+ messages in thread
From: David Marchand @ 2023-06-13  8:17 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, stable, Brian Dooley,
	Gowrishankar Muthukrishnan

Added sources were not referenced in the makefile used when compiling
this example externally.

Fixes: 36128a67c27e ("examples/fips_validation: add asymmetric validation")
Fixes: b455d261eb89 ("examples/fips_validation: validate ECDSA")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 examples/fips_validation/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/examples/fips_validation/Makefile b/examples/fips_validation/Makefile
index bca6647f55..fbb778d57a 100644
--- a/examples/fips_validation/Makefile
+++ b/examples/fips_validation/Makefile
@@ -15,6 +15,8 @@ SRCS-y += fips_validation_ccm.c
 SRCS-y += fips_validation_sha.c
 SRCS-y += fips_dev_self_test.c
 SRCS-y += fips_validation_xts.c
+SRCS-y += fips_validation_rsa.c
+SRCS-y += fips_validation_ecdsa.c
 SRCS-y += main.c
 
 PKGCONF ?= pkg-config
-- 
2.40.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 2/4] examples/server_node_efd: simplify build configuration
  2023-06-13  8:17 [PATCH 0/4] Test examples compilation externally David Marchand
  2023-06-13  8:17 ` [PATCH 1/4] examples/fips_validation: fix external build David Marchand
@ 2023-06-13  8:17 ` David Marchand
  2023-06-13 11:05   ` David Marchand
  2023-06-13  8:17 ` [PATCH 3/4] devtools: build all examples externally David Marchand
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 30+ messages in thread
From: David Marchand @ 2023-06-13  8:17 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Byron Marohn, Yipeng Wang

Rename sub directories in this example.
This removes the only special case in examples and will ease a next
change.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 doc/guides/sample_app_ug/server_node_efd.rst       | 14 +++++++-------
 examples/meson.build                               |  4 ++--
 examples/server_node_efd/Makefile                  |  2 +-
 .../server_node_efd/{node => efd_node}/Makefile    |  0
 .../server_node_efd/{node => efd_node}/meson.build |  2 --
 examples/server_node_efd/{node => efd_node}/node.c |  0
 .../{server => efd_server}/Makefile                |  0
 .../server_node_efd/{server => efd_server}/args.c  |  0
 .../server_node_efd/{server => efd_server}/args.h  |  0
 .../server_node_efd/{server => efd_server}/init.c  |  0
 .../server_node_efd/{server => efd_server}/init.h  |  0
 .../server_node_efd/{server => efd_server}/main.c  |  0
 .../{server => efd_server}/meson.build             |  2 --
 13 files changed, 10 insertions(+), 14 deletions(-)
 rename examples/server_node_efd/{node => efd_node}/Makefile (100%)
 rename examples/server_node_efd/{node => efd_node}/meson.build (95%)
 rename examples/server_node_efd/{node => efd_node}/node.c (100%)
 rename examples/server_node_efd/{server => efd_server}/Makefile (100%)
 rename examples/server_node_efd/{server => efd_server}/args.c (100%)
 rename examples/server_node_efd/{server => efd_server}/args.h (100%)
 rename examples/server_node_efd/{server => efd_server}/init.c (100%)
 rename examples/server_node_efd/{server => efd_server}/init.h (100%)
 rename examples/server_node_efd/{server => efd_server}/main.c (100%)
 rename examples/server_node_efd/{server => efd_server}/meson.build (94%)

diff --git a/doc/guides/sample_app_ug/server_node_efd.rst b/doc/guides/sample_app_ug/server_node_efd.rst
index c6cbc3def6..7253b38da7 100644
--- a/doc/guides/sample_app_ug/server_node_efd.rst
+++ b/doc/guides/sample_app_ug/server_node_efd.rst
@@ -137,7 +137,7 @@ which is used to distribute packets to nodes, which the number of flows
 specified in the command line (1 million, by default).
 
 
-.. literalinclude:: ../../../examples/server_node_efd/server/init.c
+.. literalinclude:: ../../../examples/server_node_efd/efd_server/init.c
     :language: c
     :start-after: Create EFD table. 8<
     :end-before: >8 End of creation EFD table.
@@ -146,7 +146,7 @@ After initialization, packets are received from the enabled ports, and the IPv4
 address from the packets is used as a key to look up in the EFD table,
 which tells the node where the packet has to be distributed.
 
-.. literalinclude:: ../../../examples/server_node_efd/server/main.c
+.. literalinclude:: ../../../examples/server_node_efd/efd_server/main.c
     :language: c
     :start-after: Processing packets. 8<
     :end-before: >8 End of process_packets.
@@ -156,7 +156,7 @@ and enqueued in the shared ring between the server and the node.
 After this, a new burst of packets is received and this process is
 repeated infinitely.
 
-.. literalinclude:: ../../../examples/server_node_efd/server/main.c
+.. literalinclude:: ../../../examples/server_node_efd/efd_server/main.c
     :language: c
     :start-after: Flush rx queue. 8<
     :end-before: >8 End of sending a burst of traffic to a node.
@@ -167,7 +167,7 @@ ring with the server and send them out, if they belong to the node.
 At initialization, it attaches to the server process memory, to have
 access to the shared ring, parameters and statistics.
 
-.. literalinclude:: ../../../examples/server_node_efd/node/node.c
+.. literalinclude:: ../../../examples/server_node_efd/efd_node/node.c
     :language: c
     :start-after: Attaching to the server process memory. 8<
     :end-before: >8 End of attaching to the server process memory.
@@ -176,7 +176,7 @@ access to the shared ring, parameters and statistics.
 Then, the hash table that contains the flows that will be handled
 by the node is created and populated.
 
-.. literalinclude:: ../../../examples/server_node_efd/node/node.c
+.. literalinclude:: ../../../examples/server_node_efd/efd_node/node.c
     :language: c
     :start-after: Creation of hash table. 8<
     :end-before: >8 End of creation of hash table.
@@ -188,7 +188,7 @@ If there is a hit, packet is stored in a buffer, to be eventually transmitted
 in one of the enabled ports. If key is not there, packet is dropped, since the
 flow is not handled by the node.
 
-.. literalinclude:: ../../../examples/server_node_efd/node/node.c
+.. literalinclude:: ../../../examples/server_node_efd/efd_node/node.c
     :language: c
     :start-after: Packets dequeued from the shared ring. 8<
     :end-before: >8 End of packets dequeuing.
@@ -196,7 +196,7 @@ flow is not handled by the node.
 Finally, note that both processes updates statistics, such as transmitted, received
 and dropped packets, which are shown and refreshed by the server app.
 
-.. literalinclude:: ../../../examples/server_node_efd/server/main.c
+.. literalinclude:: ../../../examples/server_node_efd/efd_server/main.c
     :language: c
     :start-after: Display recorded statistics. 8<
     :end-before: >8 End of displaying the recorded statistics.
diff --git a/examples/meson.build b/examples/meson.build
index 6968c09252..55ba8847a0 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -46,8 +46,8 @@ all_examples = [
         'qos_meter',
         'qos_sched',
         'rxtx_callbacks',
-        'server_node_efd/node',
-        'server_node_efd/server',
+        'server_node_efd/efd_node',
+        'server_node_efd/efd_server',
         'service_cores',
         'skeleton',
         'timer',
diff --git a/examples/server_node_efd/Makefile b/examples/server_node_efd/Makefile
index e4a4a94a79..6d61c93dac 100644
--- a/examples/server_node_efd/Makefile
+++ b/examples/server_node_efd/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2016-2020 Intel Corporation
 
-subdirs := node server
+subdirs := efd_node efd_server
 
 .PHONY: all static shared clean $(subdirs)
 all static shared clean: $(subdirs)
diff --git a/examples/server_node_efd/node/Makefile b/examples/server_node_efd/efd_node/Makefile
similarity index 100%
rename from examples/server_node_efd/node/Makefile
rename to examples/server_node_efd/efd_node/Makefile
diff --git a/examples/server_node_efd/node/meson.build b/examples/server_node_efd/efd_node/meson.build
similarity index 95%
rename from examples/server_node_efd/node/meson.build
rename to examples/server_node_efd/efd_node/meson.build
index 1c720968af..b03e65f266 100644
--- a/examples/server_node_efd/node/meson.build
+++ b/examples/server_node_efd/efd_node/meson.build
@@ -6,8 +6,6 @@
 # To build this example as a standalone application with an already-installed
 # DPDK instance, use 'make'
 
-name = 'efd_node'
-
 allow_experimental_apis = true
 deps += ['hash']
 sources += files('node.c')
diff --git a/examples/server_node_efd/node/node.c b/examples/server_node_efd/efd_node/node.c
similarity index 100%
rename from examples/server_node_efd/node/node.c
rename to examples/server_node_efd/efd_node/node.c
diff --git a/examples/server_node_efd/server/Makefile b/examples/server_node_efd/efd_server/Makefile
similarity index 100%
rename from examples/server_node_efd/server/Makefile
rename to examples/server_node_efd/efd_server/Makefile
diff --git a/examples/server_node_efd/server/args.c b/examples/server_node_efd/efd_server/args.c
similarity index 100%
rename from examples/server_node_efd/server/args.c
rename to examples/server_node_efd/efd_server/args.c
diff --git a/examples/server_node_efd/server/args.h b/examples/server_node_efd/efd_server/args.h
similarity index 100%
rename from examples/server_node_efd/server/args.h
rename to examples/server_node_efd/efd_server/args.h
diff --git a/examples/server_node_efd/server/init.c b/examples/server_node_efd/efd_server/init.c
similarity index 100%
rename from examples/server_node_efd/server/init.c
rename to examples/server_node_efd/efd_server/init.c
diff --git a/examples/server_node_efd/server/init.h b/examples/server_node_efd/efd_server/init.h
similarity index 100%
rename from examples/server_node_efd/server/init.h
rename to examples/server_node_efd/efd_server/init.h
diff --git a/examples/server_node_efd/server/main.c b/examples/server_node_efd/efd_server/main.c
similarity index 100%
rename from examples/server_node_efd/server/main.c
rename to examples/server_node_efd/efd_server/main.c
diff --git a/examples/server_node_efd/server/meson.build b/examples/server_node_efd/efd_server/meson.build
similarity index 94%
rename from examples/server_node_efd/server/meson.build
rename to examples/server_node_efd/efd_server/meson.build
index 7abc333e1d..f1a6616738 100644
--- a/examples/server_node_efd/server/meson.build
+++ b/examples/server_node_efd/efd_server/meson.build
@@ -6,8 +6,6 @@
 # To build this example as a standalone application with an already-installed
 # DPDK instance, use 'make'
 
-name = 'efd_server'
-
 allow_experimental_apis = true
 deps += 'efd'
 sources += files('args.c', 'init.c', 'main.c')
-- 
2.40.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 3/4] devtools: build all examples externally
  2023-06-13  8:17 [PATCH 0/4] Test examples compilation externally David Marchand
  2023-06-13  8:17 ` [PATCH 1/4] examples/fips_validation: fix external build David Marchand
  2023-06-13  8:17 ` [PATCH 2/4] examples/server_node_efd: simplify build configuration David Marchand
@ 2023-06-13  8:17 ` David Marchand
  2023-06-13  9:20   ` Bruce Richardson
  2023-06-13  9:23   ` Bruce Richardson
  2023-06-13  8:17 ` [PATCH 4/4] ci: build " David Marchand
                   ` (3 subsequent siblings)
  6 siblings, 2 replies; 30+ messages in thread
From: David Marchand @ 2023-06-13  8:17 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

So far, users of test-meson-builds.sh had to define their own set of
examples to build externally. This is not that great because users need
to maintain this list when examples are removed/added.

Rework the script so that the 'all' value triggers an automatic
discovery based on what was configured/compiled with meson/ninja.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 devtools/test-meson-builds.sh | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index 9131088c9d..cab3373544 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -299,6 +299,20 @@ export PKG_CONFIG_PATH=$(dirname $pc_file):$PKG_CONFIG_PATH
 libdir=$(dirname $(find $DESTDIR -name librte_eal.so))
 export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH
 examples=${DPDK_BUILD_TEST_EXAMPLES:-"cmdline helloworld l2fwd l3fwd skeleton timer"}
+if [ "$examples" = 'all' ]; then
+	examples=$(ninja -C $build_path -t targets all | grep 'examples/.*:.*c_LINKER' |
+	while read target; do
+		target=${target%%:*}
+		target=${target#examples/dpdk-}
+		if [ -e $srcdir/examples/$target/Makefile ]; then
+			echo $target
+			continue
+		fi
+		find $srcdir/examples -name Makefile |
+		sed -ne "s,$srcdir/examples/\([^/]*\)\(/.*\|\)/$target/Makefile,\1,p"
+	done | sort -u |
+	tr '\n' ' ')
+fi
 # if pkg-config defines the necessary flags, test building some examples
 if pkg-config --define-prefix libdpdk >/dev/null 2>&1; then
 	export PKGCONF="pkg-config --define-prefix"
-- 
2.40.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 4/4] ci: build examples externally
  2023-06-13  8:17 [PATCH 0/4] Test examples compilation externally David Marchand
                   ` (2 preceding siblings ...)
  2023-06-13  8:17 ` [PATCH 3/4] devtools: build all examples externally David Marchand
@ 2023-06-13  8:17 ` David Marchand
  2023-06-13  9:21 ` [PATCH 0/4] Test examples compilation externally Bruce Richardson
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 30+ messages in thread
From: David Marchand @ 2023-06-13  8:17 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Aaron Conole, Michael Santana

Enhance our CI coverage by building examples against an installed DPDK.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 .ci/linux-build.sh          | 25 ++++++++++++++++++++++++-
 .github/workflows/build.yml |  6 +++---
 2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index 9631e342b5..1b1f9d07f3 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -1,7 +1,7 @@
 #!/bin/sh -xe
 
 if [ -z "${DEF_LIB:-}" ]; then
-    DEF_LIB=static ABI_CHECKS= BUILD_DOCS= RUN_TESTS= $0
+    DEF_LIB=static ABI_CHECKS= BUILD_DOCS= BUILD_EXAMPLES= RUN_TESTS= $0
     DEF_LIB=shared $0
     exit
 fi
@@ -99,6 +99,7 @@ if [ "$MINI" = "true" ]; then
 else
     OPTS="$OPTS -Ddisable_libs="
 fi
+OPTS="$OPTS -Dlibdir=lib"
 
 if [ "$ASAN" = "true" ]; then
     OPTS="$OPTS -Db_sanitize=address"
@@ -168,3 +169,25 @@ if [ "$RUN_TESTS" = "true" ]; then
     catch_coredump
     [ "$failed" != "true" ]
 fi
+
+# Test examples compilation with an installed dpdk
+if [ "$BUILD_EXAMPLES" = "true" ]; then
+    [ -d install ] || DESTDIR=$(pwd)/install ninja -C build install
+    export LD_LIBRARY_PATH=$(dirname $(find $(pwd)/install -name librte_eal.so)):$LD_LIBRARY_PATH
+    export PKG_CONFIG_PATH=$(dirname $(find $(pwd)/install -name libdpdk.pc)):$PKG_CONFIG_PATH
+    export PKGCONF="pkg-config --define-prefix"
+    ninja -C build -t targets all | grep 'examples/.*:.*c_LINKER' |
+    while read target; do
+        target=${target%%:*}
+        target=${target#examples/dpdk-}
+        if [ -e examples/$target/Makefile ]; then
+            echo $target
+            continue
+        fi
+        find examples -name Makefile |
+        sed -ne "s,examples/\([^/]*\)\(/.*\|\)/$target/Makefile,\1,p"
+    done | sort -u |
+    while read example; do
+        make -C install/usr/local/share/dpdk/examples/$example clean shared
+    done
+fi
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 3b629fcdbd..414dd089e0 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -20,6 +20,7 @@ jobs:
       BUILD_32BIT: ${{ matrix.config.cross == 'i386' }}
       BUILD_DEBUG: ${{ contains(matrix.config.checks, 'debug') }}
       BUILD_DOCS: ${{ contains(matrix.config.checks, 'doc') }}
+      BUILD_EXAMPLES: ${{ contains(matrix.config.checks, 'examples') }}
       CC: ccache ${{ matrix.config.compiler }}
       DEF_LIB: ${{ matrix.config.library }}
       LIBABIGAIL_VERSION: libabigail-2.1
@@ -39,7 +40,7 @@ jobs:
             mini: mini
           - os: ubuntu-20.04
             compiler: gcc
-            checks: abi+debug+doc+tests
+            checks: abi+debug+doc+examples+tests
           - os: ubuntu-20.04
             compiler: clang
             checks: asan+doc+tests
@@ -96,12 +97,11 @@ jobs:
     - name: Install packages
       run: sudo apt install -y ccache libarchive-dev libbsd-dev libfdt-dev
         libibverbs-dev libjansson-dev libnuma-dev libpcap-dev libssl-dev
-        ninja-build python3-pip python3-pyelftools python3-setuptools
+        ninja-build pkg-config python3-pip python3-pyelftools python3-setuptools
         python3-wheel zlib1g-dev
     - name: Install libabigail build dependencies if no cache is available
       if: env.ABI_CHECKS == 'true' && steps.libabigail-cache.outputs.cache-hit != 'true'
       run: sudo apt install -y autoconf automake libdw-dev libtool libxml2-dev
-        pkg-config
     - name: Install i386 cross compiling packages
       if: env.BUILD_32BIT == 'true'
       run: sudo apt install -y gcc-multilib g++-multilib
-- 
2.40.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 3/4] devtools: build all examples externally
  2023-06-13  8:17 ` [PATCH 3/4] devtools: build all examples externally David Marchand
@ 2023-06-13  9:20   ` Bruce Richardson
  2023-06-13  9:29     ` David Marchand
  2023-06-13  9:23   ` Bruce Richardson
  1 sibling, 1 reply; 30+ messages in thread
From: Bruce Richardson @ 2023-06-13  9:20 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, thomas

On Tue, Jun 13, 2023 at 10:17:40AM +0200, David Marchand wrote:
> So far, users of test-meson-builds.sh had to define their own set of
> examples to build externally. This is not that great because users need
> to maintain this list when examples are removed/added.
> 
> Rework the script so that the 'all' value triggers an automatic
> discovery based on what was configured/compiled with meson/ninja.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  devtools/test-meson-builds.sh | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
> index 9131088c9d..cab3373544 100755
> --- a/devtools/test-meson-builds.sh
> +++ b/devtools/test-meson-builds.sh
> @@ -299,6 +299,20 @@ export PKG_CONFIG_PATH=$(dirname $pc_file):$PKG_CONFIG_PATH
>  libdir=$(dirname $(find $DESTDIR -name librte_eal.so))
>  export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH
>  examples=${DPDK_BUILD_TEST_EXAMPLES:-"cmdline helloworld l2fwd l3fwd skeleton timer"}
> +if [ "$examples" = 'all' ]; then
> +	examples=$(ninja -C $build_path -t targets all | grep 'examples/.*:.*c_LINKER' |

Since the build has already been done in $build_path at this point, would
it be easier to get the list of examples from "ls $build_path/examples/dpdk-*"?

> +	while read target; do
> +		target=${target%%:*}
> +		target=${target#examples/dpdk-}
> +		if [ -e $srcdir/examples/$target/Makefile ]; then
> +			echo $target
> +			continue
> +		fi
> +		find $srcdir/examples -name Makefile |
> +		sed -ne "s,$srcdir/examples/\([^/]*\)\(/.*\|\)/$target/Makefile,\1,p"
> +	done | sort -u |
> +	tr '\n' ' ')
> +fi
>  # if pkg-config defines the necessary flags, test building some examples
>  if pkg-config --define-prefix libdpdk >/dev/null 2>&1; then
>  	export PKGCONF="pkg-config --define-prefix"
> -- 
> 2.40.1
> 

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 0/4] Test examples compilation externally
  2023-06-13  8:17 [PATCH 0/4] Test examples compilation externally David Marchand
                   ` (3 preceding siblings ...)
  2023-06-13  8:17 ` [PATCH 4/4] ci: build " David Marchand
@ 2023-06-13  9:21 ` Bruce Richardson
  2023-06-13 14:06 ` [PATCH v2 " David Marchand
  2023-06-20 14:07 ` [PATCH v3 0/4] Test examples compilation externally David Marchand
  6 siblings, 0 replies; 30+ messages in thread
From: Bruce Richardson @ 2023-06-13  9:21 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, thomas

On Tue, Jun 13, 2023 at 10:17:37AM +0200, David Marchand wrote:
> As DPDK provides examples compiled with makefiles, we need some tests in
> the CI. So far, a few maintainers have been testing them but a simple
> issue has been missed for some time and there was no way to try to build
> all examples that were built with meson.
> 
> Additionnally, this series can help in identify issues in public headers
> that the current headers check can not catch as it relies on the meson
> framework for finding headers include path (which points at sources).
> 
Good idea.

Series-acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 3/4] devtools: build all examples externally
  2023-06-13  8:17 ` [PATCH 3/4] devtools: build all examples externally David Marchand
  2023-06-13  9:20   ` Bruce Richardson
@ 2023-06-13  9:23   ` Bruce Richardson
  1 sibling, 0 replies; 30+ messages in thread
From: Bruce Richardson @ 2023-06-13  9:23 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, thomas

On Tue, Jun 13, 2023 at 10:17:40AM +0200, David Marchand wrote:
> So far, users of test-meson-builds.sh had to define their own set of
> examples to build externally. This is not that great because users need
> to maintain this list when examples are removed/added.
> 
> Rework the script so that the 'all' value triggers an automatic
> discovery based on what was configured/compiled with meson/ninja.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  devtools/test-meson-builds.sh | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
> index 9131088c9d..cab3373544 100755
> --- a/devtools/test-meson-builds.sh
> +++ b/devtools/test-meson-builds.sh
> @@ -299,6 +299,20 @@ export PKG_CONFIG_PATH=$(dirname $pc_file):$PKG_CONFIG_PATH
>  libdir=$(dirname $(find $DESTDIR -name librte_eal.so))
>  export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH
>  examples=${DPDK_BUILD_TEST_EXAMPLES:-"cmdline helloworld l2fwd l3fwd skeleton timer"}
> +if [ "$examples" = 'all' ]; then
> +	examples=$(ninja -C $build_path -t targets all | grep 'examples/.*:.*c_LINKER' |
> +	while read target; do
> +		target=${target%%:*}
> +		target=${target#examples/dpdk-}
> +		if [ -e $srcdir/examples/$target/Makefile ]; then
> +			echo $target
> +			continue
> +		fi
> +		find $srcdir/examples -name Makefile |
> +		sed -ne "s,$srcdir/examples/\([^/]*\)\(/.*\|\)/$target/Makefile,\1,p"

Scripts can be rather cryptic at times. I assume this sed statement is for
handling examples which have subdirectories/are in subdirs. A comment
explaining this logic would be good.

> +	done | sort -u |
> +	tr '\n' ' ')
> +fi
>  # if pkg-config defines the necessary flags, test building some examples
>  if pkg-config --define-prefix libdpdk >/dev/null 2>&1; then
>  	export PKGCONF="pkg-config --define-prefix"
> -- 
> 2.40.1
> 

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 3/4] devtools: build all examples externally
  2023-06-13  9:20   ` Bruce Richardson
@ 2023-06-13  9:29     ` David Marchand
  0 siblings, 0 replies; 30+ messages in thread
From: David Marchand @ 2023-06-13  9:29 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, thomas

On Tue, Jun 13, 2023 at 11:21 AM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> On Tue, Jun 13, 2023 at 10:17:40AM +0200, David Marchand wrote:
> > So far, users of test-meson-builds.sh had to define their own set of
> > examples to build externally. This is not that great because users need
> > to maintain this list when examples are removed/added.
> >
> > Rework the script so that the 'all' value triggers an automatic
> > discovery based on what was configured/compiled with meson/ninja.
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
> >  devtools/test-meson-builds.sh | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> >
> > diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
> > index 9131088c9d..cab3373544 100755
> > --- a/devtools/test-meson-builds.sh
> > +++ b/devtools/test-meson-builds.sh
> > @@ -299,6 +299,20 @@ export PKG_CONFIG_PATH=$(dirname $pc_file):$PKG_CONFIG_PATH
> >  libdir=$(dirname $(find $DESTDIR -name librte_eal.so))
> >  export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH
> >  examples=${DPDK_BUILD_TEST_EXAMPLES:-"cmdline helloworld l2fwd l3fwd skeleton timer"}
> > +if [ "$examples" = 'all' ]; then
> > +     examples=$(ninja -C $build_path -t targets all | grep 'examples/.*:.*c_LINKER' |
>
> Since the build has already been done in $build_path at this point, would
> it be easier to get the list of examples from "ls $build_path/examples/dpdk-*"?

Oh yes, it is more robust than parsing ninja targets.
I'll look into it.


> > +             find $srcdir/examples -name Makefile |
> > +             sed -ne "s,$srcdir/examples/\([^/]*\)\ (/.*\|\)/$target/Makefile,\1,p"
> Scripts can be rather cryptic at times. I assume this sed statement is for
> handling examples which have subdirectories/are in subdirs. A comment
> explaining this logic would be good.

Indeed, I'll add a comment.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/4] examples/server_node_efd: simplify build configuration
  2023-06-13  8:17 ` [PATCH 2/4] examples/server_node_efd: simplify build configuration David Marchand
@ 2023-06-13 11:05   ` David Marchand
  0 siblings, 0 replies; 30+ messages in thread
From: David Marchand @ 2023-06-13 11:05 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Byron Marohn, Yipeng Wang, Aaron Conole, ci

On Tue, Jun 13, 2023 at 10:18 AM David Marchand
<david.marchand@redhat.com> wrote:
> diff --git a/doc/guides/sample_app_ug/server_node_efd.rst b/doc/guides/sample_app_ug/server_node_efd.rst
> index c6cbc3def6..7253b38da7 100644
> --- a/doc/guides/sample_app_ug/server_node_efd.rst
> +++ b/doc/guides/sample_app_ug/server_node_efd.rst
> @@ -137,7 +137,7 @@ which is used to distribute packets to nodes, which the number of flows
>  specified in the command line (1 million, by default).
>
>
> -.. literalinclude:: ../../../examples/server_node_efd/server/init.c
> +.. literalinclude:: ../../../examples/server_node_efd/efd_server/init.c
>      :language: c
>      :start-after: Create EFD table. 8<
>      :end-before: >8 End of creation EFD table.

For the record.. it seems Intel CI is doing some funny thing.
I noticed before, so it may still be filtering out changes on the
documentation when applying patches...

So I'll simply ignore this report:
http://mails.dpdk.org/archives/test-report/2023-June/410185.html

*Build Failed #1:
OS: UB2204-64
Target: x86_64-native-linuxapp-doc
FAILED: doc/guides/html
/usr/bin/python3 ../buildtools/call-sphinx-build.py
/usr/bin/sphinx-build 23.07.0-rc1
/root/UB2204-64_K5.15.0_GCC11.3.0/x86_64-native-linuxapp-doc/28476/dpdk/doc/guides
/root/UB2204-64_K5.15.0_GCC11.3.0/x86_64-native-linuxapp-doc/28476/dpdk/x86_64-native-linuxapp-doc/doc/guides
-a -W

Warning, treated as error:
/root/UB2204-64_K5.15.0_GCC11.3.0/x86_64-native-linuxapp-doc/28476/dpdk/doc/guides/sample_app_ug/server_node_efd.rst:140:Include
file '/root/UB2204-64_K5.15.0_GCC11.3.0/x86_64-native-linuxapp-doc/28476/dpdk/examples/server_node_efd/server/init.c'
not found or reading it failed
[3128/3128] Linking target app/test/dpdk-test
ninja: build stopped


-- 
David Marchand


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH v2 0/4] Test examples compilation externally
  2023-06-13  8:17 [PATCH 0/4] Test examples compilation externally David Marchand
                   ` (4 preceding siblings ...)
  2023-06-13  9:21 ` [PATCH 0/4] Test examples compilation externally Bruce Richardson
@ 2023-06-13 14:06 ` David Marchand
  2023-06-13 14:06   ` [PATCH v2 1/4] examples/fips_validation: fix external build David Marchand
                     ` (3 more replies)
  2023-06-20 14:07 ` [PATCH v3 0/4] Test examples compilation externally David Marchand
  6 siblings, 4 replies; 30+ messages in thread
From: David Marchand @ 2023-06-13 14:06 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

As DPDK provides examples compiled with makefiles, we need some tests in
the CI. So far, a few maintainers have been testing them but a simple
issue has been missed for some time and there was no way to try to build
all examples that were built with meson.

Additionnally, this series can help in identify issues in public headers
that the current headers check can not catch as it relies on the meson
framework for finding headers include path (which points at sources).


Changes since v1:
- reworked built examples discovery,

-- 
David Marchand

David Marchand (4):
  examples/fips_validation: fix external build
  examples/server_node_efd: simplify build configuration
  devtools: build all examples externally
  ci: build examples externally

 .ci/linux-build.sh                            | 27 ++++++++++++++++++-
 .github/workflows/build.yml                   |  6 ++---
 devtools/test-meson-builds.sh                 | 16 +++++++++++
 doc/guides/sample_app_ug/server_node_efd.rst  | 14 +++++-----
 examples/fips_validation/Makefile             |  2 ++
 examples/meson.build                          |  4 +--
 examples/server_node_efd/Makefile             |  2 +-
 .../{node => efd_node}/Makefile               |  0
 .../{node => efd_node}/meson.build            |  2 --
 .../server_node_efd/{node => efd_node}/node.c |  0
 .../{server => efd_server}/Makefile           |  0
 .../{server => efd_server}/args.c             |  0
 .../{server => efd_server}/args.h             |  0
 .../{server => efd_server}/init.c             |  0
 .../{server => efd_server}/init.h             |  0
 .../{server => efd_server}/main.c             |  0
 .../{server => efd_server}/meson.build        |  2 --
 17 files changed, 57 insertions(+), 18 deletions(-)
 rename examples/server_node_efd/{node => efd_node}/Makefile (100%)
 rename examples/server_node_efd/{node => efd_node}/meson.build (95%)
 rename examples/server_node_efd/{node => efd_node}/node.c (100%)
 rename examples/server_node_efd/{server => efd_server}/Makefile (100%)
 rename examples/server_node_efd/{server => efd_server}/args.c (100%)
 rename examples/server_node_efd/{server => efd_server}/args.h (100%)
 rename examples/server_node_efd/{server => efd_server}/init.c (100%)
 rename examples/server_node_efd/{server => efd_server}/init.h (100%)
 rename examples/server_node_efd/{server => efd_server}/main.c (100%)
 rename examples/server_node_efd/{server => efd_server}/meson.build (94%)

-- 
2.40.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH v2 1/4] examples/fips_validation: fix external build
  2023-06-13 14:06 ` [PATCH v2 " David Marchand
@ 2023-06-13 14:06   ` David Marchand
  2023-06-13 14:06   ` [PATCH v2 2/4] examples/server_node_efd: simplify build configuration David Marchand
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 30+ messages in thread
From: David Marchand @ 2023-06-13 14:06 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, stable, Brian Dooley,
	Gowrishankar Muthukrishnan

Added sources were not referenced in the makefile used when compiling
this example externally.

Fixes: 36128a67c27e ("examples/fips_validation: add asymmetric validation")
Fixes: b455d261eb89 ("examples/fips_validation: validate ECDSA")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 examples/fips_validation/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/examples/fips_validation/Makefile b/examples/fips_validation/Makefile
index bca6647f55..fbb778d57a 100644
--- a/examples/fips_validation/Makefile
+++ b/examples/fips_validation/Makefile
@@ -15,6 +15,8 @@ SRCS-y += fips_validation_ccm.c
 SRCS-y += fips_validation_sha.c
 SRCS-y += fips_dev_self_test.c
 SRCS-y += fips_validation_xts.c
+SRCS-y += fips_validation_rsa.c
+SRCS-y += fips_validation_ecdsa.c
 SRCS-y += main.c
 
 PKGCONF ?= pkg-config
-- 
2.40.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH v2 2/4] examples/server_node_efd: simplify build configuration
  2023-06-13 14:06 ` [PATCH v2 " David Marchand
  2023-06-13 14:06   ` [PATCH v2 1/4] examples/fips_validation: fix external build David Marchand
@ 2023-06-13 14:06   ` David Marchand
  2023-06-20  9:42     ` Thomas Monjalon
  2023-06-13 14:06   ` [PATCH v2 3/4] devtools: build all examples externally David Marchand
  2023-06-13 14:06   ` [PATCH v2 4/4] ci: build " David Marchand
  3 siblings, 1 reply; 30+ messages in thread
From: David Marchand @ 2023-06-13 14:06 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Byron Marohn, Yipeng Wang

Rename sub directories in this example.
This removes the only special case in examples and will ease a next
change.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 doc/guides/sample_app_ug/server_node_efd.rst       | 14 +++++++-------
 examples/meson.build                               |  4 ++--
 examples/server_node_efd/Makefile                  |  2 +-
 .../server_node_efd/{node => efd_node}/Makefile    |  0
 .../server_node_efd/{node => efd_node}/meson.build |  2 --
 examples/server_node_efd/{node => efd_node}/node.c |  0
 .../{server => efd_server}/Makefile                |  0
 .../server_node_efd/{server => efd_server}/args.c  |  0
 .../server_node_efd/{server => efd_server}/args.h  |  0
 .../server_node_efd/{server => efd_server}/init.c  |  0
 .../server_node_efd/{server => efd_server}/init.h  |  0
 .../server_node_efd/{server => efd_server}/main.c  |  0
 .../{server => efd_server}/meson.build             |  2 --
 13 files changed, 10 insertions(+), 14 deletions(-)
 rename examples/server_node_efd/{node => efd_node}/Makefile (100%)
 rename examples/server_node_efd/{node => efd_node}/meson.build (95%)
 rename examples/server_node_efd/{node => efd_node}/node.c (100%)
 rename examples/server_node_efd/{server => efd_server}/Makefile (100%)
 rename examples/server_node_efd/{server => efd_server}/args.c (100%)
 rename examples/server_node_efd/{server => efd_server}/args.h (100%)
 rename examples/server_node_efd/{server => efd_server}/init.c (100%)
 rename examples/server_node_efd/{server => efd_server}/init.h (100%)
 rename examples/server_node_efd/{server => efd_server}/main.c (100%)
 rename examples/server_node_efd/{server => efd_server}/meson.build (94%)

diff --git a/doc/guides/sample_app_ug/server_node_efd.rst b/doc/guides/sample_app_ug/server_node_efd.rst
index c6cbc3def6..7253b38da7 100644
--- a/doc/guides/sample_app_ug/server_node_efd.rst
+++ b/doc/guides/sample_app_ug/server_node_efd.rst
@@ -137,7 +137,7 @@ which is used to distribute packets to nodes, which the number of flows
 specified in the command line (1 million, by default).
 
 
-.. literalinclude:: ../../../examples/server_node_efd/server/init.c
+.. literalinclude:: ../../../examples/server_node_efd/efd_server/init.c
     :language: c
     :start-after: Create EFD table. 8<
     :end-before: >8 End of creation EFD table.
@@ -146,7 +146,7 @@ After initialization, packets are received from the enabled ports, and the IPv4
 address from the packets is used as a key to look up in the EFD table,
 which tells the node where the packet has to be distributed.
 
-.. literalinclude:: ../../../examples/server_node_efd/server/main.c
+.. literalinclude:: ../../../examples/server_node_efd/efd_server/main.c
     :language: c
     :start-after: Processing packets. 8<
     :end-before: >8 End of process_packets.
@@ -156,7 +156,7 @@ and enqueued in the shared ring between the server and the node.
 After this, a new burst of packets is received and this process is
 repeated infinitely.
 
-.. literalinclude:: ../../../examples/server_node_efd/server/main.c
+.. literalinclude:: ../../../examples/server_node_efd/efd_server/main.c
     :language: c
     :start-after: Flush rx queue. 8<
     :end-before: >8 End of sending a burst of traffic to a node.
@@ -167,7 +167,7 @@ ring with the server and send them out, if they belong to the node.
 At initialization, it attaches to the server process memory, to have
 access to the shared ring, parameters and statistics.
 
-.. literalinclude:: ../../../examples/server_node_efd/node/node.c
+.. literalinclude:: ../../../examples/server_node_efd/efd_node/node.c
     :language: c
     :start-after: Attaching to the server process memory. 8<
     :end-before: >8 End of attaching to the server process memory.
@@ -176,7 +176,7 @@ access to the shared ring, parameters and statistics.
 Then, the hash table that contains the flows that will be handled
 by the node is created and populated.
 
-.. literalinclude:: ../../../examples/server_node_efd/node/node.c
+.. literalinclude:: ../../../examples/server_node_efd/efd_node/node.c
     :language: c
     :start-after: Creation of hash table. 8<
     :end-before: >8 End of creation of hash table.
@@ -188,7 +188,7 @@ If there is a hit, packet is stored in a buffer, to be eventually transmitted
 in one of the enabled ports. If key is not there, packet is dropped, since the
 flow is not handled by the node.
 
-.. literalinclude:: ../../../examples/server_node_efd/node/node.c
+.. literalinclude:: ../../../examples/server_node_efd/efd_node/node.c
     :language: c
     :start-after: Packets dequeued from the shared ring. 8<
     :end-before: >8 End of packets dequeuing.
@@ -196,7 +196,7 @@ flow is not handled by the node.
 Finally, note that both processes updates statistics, such as transmitted, received
 and dropped packets, which are shown and refreshed by the server app.
 
-.. literalinclude:: ../../../examples/server_node_efd/server/main.c
+.. literalinclude:: ../../../examples/server_node_efd/efd_server/main.c
     :language: c
     :start-after: Display recorded statistics. 8<
     :end-before: >8 End of displaying the recorded statistics.
diff --git a/examples/meson.build b/examples/meson.build
index 6968c09252..55ba8847a0 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -46,8 +46,8 @@ all_examples = [
         'qos_meter',
         'qos_sched',
         'rxtx_callbacks',
-        'server_node_efd/node',
-        'server_node_efd/server',
+        'server_node_efd/efd_node',
+        'server_node_efd/efd_server',
         'service_cores',
         'skeleton',
         'timer',
diff --git a/examples/server_node_efd/Makefile b/examples/server_node_efd/Makefile
index e4a4a94a79..6d61c93dac 100644
--- a/examples/server_node_efd/Makefile
+++ b/examples/server_node_efd/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2016-2020 Intel Corporation
 
-subdirs := node server
+subdirs := efd_node efd_server
 
 .PHONY: all static shared clean $(subdirs)
 all static shared clean: $(subdirs)
diff --git a/examples/server_node_efd/node/Makefile b/examples/server_node_efd/efd_node/Makefile
similarity index 100%
rename from examples/server_node_efd/node/Makefile
rename to examples/server_node_efd/efd_node/Makefile
diff --git a/examples/server_node_efd/node/meson.build b/examples/server_node_efd/efd_node/meson.build
similarity index 95%
rename from examples/server_node_efd/node/meson.build
rename to examples/server_node_efd/efd_node/meson.build
index 1c720968af..b03e65f266 100644
--- a/examples/server_node_efd/node/meson.build
+++ b/examples/server_node_efd/efd_node/meson.build
@@ -6,8 +6,6 @@
 # To build this example as a standalone application with an already-installed
 # DPDK instance, use 'make'
 
-name = 'efd_node'
-
 allow_experimental_apis = true
 deps += ['hash']
 sources += files('node.c')
diff --git a/examples/server_node_efd/node/node.c b/examples/server_node_efd/efd_node/node.c
similarity index 100%
rename from examples/server_node_efd/node/node.c
rename to examples/server_node_efd/efd_node/node.c
diff --git a/examples/server_node_efd/server/Makefile b/examples/server_node_efd/efd_server/Makefile
similarity index 100%
rename from examples/server_node_efd/server/Makefile
rename to examples/server_node_efd/efd_server/Makefile
diff --git a/examples/server_node_efd/server/args.c b/examples/server_node_efd/efd_server/args.c
similarity index 100%
rename from examples/server_node_efd/server/args.c
rename to examples/server_node_efd/efd_server/args.c
diff --git a/examples/server_node_efd/server/args.h b/examples/server_node_efd/efd_server/args.h
similarity index 100%
rename from examples/server_node_efd/server/args.h
rename to examples/server_node_efd/efd_server/args.h
diff --git a/examples/server_node_efd/server/init.c b/examples/server_node_efd/efd_server/init.c
similarity index 100%
rename from examples/server_node_efd/server/init.c
rename to examples/server_node_efd/efd_server/init.c
diff --git a/examples/server_node_efd/server/init.h b/examples/server_node_efd/efd_server/init.h
similarity index 100%
rename from examples/server_node_efd/server/init.h
rename to examples/server_node_efd/efd_server/init.h
diff --git a/examples/server_node_efd/server/main.c b/examples/server_node_efd/efd_server/main.c
similarity index 100%
rename from examples/server_node_efd/server/main.c
rename to examples/server_node_efd/efd_server/main.c
diff --git a/examples/server_node_efd/server/meson.build b/examples/server_node_efd/efd_server/meson.build
similarity index 94%
rename from examples/server_node_efd/server/meson.build
rename to examples/server_node_efd/efd_server/meson.build
index 7abc333e1d..f1a6616738 100644
--- a/examples/server_node_efd/server/meson.build
+++ b/examples/server_node_efd/efd_server/meson.build
@@ -6,8 +6,6 @@
 # To build this example as a standalone application with an already-installed
 # DPDK instance, use 'make'
 
-name = 'efd_server'
-
 allow_experimental_apis = true
 deps += 'efd'
 sources += files('args.c', 'init.c', 'main.c')
-- 
2.40.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH v2 3/4] devtools: build all examples externally
  2023-06-13 14:06 ` [PATCH v2 " David Marchand
  2023-06-13 14:06   ` [PATCH v2 1/4] examples/fips_validation: fix external build David Marchand
  2023-06-13 14:06   ` [PATCH v2 2/4] examples/server_node_efd: simplify build configuration David Marchand
@ 2023-06-13 14:06   ` David Marchand
  2023-06-20  9:45     ` Thomas Monjalon
  2023-06-13 14:06   ` [PATCH v2 4/4] ci: build " David Marchand
  3 siblings, 1 reply; 30+ messages in thread
From: David Marchand @ 2023-06-13 14:06 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

So far, users of test-meson-builds.sh had to define their own set of
examples to build externally. This is not that great because users need
to maintain this list when examples are removed/added.

Rework the script so that the 'all' value triggers an automatic
discovery based on what was configured/compiled with meson/ninja.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since v1:
- reworked built examples discovery,
- added comment for people who are not sed fluent,

---
 devtools/test-meson-builds.sh | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index 9131088c9d..05bc15e280 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -299,6 +299,22 @@ export PKG_CONFIG_PATH=$(dirname $pc_file):$PKG_CONFIG_PATH
 libdir=$(dirname $(find $DESTDIR -name librte_eal.so))
 export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH
 examples=${DPDK_BUILD_TEST_EXAMPLES:-"cmdline helloworld l2fwd l3fwd skeleton timer"}
+if [ "$examples" = 'all' ]; then
+	examples=$(find $build_path/examples -maxdepth 1 -type f -name "dpdk-*" |
+	while read target; do
+		target=${target%%:*}
+		target=${target#$build_path/examples/dpdk-}
+		if [ -e $srcdir/examples/$target/Makefile ]; then
+			echo $target
+			continue
+		fi
+		# Some examples binaries are built from an example sub
+		# directory, discover the "top level" example name.
+		find $srcdir/examples -name Makefile |
+		sed -ne "s,$srcdir/examples/\([^/]*\)\(/.*\|\)/$target/Makefile,\1,p"
+	done | sort -u |
+	tr '\n' ' ')
+fi
 # if pkg-config defines the necessary flags, test building some examples
 if pkg-config --define-prefix libdpdk >/dev/null 2>&1; then
 	export PKGCONF="pkg-config --define-prefix"
-- 
2.40.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH v2 4/4] ci: build examples externally
  2023-06-13 14:06 ` [PATCH v2 " David Marchand
                     ` (2 preceding siblings ...)
  2023-06-13 14:06   ` [PATCH v2 3/4] devtools: build all examples externally David Marchand
@ 2023-06-13 14:06   ` David Marchand
  2023-06-16 13:14     ` Aaron Conole
  3 siblings, 1 reply; 30+ messages in thread
From: David Marchand @ 2023-06-13 14:06 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Aaron Conole, Michael Santana

Enhance our CI coverage by building examples against an installed DPDK.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since v1:
- reworked built examples discovery,
- added comment for people who are not sed fluent,

---
 .ci/linux-build.sh          | 27 ++++++++++++++++++++++++++-
 .github/workflows/build.yml |  6 +++---
 2 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index 9631e342b5..b8f80760c2 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -1,7 +1,7 @@
 #!/bin/sh -xe
 
 if [ -z "${DEF_LIB:-}" ]; then
-    DEF_LIB=static ABI_CHECKS= BUILD_DOCS= RUN_TESTS= $0
+    DEF_LIB=static ABI_CHECKS= BUILD_DOCS= BUILD_EXAMPLES= RUN_TESTS= $0
     DEF_LIB=shared $0
     exit
 fi
@@ -99,6 +99,7 @@ if [ "$MINI" = "true" ]; then
 else
     OPTS="$OPTS -Ddisable_libs="
 fi
+OPTS="$OPTS -Dlibdir=lib"
 
 if [ "$ASAN" = "true" ]; then
     OPTS="$OPTS -Db_sanitize=address"
@@ -168,3 +169,27 @@ if [ "$RUN_TESTS" = "true" ]; then
     catch_coredump
     [ "$failed" != "true" ]
 fi
+
+# Test examples compilation with an installed dpdk
+if [ "$BUILD_EXAMPLES" = "true" ]; then
+    [ -d install ] || DESTDIR=$(pwd)/install ninja -C build install
+    export LD_LIBRARY_PATH=$(dirname $(find $(pwd)/install -name librte_eal.so)):$LD_LIBRARY_PATH
+    export PKG_CONFIG_PATH=$(dirname $(find $(pwd)/install -name libdpdk.pc)):$PKG_CONFIG_PATH
+    export PKGCONF="pkg-config --define-prefix"
+    find build/examples -maxdepth 1 -type f -name "dpdk-*" |
+    while read target; do
+        target=${target%%:*}
+        target=${target#build/examples/dpdk-}
+        if [ -e examples/$target/Makefile ]; then
+            echo $target
+            continue
+        fi
+        # Some examples binaries are built from an example sub
+        # directory, discover the "top level" example name.
+        find examples -name Makefile |
+        sed -ne "s,examples/\([^/]*\)\(/.*\|\)/$target/Makefile,\1,p"
+    done | sort -u |
+    while read example; do
+        make -C install/usr/local/share/dpdk/examples/$example clean shared
+    done
+fi
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 3b629fcdbd..414dd089e0 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -20,6 +20,7 @@ jobs:
       BUILD_32BIT: ${{ matrix.config.cross == 'i386' }}
       BUILD_DEBUG: ${{ contains(matrix.config.checks, 'debug') }}
       BUILD_DOCS: ${{ contains(matrix.config.checks, 'doc') }}
+      BUILD_EXAMPLES: ${{ contains(matrix.config.checks, 'examples') }}
       CC: ccache ${{ matrix.config.compiler }}
       DEF_LIB: ${{ matrix.config.library }}
       LIBABIGAIL_VERSION: libabigail-2.1
@@ -39,7 +40,7 @@ jobs:
             mini: mini
           - os: ubuntu-20.04
             compiler: gcc
-            checks: abi+debug+doc+tests
+            checks: abi+debug+doc+examples+tests
           - os: ubuntu-20.04
             compiler: clang
             checks: asan+doc+tests
@@ -96,12 +97,11 @@ jobs:
     - name: Install packages
       run: sudo apt install -y ccache libarchive-dev libbsd-dev libfdt-dev
         libibverbs-dev libjansson-dev libnuma-dev libpcap-dev libssl-dev
-        ninja-build python3-pip python3-pyelftools python3-setuptools
+        ninja-build pkg-config python3-pip python3-pyelftools python3-setuptools
         python3-wheel zlib1g-dev
     - name: Install libabigail build dependencies if no cache is available
       if: env.ABI_CHECKS == 'true' && steps.libabigail-cache.outputs.cache-hit != 'true'
       run: sudo apt install -y autoconf automake libdw-dev libtool libxml2-dev
-        pkg-config
     - name: Install i386 cross compiling packages
       if: env.BUILD_32BIT == 'true'
       run: sudo apt install -y gcc-multilib g++-multilib
-- 
2.40.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [EXT] [PATCH 1/4] examples/fips_validation: fix external build
  2023-06-13  8:17 ` [PATCH 1/4] examples/fips_validation: fix external build David Marchand
@ 2023-06-13 15:05   ` Gowrishankar Muthukrishnan
  0 siblings, 0 replies; 30+ messages in thread
From: Gowrishankar Muthukrishnan @ 2023-06-13 15:05 UTC (permalink / raw)
  To: David Marchand, dev; +Cc: thomas, bruce.richardson, stable, Brian Dooley

Acked-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>

Thanks.

> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Tuesday, June 13, 2023 1:48 PM
> To: dev@dpdk.org
> Cc: thomas@monjalon.net; bruce.richardson@intel.com; stable@dpdk.org;
> Brian Dooley <brian.dooley@intel.com>; Gowrishankar Muthukrishnan
> <gmuthukrishn@marvell.com>
> Subject: [EXT] [PATCH 1/4] examples/fips_validation: fix external build
> 
> External Email
> 
> ----------------------------------------------------------------------
> Added sources were not referenced in the makefile used when compiling this
> example externally.
> 
> Fixes: 36128a67c27e ("examples/fips_validation: add asymmetric validation")
> Fixes: b455d261eb89 ("examples/fips_validation: validate ECDSA")
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  examples/fips_validation/Makefile | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/examples/fips_validation/Makefile
> b/examples/fips_validation/Makefile
> index bca6647f55..fbb778d57a 100644
> --- a/examples/fips_validation/Makefile
> +++ b/examples/fips_validation/Makefile
> @@ -15,6 +15,8 @@ SRCS-y += fips_validation_ccm.c  SRCS-y +=
> fips_validation_sha.c  SRCS-y += fips_dev_self_test.c  SRCS-y +=
> fips_validation_xts.c
> +SRCS-y += fips_validation_rsa.c
> +SRCS-y += fips_validation_ecdsa.c
>  SRCS-y += main.c
> 
>  PKGCONF ?= pkg-config
> --
> 2.40.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v2 4/4] ci: build examples externally
  2023-06-13 14:06   ` [PATCH v2 4/4] ci: build " David Marchand
@ 2023-06-16 13:14     ` Aaron Conole
  0 siblings, 0 replies; 30+ messages in thread
From: Aaron Conole @ 2023-06-16 13:14 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, thomas, bruce.richardson, Michael Santana

David Marchand <david.marchand@redhat.com> writes:

> Enhance our CI coverage by building examples against an installed DPDK.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> ---

Acked-by: Aaron Conole <aconole@redhat.com>


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v2 2/4] examples/server_node_efd: simplify build configuration
  2023-06-13 14:06   ` [PATCH v2 2/4] examples/server_node_efd: simplify build configuration David Marchand
@ 2023-06-20  9:42     ` Thomas Monjalon
  2023-06-20  9:58       ` David Marchand
  0 siblings, 1 reply; 30+ messages in thread
From: Thomas Monjalon @ 2023-06-20  9:42 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, bruce.richardson, Byron Marohn, Yipeng Wang

13/06/2023 16:06, David Marchand:
> Rename sub directories in this example.
> This removes the only special case in examples and will ease a next
> change.

For more clarity, it could be said what is a special case
(name of directory different of the generated binary).




^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v2 3/4] devtools: build all examples externally
  2023-06-13 14:06   ` [PATCH v2 3/4] devtools: build all examples externally David Marchand
@ 2023-06-20  9:45     ` Thomas Monjalon
  2023-06-20  9:52       ` David Marchand
  0 siblings, 1 reply; 30+ messages in thread
From: Thomas Monjalon @ 2023-06-20  9:45 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, bruce.richardson

13/06/2023 16:06, David Marchand:
> +		sed -ne "s,$srcdir/examples/\([^/]*\)\(/.*\|\)/$target/Makefile,\1,p"

I think -e is not needed.
If you use -r, you can avoid backslashing the parentheses.




^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v2 3/4] devtools: build all examples externally
  2023-06-20  9:45     ` Thomas Monjalon
@ 2023-06-20  9:52       ` David Marchand
  0 siblings, 0 replies; 30+ messages in thread
From: David Marchand @ 2023-06-20  9:52 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, bruce.richardson

On Tue, Jun 20, 2023 at 11:45 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 13/06/2023 16:06, David Marchand:
> > +             sed -ne "s,$srcdir/examples/\([^/]*\)\(/.*\|\)/$target/Makefile,\1,p"
>
> I think -e is not needed.

Indeed.

> If you use -r, you can avoid backslashing the parentheses.

-r is not a posix option.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v2 2/4] examples/server_node_efd: simplify build configuration
  2023-06-20  9:42     ` Thomas Monjalon
@ 2023-06-20  9:58       ` David Marchand
  0 siblings, 0 replies; 30+ messages in thread
From: David Marchand @ 2023-06-20  9:58 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, bruce.richardson, Byron Marohn, Yipeng Wang

On Tue, Jun 20, 2023 at 11:42 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 13/06/2023 16:06, David Marchand:
> > Rename sub directories in this example.
> > This removes the only special case in examples and will ease a next
> > change.
>
> For more clarity, it could be said what is a special case
> (name of directory different of the generated binary).

Yes, I'll rephrase.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH v3 0/4] Test examples compilation externally
  2023-06-13  8:17 [PATCH 0/4] Test examples compilation externally David Marchand
                   ` (5 preceding siblings ...)
  2023-06-13 14:06 ` [PATCH v2 " David Marchand
@ 2023-06-20 14:07 ` David Marchand
  2023-06-20 14:07   ` [PATCH v3 1/4] examples/fips_validation: fix external build David Marchand
                     ` (5 more replies)
  6 siblings, 6 replies; 30+ messages in thread
From: David Marchand @ 2023-06-20 14:07 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

As DPDK provides examples compiled with makefiles, we need some tests in
the CI. So far, a few maintainers have been testing them but a simple
issue has been missed for some time and there was no way to try to build
all examples that were built with meson.

Additionnally, this series can help in identify issues in public headers
that the current headers check can not catch as it relies on the meson
framework for finding headers include path (which points at sources).

Changes since v2:
- tweaked patch 2 commitlog,
- dropped -e sed option in patch 3/4,

Changes since v1:
- reworked built examples discovery,

-- 
David Marchand

David Marchand (4):
  examples/fips_validation: fix external build
  examples/server_node_efd: simplify build configuration
  devtools: build all examples externally
  ci: build examples externally

 .ci/linux-build.sh                            | 27 ++++++++++++++++++-
 .github/workflows/build.yml                   |  6 ++---
 devtools/test-meson-builds.sh                 | 16 +++++++++++
 doc/guides/sample_app_ug/server_node_efd.rst  | 14 +++++-----
 examples/fips_validation/Makefile             |  2 ++
 examples/meson.build                          |  4 +--
 examples/server_node_efd/Makefile             |  2 +-
 .../{node => efd_node}/Makefile               |  0
 .../{node => efd_node}/meson.build            |  2 --
 .../server_node_efd/{node => efd_node}/node.c |  0
 .../{server => efd_server}/Makefile           |  0
 .../{server => efd_server}/args.c             |  0
 .../{server => efd_server}/args.h             |  0
 .../{server => efd_server}/init.c             |  0
 .../{server => efd_server}/init.h             |  0
 .../{server => efd_server}/main.c             |  0
 .../{server => efd_server}/meson.build        |  2 --
 17 files changed, 57 insertions(+), 18 deletions(-)
 rename examples/server_node_efd/{node => efd_node}/Makefile (100%)
 rename examples/server_node_efd/{node => efd_node}/meson.build (95%)
 rename examples/server_node_efd/{node => efd_node}/node.c (100%)
 rename examples/server_node_efd/{server => efd_server}/Makefile (100%)
 rename examples/server_node_efd/{server => efd_server}/args.c (100%)
 rename examples/server_node_efd/{server => efd_server}/args.h (100%)
 rename examples/server_node_efd/{server => efd_server}/init.c (100%)
 rename examples/server_node_efd/{server => efd_server}/init.h (100%)
 rename examples/server_node_efd/{server => efd_server}/main.c (100%)
 rename examples/server_node_efd/{server => efd_server}/meson.build (94%)

-- 
2.40.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH v3 1/4] examples/fips_validation: fix external build
  2023-06-20 14:07 ` [PATCH v3 0/4] Test examples compilation externally David Marchand
@ 2023-06-20 14:07   ` David Marchand
  2023-06-21  6:23     ` David Marchand
  2023-06-20 14:07   ` [PATCH v3 2/4] examples/server_node_efd: simplify build configuration David Marchand
                     ` (4 subsequent siblings)
  5 siblings, 1 reply; 30+ messages in thread
From: David Marchand @ 2023-06-20 14:07 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, stable, Brian Dooley,
	Gowrishankar Muthukrishnan

Added sources were not referenced in the makefile used when compiling
this example externally.

Fixes: 36128a67c27e ("examples/fips_validation: add asymmetric validation")
Fixes: b455d261eb89 ("examples/fips_validation: validate ECDSA")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 examples/fips_validation/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/examples/fips_validation/Makefile b/examples/fips_validation/Makefile
index bca6647f55..fbb778d57a 100644
--- a/examples/fips_validation/Makefile
+++ b/examples/fips_validation/Makefile
@@ -15,6 +15,8 @@ SRCS-y += fips_validation_ccm.c
 SRCS-y += fips_validation_sha.c
 SRCS-y += fips_dev_self_test.c
 SRCS-y += fips_validation_xts.c
+SRCS-y += fips_validation_rsa.c
+SRCS-y += fips_validation_ecdsa.c
 SRCS-y += main.c
 
 PKGCONF ?= pkg-config
-- 
2.40.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH v3 2/4] examples/server_node_efd: simplify build configuration
  2023-06-20 14:07 ` [PATCH v3 0/4] Test examples compilation externally David Marchand
  2023-06-20 14:07   ` [PATCH v3 1/4] examples/fips_validation: fix external build David Marchand
@ 2023-06-20 14:07   ` David Marchand
  2023-06-20 14:07   ` [PATCH v3 3/4] devtools: build all examples externally David Marchand
                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 30+ messages in thread
From: David Marchand @ 2023-06-20 14:07 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Byron Marohn, Yipeng Wang

The server_node_efd example contains various binaries whose sources are
in sub directories that do not match their name.

Rename sub directories in this example and stop overriding the binaries
names in meson.build.
This makes a next change easier in the build scripts used by CI.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since v2:
- updated commitlog,

---
 doc/guides/sample_app_ug/server_node_efd.rst       | 14 +++++++-------
 examples/meson.build                               |  4 ++--
 examples/server_node_efd/Makefile                  |  2 +-
 .../server_node_efd/{node => efd_node}/Makefile    |  0
 .../server_node_efd/{node => efd_node}/meson.build |  2 --
 examples/server_node_efd/{node => efd_node}/node.c |  0
 .../{server => efd_server}/Makefile                |  0
 .../server_node_efd/{server => efd_server}/args.c  |  0
 .../server_node_efd/{server => efd_server}/args.h  |  0
 .../server_node_efd/{server => efd_server}/init.c  |  0
 .../server_node_efd/{server => efd_server}/init.h  |  0
 .../server_node_efd/{server => efd_server}/main.c  |  0
 .../{server => efd_server}/meson.build             |  2 --
 13 files changed, 10 insertions(+), 14 deletions(-)
 rename examples/server_node_efd/{node => efd_node}/Makefile (100%)
 rename examples/server_node_efd/{node => efd_node}/meson.build (95%)
 rename examples/server_node_efd/{node => efd_node}/node.c (100%)
 rename examples/server_node_efd/{server => efd_server}/Makefile (100%)
 rename examples/server_node_efd/{server => efd_server}/args.c (100%)
 rename examples/server_node_efd/{server => efd_server}/args.h (100%)
 rename examples/server_node_efd/{server => efd_server}/init.c (100%)
 rename examples/server_node_efd/{server => efd_server}/init.h (100%)
 rename examples/server_node_efd/{server => efd_server}/main.c (100%)
 rename examples/server_node_efd/{server => efd_server}/meson.build (94%)

diff --git a/doc/guides/sample_app_ug/server_node_efd.rst b/doc/guides/sample_app_ug/server_node_efd.rst
index c6cbc3def6..7253b38da7 100644
--- a/doc/guides/sample_app_ug/server_node_efd.rst
+++ b/doc/guides/sample_app_ug/server_node_efd.rst
@@ -137,7 +137,7 @@ which is used to distribute packets to nodes, which the number of flows
 specified in the command line (1 million, by default).
 
 
-.. literalinclude:: ../../../examples/server_node_efd/server/init.c
+.. literalinclude:: ../../../examples/server_node_efd/efd_server/init.c
     :language: c
     :start-after: Create EFD table. 8<
     :end-before: >8 End of creation EFD table.
@@ -146,7 +146,7 @@ After initialization, packets are received from the enabled ports, and the IPv4
 address from the packets is used as a key to look up in the EFD table,
 which tells the node where the packet has to be distributed.
 
-.. literalinclude:: ../../../examples/server_node_efd/server/main.c
+.. literalinclude:: ../../../examples/server_node_efd/efd_server/main.c
     :language: c
     :start-after: Processing packets. 8<
     :end-before: >8 End of process_packets.
@@ -156,7 +156,7 @@ and enqueued in the shared ring between the server and the node.
 After this, a new burst of packets is received and this process is
 repeated infinitely.
 
-.. literalinclude:: ../../../examples/server_node_efd/server/main.c
+.. literalinclude:: ../../../examples/server_node_efd/efd_server/main.c
     :language: c
     :start-after: Flush rx queue. 8<
     :end-before: >8 End of sending a burst of traffic to a node.
@@ -167,7 +167,7 @@ ring with the server and send them out, if they belong to the node.
 At initialization, it attaches to the server process memory, to have
 access to the shared ring, parameters and statistics.
 
-.. literalinclude:: ../../../examples/server_node_efd/node/node.c
+.. literalinclude:: ../../../examples/server_node_efd/efd_node/node.c
     :language: c
     :start-after: Attaching to the server process memory. 8<
     :end-before: >8 End of attaching to the server process memory.
@@ -176,7 +176,7 @@ access to the shared ring, parameters and statistics.
 Then, the hash table that contains the flows that will be handled
 by the node is created and populated.
 
-.. literalinclude:: ../../../examples/server_node_efd/node/node.c
+.. literalinclude:: ../../../examples/server_node_efd/efd_node/node.c
     :language: c
     :start-after: Creation of hash table. 8<
     :end-before: >8 End of creation of hash table.
@@ -188,7 +188,7 @@ If there is a hit, packet is stored in a buffer, to be eventually transmitted
 in one of the enabled ports. If key is not there, packet is dropped, since the
 flow is not handled by the node.
 
-.. literalinclude:: ../../../examples/server_node_efd/node/node.c
+.. literalinclude:: ../../../examples/server_node_efd/efd_node/node.c
     :language: c
     :start-after: Packets dequeued from the shared ring. 8<
     :end-before: >8 End of packets dequeuing.
@@ -196,7 +196,7 @@ flow is not handled by the node.
 Finally, note that both processes updates statistics, such as transmitted, received
 and dropped packets, which are shown and refreshed by the server app.
 
-.. literalinclude:: ../../../examples/server_node_efd/server/main.c
+.. literalinclude:: ../../../examples/server_node_efd/efd_server/main.c
     :language: c
     :start-after: Display recorded statistics. 8<
     :end-before: >8 End of displaying the recorded statistics.
diff --git a/examples/meson.build b/examples/meson.build
index 6968c09252..55ba8847a0 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -46,8 +46,8 @@ all_examples = [
         'qos_meter',
         'qos_sched',
         'rxtx_callbacks',
-        'server_node_efd/node',
-        'server_node_efd/server',
+        'server_node_efd/efd_node',
+        'server_node_efd/efd_server',
         'service_cores',
         'skeleton',
         'timer',
diff --git a/examples/server_node_efd/Makefile b/examples/server_node_efd/Makefile
index e4a4a94a79..6d61c93dac 100644
--- a/examples/server_node_efd/Makefile
+++ b/examples/server_node_efd/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2016-2020 Intel Corporation
 
-subdirs := node server
+subdirs := efd_node efd_server
 
 .PHONY: all static shared clean $(subdirs)
 all static shared clean: $(subdirs)
diff --git a/examples/server_node_efd/node/Makefile b/examples/server_node_efd/efd_node/Makefile
similarity index 100%
rename from examples/server_node_efd/node/Makefile
rename to examples/server_node_efd/efd_node/Makefile
diff --git a/examples/server_node_efd/node/meson.build b/examples/server_node_efd/efd_node/meson.build
similarity index 95%
rename from examples/server_node_efd/node/meson.build
rename to examples/server_node_efd/efd_node/meson.build
index 1c720968af..b03e65f266 100644
--- a/examples/server_node_efd/node/meson.build
+++ b/examples/server_node_efd/efd_node/meson.build
@@ -6,8 +6,6 @@
 # To build this example as a standalone application with an already-installed
 # DPDK instance, use 'make'
 
-name = 'efd_node'
-
 allow_experimental_apis = true
 deps += ['hash']
 sources += files('node.c')
diff --git a/examples/server_node_efd/node/node.c b/examples/server_node_efd/efd_node/node.c
similarity index 100%
rename from examples/server_node_efd/node/node.c
rename to examples/server_node_efd/efd_node/node.c
diff --git a/examples/server_node_efd/server/Makefile b/examples/server_node_efd/efd_server/Makefile
similarity index 100%
rename from examples/server_node_efd/server/Makefile
rename to examples/server_node_efd/efd_server/Makefile
diff --git a/examples/server_node_efd/server/args.c b/examples/server_node_efd/efd_server/args.c
similarity index 100%
rename from examples/server_node_efd/server/args.c
rename to examples/server_node_efd/efd_server/args.c
diff --git a/examples/server_node_efd/server/args.h b/examples/server_node_efd/efd_server/args.h
similarity index 100%
rename from examples/server_node_efd/server/args.h
rename to examples/server_node_efd/efd_server/args.h
diff --git a/examples/server_node_efd/server/init.c b/examples/server_node_efd/efd_server/init.c
similarity index 100%
rename from examples/server_node_efd/server/init.c
rename to examples/server_node_efd/efd_server/init.c
diff --git a/examples/server_node_efd/server/init.h b/examples/server_node_efd/efd_server/init.h
similarity index 100%
rename from examples/server_node_efd/server/init.h
rename to examples/server_node_efd/efd_server/init.h
diff --git a/examples/server_node_efd/server/main.c b/examples/server_node_efd/efd_server/main.c
similarity index 100%
rename from examples/server_node_efd/server/main.c
rename to examples/server_node_efd/efd_server/main.c
diff --git a/examples/server_node_efd/server/meson.build b/examples/server_node_efd/efd_server/meson.build
similarity index 94%
rename from examples/server_node_efd/server/meson.build
rename to examples/server_node_efd/efd_server/meson.build
index 7abc333e1d..f1a6616738 100644
--- a/examples/server_node_efd/server/meson.build
+++ b/examples/server_node_efd/efd_server/meson.build
@@ -6,8 +6,6 @@
 # To build this example as a standalone application with an already-installed
 # DPDK instance, use 'make'
 
-name = 'efd_server'
-
 allow_experimental_apis = true
 deps += 'efd'
 sources += files('args.c', 'init.c', 'main.c')
-- 
2.40.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH v3 3/4] devtools: build all examples externally
  2023-06-20 14:07 ` [PATCH v3 0/4] Test examples compilation externally David Marchand
  2023-06-20 14:07   ` [PATCH v3 1/4] examples/fips_validation: fix external build David Marchand
  2023-06-20 14:07   ` [PATCH v3 2/4] examples/server_node_efd: simplify build configuration David Marchand
@ 2023-06-20 14:07   ` David Marchand
  2023-06-20 14:07   ` [PATCH v3 4/4] ci: build " David Marchand
                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 30+ messages in thread
From: David Marchand @ 2023-06-20 14:07 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson

So far, users of test-meson-builds.sh had to define their own set of
examples to build externally. This is not that great because users need
to maintain this list when examples are removed/added.

Rework the script so that the 'all' value triggers an automatic
discovery based on what was configured/compiled with meson/ninja.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since v2:
- dropped unneeded -e in sed cmdline,

Changes since v1:
- reworked built examples discovery,
- added comment for people who are not sed fluent,

---
 devtools/test-meson-builds.sh | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index 9131088c9d..1eb28a2490 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -299,6 +299,22 @@ export PKG_CONFIG_PATH=$(dirname $pc_file):$PKG_CONFIG_PATH
 libdir=$(dirname $(find $DESTDIR -name librte_eal.so))
 export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH
 examples=${DPDK_BUILD_TEST_EXAMPLES:-"cmdline helloworld l2fwd l3fwd skeleton timer"}
+if [ "$examples" = 'all' ]; then
+	examples=$(find $build_path/examples -maxdepth 1 -type f -name "dpdk-*" |
+	while read target; do
+		target=${target%%:*}
+		target=${target#$build_path/examples/dpdk-}
+		if [ -e $srcdir/examples/$target/Makefile ]; then
+			echo $target
+			continue
+		fi
+		# Some examples binaries are built from an example sub
+		# directory, discover the "top level" example name.
+		find $srcdir/examples -name Makefile |
+		sed -n "s,$srcdir/examples/\([^/]*\)\(/.*\|\)/$target/Makefile,\1,p"
+	done | sort -u |
+	tr '\n' ' ')
+fi
 # if pkg-config defines the necessary flags, test building some examples
 if pkg-config --define-prefix libdpdk >/dev/null 2>&1; then
 	export PKGCONF="pkg-config --define-prefix"
-- 
2.40.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH v3 4/4] ci: build examples externally
  2023-06-20 14:07 ` [PATCH v3 0/4] Test examples compilation externally David Marchand
                     ` (2 preceding siblings ...)
  2023-06-20 14:07   ` [PATCH v3 3/4] devtools: build all examples externally David Marchand
@ 2023-06-20 14:07   ` David Marchand
  2023-06-22 13:48   ` [PATCH] examples/l2fwd-cat: fix external build Thomas Monjalon
  2023-06-22 13:54   ` [PATCH v3 0/4] Test examples compilation externally Thomas Monjalon
  5 siblings, 0 replies; 30+ messages in thread
From: David Marchand @ 2023-06-20 14:07 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Aaron Conole, Michael Santana

Enhance our CI coverage by building examples against an installed DPDK.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Aaron Conole <aconole@redhat.com>
---
Changes since v2:
- dropped unneeded -e in sed cmdline,

Changes since v1:
- reworked built examples discovery,
- added comment for people who are not sed fluent,

---
 .ci/linux-build.sh          | 27 ++++++++++++++++++++++++++-
 .github/workflows/build.yml |  6 +++---
 2 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index 9631e342b5..d0d9f89bae 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -1,7 +1,7 @@
 #!/bin/sh -xe
 
 if [ -z "${DEF_LIB:-}" ]; then
-    DEF_LIB=static ABI_CHECKS= BUILD_DOCS= RUN_TESTS= $0
+    DEF_LIB=static ABI_CHECKS= BUILD_DOCS= BUILD_EXAMPLES= RUN_TESTS= $0
     DEF_LIB=shared $0
     exit
 fi
@@ -99,6 +99,7 @@ if [ "$MINI" = "true" ]; then
 else
     OPTS="$OPTS -Ddisable_libs="
 fi
+OPTS="$OPTS -Dlibdir=lib"
 
 if [ "$ASAN" = "true" ]; then
     OPTS="$OPTS -Db_sanitize=address"
@@ -168,3 +169,27 @@ if [ "$RUN_TESTS" = "true" ]; then
     catch_coredump
     [ "$failed" != "true" ]
 fi
+
+# Test examples compilation with an installed dpdk
+if [ "$BUILD_EXAMPLES" = "true" ]; then
+    [ -d install ] || DESTDIR=$(pwd)/install ninja -C build install
+    export LD_LIBRARY_PATH=$(dirname $(find $(pwd)/install -name librte_eal.so)):$LD_LIBRARY_PATH
+    export PKG_CONFIG_PATH=$(dirname $(find $(pwd)/install -name libdpdk.pc)):$PKG_CONFIG_PATH
+    export PKGCONF="pkg-config --define-prefix"
+    find build/examples -maxdepth 1 -type f -name "dpdk-*" |
+    while read target; do
+        target=${target%%:*}
+        target=${target#build/examples/dpdk-}
+        if [ -e examples/$target/Makefile ]; then
+            echo $target
+            continue
+        fi
+        # Some examples binaries are built from an example sub
+        # directory, discover the "top level" example name.
+        find examples -name Makefile |
+        sed -n "s,examples/\([^/]*\)\(/.*\|\)/$target/Makefile,\1,p"
+    done | sort -u |
+    while read example; do
+        make -C install/usr/local/share/dpdk/examples/$example clean shared
+    done
+fi
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 3b629fcdbd..414dd089e0 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -20,6 +20,7 @@ jobs:
       BUILD_32BIT: ${{ matrix.config.cross == 'i386' }}
       BUILD_DEBUG: ${{ contains(matrix.config.checks, 'debug') }}
       BUILD_DOCS: ${{ contains(matrix.config.checks, 'doc') }}
+      BUILD_EXAMPLES: ${{ contains(matrix.config.checks, 'examples') }}
       CC: ccache ${{ matrix.config.compiler }}
       DEF_LIB: ${{ matrix.config.library }}
       LIBABIGAIL_VERSION: libabigail-2.1
@@ -39,7 +40,7 @@ jobs:
             mini: mini
           - os: ubuntu-20.04
             compiler: gcc
-            checks: abi+debug+doc+tests
+            checks: abi+debug+doc+examples+tests
           - os: ubuntu-20.04
             compiler: clang
             checks: asan+doc+tests
@@ -96,12 +97,11 @@ jobs:
     - name: Install packages
       run: sudo apt install -y ccache libarchive-dev libbsd-dev libfdt-dev
         libibverbs-dev libjansson-dev libnuma-dev libpcap-dev libssl-dev
-        ninja-build python3-pip python3-pyelftools python3-setuptools
+        ninja-build pkg-config python3-pip python3-pyelftools python3-setuptools
         python3-wheel zlib1g-dev
     - name: Install libabigail build dependencies if no cache is available
       if: env.ABI_CHECKS == 'true' && steps.libabigail-cache.outputs.cache-hit != 'true'
       run: sudo apt install -y autoconf automake libdw-dev libtool libxml2-dev
-        pkg-config
     - name: Install i386 cross compiling packages
       if: env.BUILD_32BIT == 'true'
       run: sudo apt install -y gcc-multilib g++-multilib
-- 
2.40.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v3 1/4] examples/fips_validation: fix external build
  2023-06-20 14:07   ` [PATCH v3 1/4] examples/fips_validation: fix external build David Marchand
@ 2023-06-21  6:23     ` David Marchand
  0 siblings, 0 replies; 30+ messages in thread
From: David Marchand @ 2023-06-21  6:23 UTC (permalink / raw)
  To: dev
  Cc: thomas, bruce.richardson, stable, Brian Dooley,
	Gowrishankar Muthukrishnan

On Tue, Jun 20, 2023 at 4:30 PM David Marchand
<david.marchand@redhat.com> wrote:
>
> Added sources were not referenced in the makefile used when compiling
> this example externally.
>
> Fixes: 36128a67c27e ("examples/fips_validation: add asymmetric validation")
> Fixes: b455d261eb89 ("examples/fips_validation: validate ECDSA")
> Cc: stable@dpdk.org
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>

I forgot a tag on v1:
Acked-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>

> Acked-by: Bruce Richardson <bruce.richardson@intel.com>


-- 
David Marchand


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH] examples/l2fwd-cat: fix external build
  2023-06-20 14:07 ` [PATCH v3 0/4] Test examples compilation externally David Marchand
                     ` (3 preceding siblings ...)
  2023-06-20 14:07   ` [PATCH v3 4/4] ci: build " David Marchand
@ 2023-06-22 13:48   ` Thomas Monjalon
  2023-06-22 13:55     ` Thomas Monjalon
  2023-06-22 13:54   ` [PATCH v3 0/4] Test examples compilation externally Thomas Monjalon
  5 siblings, 1 reply; 30+ messages in thread
From: Thomas Monjalon @ 2023-06-22 13:48 UTC (permalink / raw)
  To: dev
  Cc: David Marchand, stable, Tomasz Kantecki, Andrew Rybchenko, Natanael Copa

From: David Marchand <david.marchand@redhat.com>

cpu_set_t definition requires _GNU_SOURCE.

Fixes: e0473c6d5b18 ("eal: fix build with musl")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
This patch was missing in the patchset to make all examples compile.
It will be merged with others from:
	"Test examples compilation externally"
---
 examples/l2fwd-cat/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/examples/l2fwd-cat/Makefile b/examples/l2fwd-cat/Makefile
index 23a09550a4..d06053451a 100644
--- a/examples/l2fwd-cat/Makefile
+++ b/examples/l2fwd-cat/Makefile
@@ -35,6 +35,7 @@ endif
 endif
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
+CFLAGS += -D_GNU_SOURCE
 
 LDFLAGS += -lpqos
 
-- 
2.41.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v3 0/4] Test examples compilation externally
  2023-06-20 14:07 ` [PATCH v3 0/4] Test examples compilation externally David Marchand
                     ` (4 preceding siblings ...)
  2023-06-22 13:48   ` [PATCH] examples/l2fwd-cat: fix external build Thomas Monjalon
@ 2023-06-22 13:54   ` Thomas Monjalon
  5 siblings, 0 replies; 30+ messages in thread
From: Thomas Monjalon @ 2023-06-22 13:54 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, bruce.richardson

20/06/2023 16:07, David Marchand:
> As DPDK provides examples compiled with makefiles, we need some tests in
> the CI. So far, a few maintainers have been testing them but a simple
> issue has been missed for some time and there was no way to try to build
> all examples that were built with meson.
> 
> Additionnally, this series can help in identify issues in public headers
> that the current headers check can not catch as it relies on the meson
> framework for finding headers include path (which points at sources).
> 
> Changes since v2:
> - tweaked patch 2 commitlog,
> - dropped -e sed option in patch 3/4,
> 
> Changes since v1:
> - reworked built examples discovery,

Applied with the additional patch for l2fwd-cat, thanks.



^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH] examples/l2fwd-cat: fix external build
  2023-06-22 13:48   ` [PATCH] examples/l2fwd-cat: fix external build Thomas Monjalon
@ 2023-06-22 13:55     ` Thomas Monjalon
  0 siblings, 0 replies; 30+ messages in thread
From: Thomas Monjalon @ 2023-06-22 13:55 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, stable, Tomasz Kantecki, Andrew Rybchenko, Natanael Copa

22/06/2023 15:48, Thomas Monjalon:
> From: David Marchand <david.marchand@redhat.com>
> 
> cpu_set_t definition requires _GNU_SOURCE.
> 
> Fixes: e0473c6d5b18 ("eal: fix build with musl")
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
> This patch was missing in the patchset to make all examples compile.
> It will be merged with others from:
> 	"Test examples compilation externally"

Tested-by: Thomas Monjalon <thomas@monjalon.net>
and applied.




^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2023-06-22 13:56 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-13  8:17 [PATCH 0/4] Test examples compilation externally David Marchand
2023-06-13  8:17 ` [PATCH 1/4] examples/fips_validation: fix external build David Marchand
2023-06-13 15:05   ` [EXT] " Gowrishankar Muthukrishnan
2023-06-13  8:17 ` [PATCH 2/4] examples/server_node_efd: simplify build configuration David Marchand
2023-06-13 11:05   ` David Marchand
2023-06-13  8:17 ` [PATCH 3/4] devtools: build all examples externally David Marchand
2023-06-13  9:20   ` Bruce Richardson
2023-06-13  9:29     ` David Marchand
2023-06-13  9:23   ` Bruce Richardson
2023-06-13  8:17 ` [PATCH 4/4] ci: build " David Marchand
2023-06-13  9:21 ` [PATCH 0/4] Test examples compilation externally Bruce Richardson
2023-06-13 14:06 ` [PATCH v2 " David Marchand
2023-06-13 14:06   ` [PATCH v2 1/4] examples/fips_validation: fix external build David Marchand
2023-06-13 14:06   ` [PATCH v2 2/4] examples/server_node_efd: simplify build configuration David Marchand
2023-06-20  9:42     ` Thomas Monjalon
2023-06-20  9:58       ` David Marchand
2023-06-13 14:06   ` [PATCH v2 3/4] devtools: build all examples externally David Marchand
2023-06-20  9:45     ` Thomas Monjalon
2023-06-20  9:52       ` David Marchand
2023-06-13 14:06   ` [PATCH v2 4/4] ci: build " David Marchand
2023-06-16 13:14     ` Aaron Conole
2023-06-20 14:07 ` [PATCH v3 0/4] Test examples compilation externally David Marchand
2023-06-20 14:07   ` [PATCH v3 1/4] examples/fips_validation: fix external build David Marchand
2023-06-21  6:23     ` David Marchand
2023-06-20 14:07   ` [PATCH v3 2/4] examples/server_node_efd: simplify build configuration David Marchand
2023-06-20 14:07   ` [PATCH v3 3/4] devtools: build all examples externally David Marchand
2023-06-20 14:07   ` [PATCH v3 4/4] ci: build " David Marchand
2023-06-22 13:48   ` [PATCH] examples/l2fwd-cat: fix external build Thomas Monjalon
2023-06-22 13:55     ` Thomas Monjalon
2023-06-22 13:54   ` [PATCH v3 0/4] Test examples compilation externally Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).