]> git.notmuchmail.org Git - notmuch/blob - test/T360-symbol-hiding.sh
emacs: Add new option notmuch-search-hide-excluded
[notmuch] / 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 if [ -n "${NOTMUCH_TEST_INSTALLED-}" ]; then
15     test_done
16 fi
17
18 test_begin_subtest 'running test' run_test
19 mkdir -p ${PWD}/fakedb/.notmuch
20 $TEST_DIRECTORY/symbol-test ${PWD}/fakedb ${PWD}/nonexistent 2>&1 \
21         | notmuch_dir_sanitize | sed -e "s,\`,\',g" -e "s,No [^[:space:]]* database,No XXXXXX database,g" > OUTPUT
22
23 cat <<EOF > EXPECTED
24 Cannot open Xapian database at CWD/fakedb/.notmuch/xapian: Couldn't stat 'CWD/fakedb/.notmuch/xapian'
25 caught No XXXXXX database found at path 'CWD/nonexistent'
26 EOF
27 test_expect_equal_file EXPECTED OUTPUT
28
29 test_begin_subtest 'checking output'
30 test_expect_equal "$result" "$output"
31
32 test_begin_subtest 'comparing existing to exported symbols'
33 readelf -Ws $NOTMUCH_BUILDDIR/lib/libnotmuch.so | sed -e 's/\[[^]]*\]//' |\
34     awk '$4 == "FUNC" && $5 == "GLOBAL" && $7 != "UND" {print $8}' | sort -u > ACTUAL
35 sed -n 's/^\(notmuch_[a-zA-Z0-9_]*\)[[:blank:]]*(.*/\1/p' $NOTMUCH_SRCDIR/lib/notmuch.h | sort -u > EXPORTED
36 test_expect_equal_file EXPORTED ACTUAL
37
38 test_done