Test examples compilation externally
cover Test examples compilation externally
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).
Signature · 39 lines
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.1PATCH 1/4 examples/fips_validation: fix external build
Added sources were not referenced in the makefile used when compiling this example externally.
--- examples/fips_validation/Makefile | 2 ++ 1 file changed, 2 insertions(+)
examples/fips_validation/Makefile +2 -0
@@ -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
Signature · 1 line
2.40.1
RE: [EXT] [PATCH 1/4] examples/fips_validation: fix external build
Thanks.
Quoted 39 lines
-----Original Message-----
From: David Marchand <[email protected]>
Sent: Tuesday, June 13, 2023 1:48 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; Brian Dooley <[email protected]>; Gowrishankar Muthukrishnan <[email protected]>
Subject: [EXT] [PATCH 1/4] examples/fips_validation: fix external buildExternal 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")Signed-off-by David Marchand <[email protected]>--- examples/fips_validation/Makefile | 2 ++ 1 file changed, 2 insertions(+)examples/fips_validation/Makefile +0
-0@@ -15,6 +15,8 @@ SRCS-y += fips_validation_ccm.c SRCS-y +=
fips_validation_sha.cSRCS-y +=fips_dev_self_test.cSRCS-y +=fips_validation_xts.cexamples/fips_validation/Makefile +2
-1+SRCS-y += fips_validation_rsa.c +SRCS-y += fips_validation_ecdsa.c SRCS-y += main.c PKGCONF ?= pkg-config --2.40.1
PATCH 2/4 examples/server_node_efd: simplify build configuration
In reply to David MarchandRename sub directories in this example.
This removes the only special case in examples and will ease a next change.
---
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%)doc/guides/sample_app_ug/server_node_efd.rst +7 -7
@@ -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.
examples/meson.build +2 -2
@@ -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',
examples/server_node_efd/Makefile +1 -1
@@ -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)
examples/server_node_efd/efd_node/Makefile renamed from examples/server_node_efd/node/Makefile +0 -0
examples/server_node_efd/efd_node/meson.build renamed from examples/server_node_efd/node/meson.build +0 -2
@@ -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')
examples/server_node_efd/efd_node/node.c renamed from examples/server_node_efd/node/node.c +0 -0
examples/server_node_efd/efd_server/Makefile renamed from examples/server_node_efd/server/Makefile +0 -0
examples/server_node_efd/efd_server/args.c renamed from examples/server_node_efd/server/args.c +0 -0
examples/server_node_efd/efd_server/args.h renamed from examples/server_node_efd/server/args.h +0 -0
examples/server_node_efd/efd_server/init.c renamed from examples/server_node_efd/server/init.c +0 -0
examples/server_node_efd/efd_server/init.h renamed from examples/server_node_efd/server/init.h +0 -0
examples/server_node_efd/efd_server/main.c renamed from examples/server_node_efd/server/main.c +0 -0
examples/server_node_efd/efd_server/meson.build renamed from examples/server_node_efd/server/meson.build +0 -2
@@ -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')
Signature · 1 line
2.40.1
Re: [PATCH 2/4] examples/server_node_efd: simplify build configuration
doc/guides/sample_app_ug/server_node_efd.rst which is used to distribute packets to nodes, which the number of flows · line 143
Quoted 13 lines · David Marchand
doc/guides/sample_app_ug/server_node_efd.rst +1
-1@@ -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
Signature · 1 line
David Marchand
PATCH 3/4 devtools: build all examples externally
In reply to David MarchandSo 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.
--- devtools/test-meson-builds.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
devtools/test-meson-builds.sh +14 -0
@@ -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"
Signature · 1 line
2.40.1
Re: [PATCH 3/4] devtools: build all examples externally
Quoted 17 lines · David Marchand
So far, users of
test-meson-builds.shhad 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 <[email protected]>--- devtools/test-meson-builds.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+)devtools/test-meson-builds.sh +0
-0
devtools/test-meson-builds.sh export PKG_CONFIG_PATH=$(dirname $pc_file):$PKG_CONFIG_PATH · line 303
Quoted 5 lines
devtools/test-meson-builds.sh +2
-0@@ -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-*"?
Quoted 18 lines
devtools/test-meson-builds.sh +12
-0+ 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"Signature · 1 line
2.40.1
Re: [PATCH 3/4] devtools: build all examples externally
Quoted 14 lines · Bruce Richardson
Quoted 12 lines · David Marchand
So far, users of
test-meson-builds.shhad 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 <[email protected]>--- devtools/test-meson-builds.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
Quoted 13 lines
devtools/test-meson-builds.sh export PKG_CONFIG_PATH=$(dirname $pc_file):$PKG_CONFIG_PATH · line 303
Quoted 10 lines
devtools/test-meson-builds.sh +2
-0@@ -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.
Quoted 5 lines
devtools/test-meson-builds.sh export PKG_CONFIG_PATH=$(dirname $pc_file):$PKG_CONFIG_PATH · line 305
Quoted 2 lines
devtools/test-meson-builds.sh +2
-0+ 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.
Signature · 1 line
David Marchand
Re: [PATCH 3/4] devtools: build all examples externally
In reply to David MarchandQuoted 21 lines · David Marchand
So far, users of
test-meson-builds.shhad 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 <[email protected]>--- devtools/test-meson-builds.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+)devtools/test-meson-builds.sh +1
-0@@ -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
devtools/test-meson-builds.sh export PKG_CONFIG_PATH=$(dirname $pc_file):$PKG_CONFIG_PATH · line 312
Quoted 10 lines
devtools/test-meson-builds.sh +10
-0+ 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.
Quoted 9 lines
devtools/test-meson-builds.sh +3
-0+ 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"Signature · 1 line
2.40.1
PATCH 4/4 ci: build examples externally
In reply to David MarchandEnhance our CI coverage by building examples against an installed DPDK.
--- .ci/linux-build.sh | 25 ++++++++++++++++++++++++- .github/workflows/build.yml | 6 +++--- 2 files changed, 27 insertions(+), 4 deletions(-)
.ci/linux-build.sh +24 -1
@@ -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
.github/workflows/build.yml +3 -3
@@ -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
Signature · 1 line
2.40.1
Quoted 9 lines · 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).
Good idea.
v2 cover Test examples compilation externally
In reply to David MarchandAs 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,
Signature · 39 lines
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.1PATCH v2 1/4 examples/fips_validation: fix external build
Added sources were not referenced in the makefile used when compiling this example externally.
--- examples/fips_validation/Makefile | 2 ++ 1 file changed, 2 insertions(+)
examples/fips_validation/Makefile +2 -0
@@ -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
Signature · 1 line
2.40.1
PATCH v2 2/4 examples/server_node_efd: simplify build configuration
In reply to David MarchandRename sub directories in this example.
This removes the only special case in examples and will ease a next change.
---
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%)doc/guides/sample_app_ug/server_node_efd.rst +7 -7
@@ -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.
examples/meson.build +2 -2
@@ -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',
examples/server_node_efd/Makefile +1 -1
@@ -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)
examples/server_node_efd/efd_node/Makefile renamed from examples/server_node_efd/node/Makefile +0 -0
examples/server_node_efd/efd_node/meson.build renamed from examples/server_node_efd/node/meson.build +0 -2
@@ -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')
examples/server_node_efd/efd_node/node.c renamed from examples/server_node_efd/node/node.c +0 -0
examples/server_node_efd/efd_server/Makefile renamed from examples/server_node_efd/server/Makefile +0 -0
examples/server_node_efd/efd_server/args.c renamed from examples/server_node_efd/server/args.c +0 -0
examples/server_node_efd/efd_server/args.h renamed from examples/server_node_efd/server/args.h +0 -0
examples/server_node_efd/efd_server/init.c renamed from examples/server_node_efd/server/init.c +0 -0
examples/server_node_efd/efd_server/init.h renamed from examples/server_node_efd/server/init.h +0 -0
examples/server_node_efd/efd_server/main.c renamed from examples/server_node_efd/server/main.c +0 -0
examples/server_node_efd/efd_server/meson.build renamed from examples/server_node_efd/server/meson.build +0 -2
@@ -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')
Signature · 1 line
2.40.1
Re: [PATCH v2 2/4] examples/server_node_efd: simplify build configuration
13/06/2023 16:06, David Marchand:
Quoted 3 lines
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).
Re: [PATCH v2 2/4] examples/server_node_efd: simplify build configuration
Quoted 8 lines · Thomas Monjalon
13/06/2023 16:06, David Marchand:
Quoted 3 lines
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.
Signature · 1 line
David Marchand
PATCH v2 3/4 devtools: build all examples externally
In reply to David MarchandSo 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.
---
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(+)
devtools/test-meson-builds.sh +16 -0
@@ -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"
Signature · 1 line
2.40.1
Re: [PATCH v2 3/4] devtools: build all examples externally
13/06/2023 16:06, David Marchand:
devtools/test-meson-builds.sh export PKG_CONFIG_PATH=$(dirname $pc_file):$PKG_CONFIG_PATH · line 314
Quoted 1 line
devtools/test-meson-builds.sh +1
-0+ 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.
Re: [PATCH v2 3/4] devtools: build all examples externally
Quoted 5 lines · Thomas Monjalon
13/06/2023 16:06, David Marchand:
Quoted 1 line
+ sed -ne "s,$srcdir/examples/\([^/]*\)\(/.*\|\)/$target/Makefile,\1,p"
I think -e is not needed.
Indeed.
Quoted 1 line
If you use -r, you can avoid backslashing the parentheses.
-r is not a posix option.
Signature · 1 line
David Marchand
PATCH v2 4/4 ci: build examples externally
In reply to David MarchandEnhance our CI coverage by building examples against an installed DPDK.
---
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(-)
.ci/linux-build.sh +26 -1
@@ -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
.github/workflows/build.yml +3 -3
@@ -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
Signature · 1 line
2.40.1
Re: [PATCH v2 4/4] ci: build examples externally
Quoted 5 lines · David Marchand
Enhance our CI coverage by building examples against an installed DPDK.
Signed-off-by David Marchand <[email protected]>Acked-by Bruce Richardson <[email protected]>---
v3 cover Test examples compilation externally
In reply to David MarchandAs 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,
Signature · 39 lines
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.1PATCH v3 1/4 examples/fips_validation: fix external build
Added sources were not referenced in the makefile used when compiling this example externally.
--- examples/fips_validation/Makefile | 2 ++ 1 file changed, 2 insertions(+)
examples/fips_validation/Makefile +2 -0
@@ -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
Signature · 1 line
2.40.1
Re: [PATCH v3 1/4] examples/fips_validation: fix external build
Quoted 9 lines · David Marchand
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")Signed-off-by David Marchand <[email protected]>
I forgot a tag on v1:
Quoted 1 line
Acked-by Bruce Richardson <[email protected]>
Signature · 1 line
David Marchand
PATCH v3 2/4 examples/server_node_efd: simplify build configuration
In reply to David MarchandThe 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.
---
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%)doc/guides/sample_app_ug/server_node_efd.rst +7 -7
@@ -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.
examples/meson.build +2 -2
@@ -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',
examples/server_node_efd/Makefile +1 -1
@@ -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)
examples/server_node_efd/efd_node/Makefile renamed from examples/server_node_efd/node/Makefile +0 -0
examples/server_node_efd/efd_node/meson.build renamed from examples/server_node_efd/node/meson.build +0 -2
@@ -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')
examples/server_node_efd/efd_node/node.c renamed from examples/server_node_efd/node/node.c +0 -0
examples/server_node_efd/efd_server/Makefile renamed from examples/server_node_efd/server/Makefile +0 -0
examples/server_node_efd/efd_server/args.c renamed from examples/server_node_efd/server/args.c +0 -0
examples/server_node_efd/efd_server/args.h renamed from examples/server_node_efd/server/args.h +0 -0
examples/server_node_efd/efd_server/init.c renamed from examples/server_node_efd/server/init.c +0 -0
examples/server_node_efd/efd_server/init.h renamed from examples/server_node_efd/server/init.h +0 -0
examples/server_node_efd/efd_server/main.c renamed from examples/server_node_efd/server/main.c +0 -0
examples/server_node_efd/efd_server/meson.build renamed from examples/server_node_efd/server/meson.build +0 -2
@@ -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')
Signature · 1 line
2.40.1
PATCH v3 3/4 devtools: build all examples externally
In reply to David MarchandSo 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.
---
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(+)
devtools/test-meson-builds.sh +16 -0
@@ -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"
Signature · 1 line
2.40.1
PATCH v3 4/4 ci: build examples externally
In reply to David MarchandEnhance our CI coverage by building examples against an installed DPDK.
---
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(-)
.ci/linux-build.sh +26 -1
@@ -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
.github/workflows/build.yml +3 -3
@@ -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
Signature · 1 line
2.40.1
PATCH 1/1 examples/l2fwd-cat: fix external build
In reply to David MarchandFrom: David Marchand <[email protected]>
cpu_set_t definition requires _GNU_SOURCE.
---
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(+)
examples/l2fwd-cat/Makefile +1 -0
@@ -35,6 +35,7 @@ endif endif CFLAGS += -DALLOW_EXPERIMENTAL_API +CFLAGS += -D_GNU_SOURCE LDFLAGS += -lpqos
Signature · 1 line
2.41.0
Re: [PATCH] examples/l2fwd-cat: fix external build
22/06/2023 15:48, Thomas Monjalon:
Quoted 4 lines
From: David Marchand <[email protected]>
cpu_set_tdefinition requires_GNU_SOURCE.
Quoted 8 lines
Fixes e0473c6d5b18 ("eal: fix build with musl")Signed-off-by David Marchand <[email protected]>---
This patch was missing in the patchset to make all examples compile. It will be merged with others from:
"Test examples compilation externally"
and applied.
20/06/2023 16:07, David Marchand:
Quoted 9 lines
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).
Quoted 6 lines
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.