summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/check-abi
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2013-08-22 19:31:26 +0000
committerAndrew Stitcher <astitcher@apache.org>2013-08-22 19:31:26 +0000
commite6487931879d9479080dba5ae1126fbb8397dd11 (patch)
tree98b14a2afdf865501183e842c0460cb3a9dd8693 /qpid/cpp/src/check-abi
parent3ac9c1988ce3894358810a8f12748dabdfce9070 (diff)
downloadqpid-python-e6487931879d9479080dba5ae1126fbb8397dd11.tar.gz
QPID-5079: Add script to compare symbols exported by library with expected list
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1516552 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/check-abi')
-rwxr-xr-xqpid/cpp/src/check-abi48
1 files changed, 48 insertions, 0 deletions
diff --git a/qpid/cpp/src/check-abi b/qpid/cpp/src/check-abi
new file mode 100755
index 0000000000..6742ce8253
--- /dev/null
+++ b/qpid/cpp/src/check-abi
@@ -0,0 +1,48 @@
+#! /bin/bash
+
+rc=0
+syms_desired=$(mktemp)
+syms_library=$(mktemp)
+syms_missing=$(mktemp)
+syms_extra=$(mktemp)
+
+trap 'rm $syms_desired $syms_library $syms_missing $syms_extra' EXIT
+
+# Extract exported symbols from library
+nm -DC --defined-only -f s $1 | cut -f1 -d'|' -s | sort -u > $syms_library
+
+# Process API syms (substitute in some typedefs etc.)
+sed $2 -e '
+ s/uint64_t/unsigned long/
+ s/uint32_t/unsigned int/
+ s/uint16_t/unsigned short/
+ s/uint8_t/unsigned char/
+ s/size_t/unsigned long/
+ s/int64_t/long/
+ s/int32_t/int/
+ s/int16_t/short/
+ s/int8_t/signed char/
+ s/qpid::types::Variant::Map/std::map<std::string, qpid::types::Variant, std::less<std::string>, std::allocator<std::pair<std::string const, qpid::types::Variant> > >/
+ s/qpid::types::Variant::List/std::list<qpid::types::Variant, std::allocator<qpid::types::Variant> >/
+ /^$/d
+ /^#.*$/d
+' | sort -u > $syms_desired
+
+comm -23 $syms_desired $syms_library > $syms_missing
+comm -13 $syms_desired $syms_library > $syms_extra
+
+if [ -n "$(cat $syms_missing)" ] ; then
+ (echo "Not exported from library (should be)"
+ echo "====================================="
+ cat $syms_missing ) 1>&2
+ rc=1
+fi
+
+
+if [ -n "$(cat $syms_extra)" ]; then
+ (echo "Exported by library but not in spec"
+ echo "==================================="
+ cat $syms_extra ) 1>&2
+fi
+
+exit $rc