]> git.cworth.org Git - notmuch-old/blob - test/T360-symbol-hiding.sh
notmuch (0.28.2-1) unstable; urgency=medium
[notmuch-old] / test / T360-symbol-hiding.sh
1 #!/usr/bin/env bash
2 #
3 # Copyright (c) 2011 David Bremner
4 #
5
6 # This test tests whether hiding Xapian::Error symbols in libnotmuch
7 # also hides them for other users of libxapian. This is motivated by
8 # the discussion in https://gcc.gnu.org/wiki/Visibility'
9
10 test_description='exception symbol hiding'
11
12 . $(dirname "$0")/test-lib.sh || exit 1
13
14 test_begin_subtest 'running test' run_test
15 mkdir -p ${PWD}/fakedb/.notmuch
16 $TEST_DIRECTORY/symbol-test ${PWD}/fakedb ${PWD}/nonexistent 2>&1 \
17         | notmuch_dir_sanitize | sed -e "s,\`,\',g" -e "s,${NOTMUCH_DEFAULT_XAPIAN_BACKEND},backend,g" > OUTPUT
18
19 cat <<EOF > EXPECTED
20 A Xapian exception occurred opening database: Couldn't stat 'CWD/fakedb/.notmuch/xapian'
21 caught No backend database found at path 'CWD/nonexistent'
22 EOF
23 test_expect_equal_file EXPECTED OUTPUT
24
25 test_begin_subtest 'checking output'
26 test_expect_equal "$result" "$output"
27
28 test_begin_subtest 'comparing existing to exported symbols'
29 nm -P $NOTMUCH_BUILDDIR/lib/libnotmuch.so | awk '$2 == "T" && $1 ~ "^notmuch" {print $1}' | sort | uniq > ACTUAL
30 sed -n 's/^\(notmuch_[a-zA-Z0-9_]*\)[[:blank:]]*(.*/\1/p' $NOTMUCH_SRCDIR/lib/notmuch.h | sort | uniq > EXPORTED
31 test_expect_equal_file EXPORTED ACTUAL
32
33 test_done