[PATCH 3/4] devtools: build all examples externally

David Marchand david.marchand at redhat.com
Tue Jun 13 10:17:40 CEST 2023


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 at 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



More information about the dev mailing list