Created
July 2, 2019 04:54
-
-
Save whot/41413074983b25a2e14f8b9310ca572e to your computer and use it in GitHub Desktop.
libwacom ABI symbol testing script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
src_old=$HOME/libwacom-0.33 | |
src_new=$HOME/libwacom-0.34 | |
dst_old=$HOME/libwacom-inst-0.33 | |
dst_new=$HOME/libwacom-inst-0.34 | |
build() { | |
src=$1 | |
dst=$2 | |
pushd $src > /dev/null | |
git clean -dxf > /dev/null | |
./autogen.sh --prefix=$dst > /dev/null | |
make clean > /dev/null | |
make check > /dev/null | |
make install > /dev/null | |
popd > /dev/null | |
} | |
compile() { | |
prefix=$1 | |
PKG_CONFIG_PATH=$prefix/lib/pkgconfig | |
export PKG_CONFIG_PATH | |
LD_LIBRARY_PATH=$prefix/lib/ | |
export LD_LIBRARY_PATH | |
gcc -o test test.c `pkg-config --cflags --libs libwacom` | |
unset PKG_CONFIG_PATH | |
unset LD_LIBRARY_PATH | |
} | |
echo "#### compiling old" | |
build $src_old $dst_old | |
echo "#### compiling new" | |
build $src_new $dst_new | |
echo "#### generating test program" | |
cat > test.c <<EOF | |
#define NULL 0 | |
extern void *libwacom_match_new(void *, int, int, int); | |
extern void libwacom_match_destroy(void *); | |
int main(void) { | |
void * match = libwacom_match_new(NULL, 3, 0, 0); | |
libwacom_match_destroy(match); | |
return 0; | |
} | |
EOF | |
echo "#### compiling against 0.33" | |
compile $dst_old | |
mv test test.33 | |
echo "#### compiling against 0.34 (expect fail)" | |
set +e | |
compile $dst_new | |
mv test test.34 | |
set -e | |
echo "#### Running test now" | |
echo "#### running .33 against .33" | |
LD_LIBRARY_PATH=$dst_old/lib ./test.33 && echo "success" | |
echo "#### running .33 against .34" | |
LD_LIBRARY_PATH=$dst_new/lib ./test.33 && echo "success" | |
echo "#### running .34 against .33" | |
set +e | |
LD_LIBRARY_PATH=$dst_old/lib ./test.34 && echo "success (expect fail)" | |
set -e | |
echo "#### running .34 against .34" | |
LD_LIBRARY_PATH=$dst_new/lib ./test.34 && echo "success" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment