numam-dpdk/devtools/check-abi.sh
David Marchand 777014e56d devtools: add ABI checks
For normal developers, those checks are disabled.

Enabling them requires a configuration that will trigger the ABI dumps
generation as part of the existing devtools/test-build.sh and
devtools/test-meson-builds.sh scripts.

Those checks are enabled in the CI for the default meson options on x86
and aarch64 so that proposed patches are validated via our CI robot.
A cache of the ABI is stored in travis jobs to avoid rebuilding too
often.

Checks can be informational only, by setting ABI_CHECKS_WARN_ONLY when
breaking the ABI in a future release.

Explicit suppression rules have been added on internal structures
exposed to crypto drivers as the current ABI policy does not apply to
them.
This could be improved in the future by carefully splitting the headers
content with application and driver "users" in mind.

We currently have issues reported for librte_crypto recent changes for
which suppression rules have been added too.

Mellanox glue libraries are explicitly skipped as they are not part of
the application ABI.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Luca Boccassi <bluca@debian.org>
2020-02-05 15:14:46 +01:00

60 lines
1.6 KiB
Bash
Executable File

#!/bin/sh -e
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2019 Red Hat, Inc.
if [ $# != 2 ] && [ $# != 3 ]; then
echo "Usage: $0 refdir newdir [warnonly]"
exit 1
fi
refdir=$1
newdir=$2
warnonly=${3:-}
ABIDIFF_OPTIONS="--suppr $(dirname $0)/libabigail.abignore --no-added-syms"
if [ ! -d $refdir ]; then
echo "Error: reference directory '$refdir' does not exist."
exit 1
fi
incdir=$(find $refdir -type d -a -name include)
if [ -z "$incdir" ] || [ ! -e "$incdir" ]; then
echo "WARNING: could not identify a include directory for $refdir, expect false positives..."
else
ABIDIFF_OPTIONS="$ABIDIFF_OPTIONS --headers-dir1 $incdir"
fi
if [ ! -d $newdir ]; then
echo "Error: directory to check '$newdir' does not exist."
exit 1
fi
incdir2=$(find $newdir -type d -a -name include)
if [ -z "$incdir2" ] || [ ! -e "$incdir2" ]; then
echo "WARNING: could not identify a include directory for $newdir, expect false positives..."
else
ABIDIFF_OPTIONS="$ABIDIFF_OPTIONS --headers-dir2 $incdir2"
fi
error=
for dump in $(find $refdir -name "*.dump"); do
name=$(basename $dump)
# skip glue drivers, example librte_pmd_mlx5_glue.dump
# We can't rely on a suppression rule for now:
# https://sourceware.org/bugzilla/show_bug.cgi?id=25480
if [ "$name" != "${name%%_glue.dump}" ]; then
echo "Skipping ${dump}..."
continue
fi
dump2=$(find $newdir -name $name)
if [ -z "$dump2" ] || [ ! -e "$dump2" ]; then
echo "Error: can't find $name in $newdir"
error=1
continue
fi
if ! abidiff $ABIDIFF_OPTIONS $dump $dump2; then
echo "Error: ABI issue reported for 'abidiff $ABIDIFF_OPTIONS $dump $dump2'"
error=1
fi
done
[ -z "$error" ] || [ -n "$warnonly" ]