DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] devtools: parallelize ABI check
@ 2023-01-07 13:39 Thomas Monjalon
  2023-01-09  9:34 ` [PATCH v2] " Thomas Monjalon
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Thomas Monjalon @ 2023-01-07 13:39 UTC (permalink / raw)
  Cc: dev, David Marchand

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.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 devtools/check-abi.sh | 33 ++++++++++++++++++++-------------
 devtools/gen-abi.sh   |  5 +++--
 2 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/devtools/check-abi.sh b/devtools/check-abi.sh
index c583eae2fd..e2fa49217d 100755
--- a/devtools/check-abi.sh
+++ b/devtools/check-abi.sh
@@ -34,19 +34,10 @@ else
 	ABIDIFF_OPTIONS="$ABIDIFF_OPTIONS --headers-dir2 $incdir2"
 fi
 
-error=
-for dump in $(find $refdir -name "*.dump"); do
-	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
-	abidiff $ABIDIFF_OPTIONS $dump $dump2 || {
+run_diff() { # <dump1> <dump2>
+	abidiff $ABIDIFF_OPTIONS $1 $2 || {
 		abiret=$?
-		echo "Error: ABI issue reported for 'abidiff $ABIDIFF_OPTIONS $dump $dump2'" >&2
-		error=1
+		echo "Error: ABI issue reported for 'abidiff $ABIDIFF_OPTIONS $1 $2'" >&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 +49,23 @@ for dump in $(find $refdir -name "*.dump"); do
 			echo "ABIDIFF_ABI_INCOMPATIBLE_CHANGE, this change breaks the ABI." >&2
 		fi
 		echo
+		return $abiret
 	}
-done
+}
+export -f run_diff
+
+error=
+for dump in $(find $refdir -name "*.dump"); do
+	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
+	echo $dump $dump2
+done |
+xargs -n2 -P0 sh -c 'run_diff $0 $1' ||
+error=1
 
 [ -z "$error" ] || [ -n "$warnonly" ]
diff --git a/devtools/gen-abi.sh b/devtools/gen-abi.sh
index f15a3b9aaf..61f7510ea1 100755
--- a/devtools/gen-abi.sh
+++ b/devtools/gen-abi.sh
@@ -22,5 +22,6 @@ for f in $(find $installdir -name "*.so.*"); do
 	fi
 
 	libname=$(basename $f)
-	abidw --out-file $dumpdir/${libname%.so*}.dump $f
-done
+	echo $dumpdir/${libname%.so*}.dump $f
+done |
+xargs -n2 -P0 abidw --out-file
-- 
2.39.0


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

end of thread, other threads:[~2023-01-18 14:29 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-07 13:39 [PATCH] devtools: parallelize ABI check 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
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

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).