2 # SPDX-License-Identifier: BSD-3-Clause
3 # Copyright (c) 2019 Red Hat, Inc.
5 if [ $# != 2 ] && [ $# != 3 ]; then
6 echo "Usage: $0 refdir newdir [warnonly]" >&2
13 ABIDIFF_OPTIONS="--suppr $(dirname $0)/libabigail.abignore --no-added-syms"
15 if [ ! -d $refdir ]; then
16 echo "Error: reference directory '$refdir' does not exist." >&2
19 incdir=$(find $refdir -type d -a -name include)
20 if [ -z "$incdir" ] || [ ! -e "$incdir" ]; then
21 echo "WARNING: could not identify an include directory for $refdir, expect false positives..." >&2
23 ABIDIFF_OPTIONS="$ABIDIFF_OPTIONS --headers-dir1 $incdir"
26 if [ ! -d $newdir ]; then
27 echo "Error: directory to check '$newdir' does not exist." >&2
30 incdir2=$(find $newdir -type d -a -name include)
31 if [ -z "$incdir2" ] || [ ! -e "$incdir2" ]; then
32 echo "WARNING: could not identify an include directory for $newdir, expect false positives..." >&2
34 ABIDIFF_OPTIONS="$ABIDIFF_OPTIONS --headers-dir2 $incdir2"
38 for dump in $(find $refdir -name "*.dump"); do
39 name=$(basename $dump)
40 # skip glue drivers, example librte_pmd_mlx5_glue.dump
41 # We can't rely on a suppression rule for now:
42 # https://sourceware.org/bugzilla/show_bug.cgi?id=25480
43 if grep -qE "\<soname='[^']*_glue\.so\.[^']*'" $dump; then
44 echo "Skipped glue library $name."
47 if grep -qE "\<soname='librte_event_dlb\.so" $dump; then
48 echo "Skipped removed driver $name."
51 dump2=$(find $newdir -name $name)
52 if [ -z "$dump2" ] || [ ! -e "$dump2" ]; then
53 echo "Error: cannot find $name in $newdir" >&2
57 abidiff $ABIDIFF_OPTIONS $dump $dump2 || {
59 echo "Error: ABI issue reported for 'abidiff $ABIDIFF_OPTIONS $dump $dump2'" >&2
62 if [ $(($abiret & 3)) -ne 0 ]; then
63 echo "ABIDIFF_ERROR|ABIDIFF_USAGE_ERROR, this could be a script or environment issue." >&2
65 if [ $(($abiret & 4)) -ne 0 ]; then
66 echo "ABIDIFF_ABI_CHANGE, this change requires a review (abidiff flagged this as a potential issue)." >&2
68 if [ $(($abiret & 8)) -ne 0 ]; then
69 echo "ABIDIFF_ABI_INCOMPATIBLE_CHANGE, this change breaks the ABI." >&2
75 [ -z "$error" ] || [ -n "$warnonly" ]