Add check for internal symbols
authorBehdad Esfahbod <behdad@behdad.org>
Thu, 13 May 2010 03:28:38 +0000 (23:28 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Thu, 13 May 2010 03:28:38 +0000 (23:28 -0400)
src/Makefile.am
src/check-internal-symbols.sh [new file with mode: 0755]

index 9c534a6..f52ea49 100644 (file)
@@ -99,7 +99,8 @@ main_SOURCES = main.cc
 main_CPPFLAGS = $(HBCFLAGS)
 main_LDADD = libharfbuzz.la $(HBLIBS)
 
-TESTS =
+TESTS = \
+       check-internal-symbols.sh
 
 if HAVE_ICU
 else
diff --git a/src/check-internal-symbols.sh b/src/check-internal-symbols.sh
new file mode 100755 (executable)
index 0000000..7558518
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+LC_ALL=C
+export LC_ALL
+
+if which nm 2>/dev/null >/dev/null; then
+       :
+else
+       echo "check-internal-symbols.sh: 'nm' not found; skipping test"
+       exit 0
+fi
+
+test -z "$srcdir" && srcdir=.
+test -z "$MAKE" && MAKE=make
+stat=0
+
+so=.libs/libharfbuzz.so
+if test -f "$so"; then
+       echo "Checking that we are exposing internal symbols"
+       if nm $so | grep ' T _hb'; then
+               echo "Ouch, internal symbols exposed"
+               stat=1
+       fi
+else
+       echo "check-internal-symbols.sh: libharfbuzz.so not found; skipping test"
+fi
+
+exit $stat