1#!/bin/sh -e 2# SPDX-License-Identifier: BSD-3-Clause 3# Copyright (c) 2019 Red Hat, Inc. 4 5if [ $# != 2 ] && [ $# != 3 ]; then 6 echo "Usage: $0 refdir newdir [warnonly]" >&2 7 exit 1 8fi 9 10refdir=$1 11newdir=$2 12warnonly=${3:-} 13ABIDIFF_OPTIONS="--suppr $(dirname $0)/libabigail.abignore --no-added-syms" 14 15if [ ! -d $refdir ]; then 16 echo "Error: reference directory '$refdir' does not exist." >&2 17 exit 1 18fi 19incdir=$(find $refdir -type d -a -name include) 20if [ -z "$incdir" ] || [ ! -e "$incdir" ]; then 21 echo "WARNING: could not identify an include directory for $refdir, expect false positives..." >&2 22else 23 ABIDIFF_OPTIONS="$ABIDIFF_OPTIONS --headers-dir1 $incdir" 24fi 25 26if [ ! -d $newdir ]; then 27 echo "Error: directory to check '$newdir' does not exist." >&2 28 exit 1 29fi 30incdir2=$(find $newdir -type d -a -name include) 31if [ -z "$incdir2" ] || [ ! -e "$incdir2" ]; then 32 echo "WARNING: could not identify an include directory for $newdir, expect false positives..." >&2 33else 34 ABIDIFF_OPTIONS="$ABIDIFF_OPTIONS --headers-dir2 $incdir2" 35fi 36 37error= 38for dump in $(find $refdir -name "*.dump"); do 39 name=$(basename $dump) 40 if grep -qE '\<librte_*(.*_octeontx2|raw_dpaa2_qdma)' $dump; then 41 echo "Skipped removed driver $name." 42 continue 43 fi 44 dump2=$(find $newdir -name $name) 45 if [ -z "$dump2" ] || [ ! -e "$dump2" ]; then 46 echo "Error: cannot find $name in $newdir" >&2 47 error=1 48 continue 49 fi 50 abidiff $ABIDIFF_OPTIONS $dump $dump2 || { 51 abiret=$? 52 echo "Error: ABI issue reported for 'abidiff $ABIDIFF_OPTIONS $dump $dump2'" >&2 53 error=1 54 echo 55 if [ $(($abiret & 3)) -ne 0 ]; then 56 echo "ABIDIFF_ERROR|ABIDIFF_USAGE_ERROR, this could be a script or environment issue." >&2 57 fi 58 if [ $(($abiret & 4)) -ne 0 ]; then 59 echo "ABIDIFF_ABI_CHANGE, this change requires a review (abidiff flagged this as a potential issue)." >&2 60 fi 61 if [ $(($abiret & 8)) -ne 0 ]; then 62 echo "ABIDIFF_ABI_INCOMPATIBLE_CHANGE, this change breaks the ABI." >&2 63 fi 64 echo 65 } 66done 67 68[ -z "$error" ] || [ -n "$warnonly" ] 69