[3/4] devtools: build all examples externally
Checks
Commit Message
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(+)
Comments
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
>
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
>
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.
@@ -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"