]> git.cworth.org Git - notmuch-old/blob - test/T360-symbol-hiding.sh
Merge remote-tracking branch 'origin/debian/bullseye' into release
[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,No [^[:space:]]* database,No XXXXXX database,g" > OUTPUT
18
19 cat <<EOF > EXPECTED
20 Cannot open Xapian database at CWD/fakedb/.notmuch/xapian: Couldn't stat 'CWD/fakedb/.notmuch/xapian'
21 caught No XXXXXX 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 readelf -Ws $NOTMUCH_BUILDDIR/lib/libnotmuch.so | sed -e 's/\[[^]]*\]//' |\
30     awk '$4 == "FUNC" && $5 == "GLOBAL" && $7 != "UND" {print $8}' | sort -u > ACTUAL
31 sed -n 's/^\(notmuch_[a-zA-Z0-9_]*\)[[:blank:]]*(.*/\1/p' $NOTMUCH_SRCDIR/lib/notmuch.h | sort -u > EXPORTED
32 test_expect_equal_file EXPORTED ACTUAL
33
34 test_done