mirror of
git://sourceware.org/git/libabigail.git
synced 2025-01-25 02:32:46 +00:00
74 lines
2.1 KiB
Bash
74 lines
2.1 KiB
Bash
|
#! /bin/sh
|
||
|
|
||
|
# Run an abidb test based on the binaries right here
|
||
|
|
||
|
# test prereqs
|
||
|
type git 2>/dev/null || (echo "need git" ; exit 77)
|
||
|
type gcc 2>/dev/null || (echo "need gcc" ; exit 77)
|
||
|
type eu-readelf 2>/dev/null || (echo "need eu-readelf" ; exit 77)
|
||
|
type debuginfod-find 2>/dev/null || (echo "need debuginfod-find" ; exit 77)
|
||
|
|
||
|
toolssrcdir=@abs_top_srcdir@/tools
|
||
|
toolsdir=@abs_top_builddir@/tools
|
||
|
PATH=$toolsdir:$PATH
|
||
|
export PATH
|
||
|
|
||
|
type $toolsdir/abidw && ABIDW=$toolsdir/abidw
|
||
|
type $toolsdir/abidiff && ABIDIFF=$toolsdir/abidiff
|
||
|
type $toolssrcdir/abidb && ABIDB=$toolssrcdir/abidb
|
||
|
type $toolsdir/abicompat && ABICOMPAT=$toolsdir/abicompat
|
||
|
datadir=@abs_top_srcdir@/tests/data/test-abidb
|
||
|
odatadir=@abs_top_builddir@/tests/data/test-abidb
|
||
|
|
||
|
test -d $odatadir || mkdir -p $odatadir
|
||
|
|
||
|
set -x
|
||
|
|
||
|
gitdir=$(mktemp -d --tmpdir abidb-XXXXXXXX)
|
||
|
|
||
|
function clean_env
|
||
|
{
|
||
|
echo cleaning "$gitdir"
|
||
|
# comment rm -rf out to preserve the evidence
|
||
|
rm -rf "$gitdir"
|
||
|
rm -rf $odatadir
|
||
|
}
|
||
|
|
||
|
git init $gitdir
|
||
|
|
||
|
# Build a little shared library, a binary against it, then
|
||
|
# break it with an update
|
||
|
|
||
|
gcc -g -fPIC -rdynamic -shared $datadir/abidb2so.c -Wl,-soname=libabidb2.so -o $odatadir/libabidb2.so
|
||
|
$ABIDB --loglevel=debug --abidw $ABIDW --git $gitdir --submit $odatadir/libabidb2.so
|
||
|
gcc -g $datadir/abidb2client.c -L$odatadir -labidb2 -o $odatadir/abidb2client
|
||
|
$ABIDB --loglevel=debug --git $gitdir --check $odatadir/abidb2client
|
||
|
rm $odatadir/libabidb2.so
|
||
|
gcc -g -fPIC -rdynamic -shared $datadir/abidb2soBAD.c -Wl,-soname=libabidb2.so -o $odatadir/libabidb2.so
|
||
|
|
||
|
cmd="$ABIDB --loglevel=debug --abidw $ABIDW --git $gitdir --submit $odatadir/libabidb2.so"
|
||
|
$cmd
|
||
|
RESULT_CODE=$?
|
||
|
if test $RESULT_CODE -eq 0; then
|
||
|
cmd="$ABIDB --loglevel=debug --abicompat $ABICOMPAT --git $gitdir --check $odatadir/abidb2client"
|
||
|
$cmd
|
||
|
RESULT_CODE=$?
|
||
|
echo "expected a failure!"
|
||
|
if test $RESULT_CODE -ne 0; then
|
||
|
echo "executed: $cmd: "
|
||
|
echo "with exit code: $RESULT_CODE"
|
||
|
RESULT_CODE=0
|
||
|
else
|
||
|
RESULT_CODE=1
|
||
|
fi
|
||
|
else
|
||
|
echo "command failed: $cmd"
|
||
|
fi
|
||
|
|
||
|
# How many shared libraries did we collect?
|
||
|
(cd $gitdir; git ls-files; for file in `git ls-files`; do git show $file; done )
|
||
|
|
||
|
clean_env
|
||
|
|
||
|
exit $RESULT_CODE
|