From: David Marchand <david.marchand@redhat.com>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@amd.com>
Subject: Re: [PATCH v3] devtools: parallelize ABI check
Date: Wed, 11 Jan 2023 15:11:10 +0100 [thread overview]
Message-ID: <CAJFAV8wC-i2nL-KDubVjD+7_HPqPkAfvzwy7k6Kjzm4z20_UOg@mail.gmail.com> (raw)
In-Reply-To: <20230111131652.1265058-1-thomas@monjalon.net>
On Wed, Jan 11, 2023 at 2:16 PM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> Generation and comparison of ABI dumps are done on multiple cores
> thanks to xargs -P0.
> It can accelerate this long step by 5 in my tests.
>
> xargs reports a global error if one of the process has an error.
>
> Running a shell function with xargs requires to export it with -f,
> and that is a specific capability of bash.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> Tested-by: Ferruh Yigit <ferruh.yigit@amd.com>
> ---
> v2:
> - find dump2 inside the function
> - force bash because of export -f
> v3:
> - revert to POSIX sh
> - use POSIX eval instead of export -f (issues on Ubuntu)
> ---
> devtools/check-abi.sh | 21 +++++++++++++--------
> devtools/gen-abi.sh | 5 +++--
> 2 files changed, 16 insertions(+), 10 deletions(-)
>
> diff --git a/devtools/check-abi.sh b/devtools/check-abi.sh
> index c583eae2fd..d58c867c60 100755
> --- a/devtools/check-abi.sh
> +++ b/devtools/check-abi.sh
> @@ -34,19 +34,18 @@ else
> ABIDIFF_OPTIONS="$ABIDIFF_OPTIONS --headers-dir2 $incdir2"
> fi
>
> -error=
> -for dump in $(find $refdir -name "*.dump"); do
> +export diff_func='run_diff() {
> + dump=$1
> + newdir=$2
> name=$(basename $dump)
> dump2=$(find $newdir -name $name)
> if [ -z "$dump2" ] || [ ! -e "$dump2" ]; then
> echo "Error: cannot find $name in $newdir" >&2
> - error=1
> - continue
> - fi
> + return 1
> + fi;
> abidiff $ABIDIFF_OPTIONS $dump $dump2 || {
> abiret=$?
> - echo "Error: ABI issue reported for 'abidiff $ABIDIFF_OPTIONS $dump $dump2'" >&2
> - error=1
> + echo "Error: ABI issue reported for abidiff $ABIDIFF_OPTIONS $dump $dump2" >&2
> echo
> if [ $(($abiret & 3)) -ne 0 ]; then
> echo "ABIDIFF_ERROR|ABIDIFF_USAGE_ERROR, this could be a script or environment issue." >&2
> @@ -58,7 +57,13 @@ for dump in $(find $refdir -name "*.dump"); do
> echo "ABIDIFF_ABI_INCOMPATIBLE_CHANGE, this change breaks the ABI." >&2
> fi
> echo
> + return 1
> }
> -done
> +}'
> +
> +error=
> +find $refdir -name "*.dump" |
> +xargs -n1 -P0 sh -c 'eval "$diff_func"; run_diff $0 '$newdir ||
> +error=1
Do we need to pass $newdir ?
Like, for example, ABIDIFF_OPTIONS seems inherited, right?
Otherwise this trick looks to work.
--
David Marchand
next prev parent reply other threads:[~2023-01-11 14:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-07 13:39 [PATCH] " Thomas Monjalon
2023-01-09 9:34 ` [PATCH v2] " Thomas Monjalon
2023-01-10 11:08 ` Ferruh Yigit
2023-01-11 13:16 ` [PATCH v3] " Thomas Monjalon
2023-01-11 14:10 ` Bruce Richardson
2023-01-11 14:11 ` David Marchand [this message]
2023-01-11 17:04 ` Thomas Monjalon
2023-01-11 19:53 ` [PATCH v4] " Thomas Monjalon
2023-01-12 10:53 ` David Marchand
2023-01-12 14:14 ` Ferruh Yigit
2023-01-18 10:45 ` David Marchand
2023-01-18 11:43 ` Ferruh Yigit
2023-01-18 14:29 ` David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJFAV8wC-i2nL-KDubVjD+7_HPqPkAfvzwy7k6Kjzm4z20_UOg@mail.gmail.com \
--to=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).