]> git.cworth.org Git - notmuch-old/blob - test/T360-symbol-hiding.sh
test: cope with glass backend file naming variations
[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 http://gcc.gnu.org/wiki/Visibility'
9
10 test_description='exception symbol hiding'
11
12 . ./test-lib.sh || exit 1
13
14 test_begin_subtest 'running test' run_test
15 mkdir -p ${PWD}/fakedb/.notmuch
16 ( LD_LIBRARY_PATH="$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" \
17                  $TEST_DIRECTORY/symbol-test ${PWD}/fakedb ${PWD}/nonexistent \
18                  2>&1 | notmuch_dir_sanitize | sed -e "s,\`,\',g" -e "s,${NOTMUCH_DEFAULT_XAPIAN_BACKEND},backend,g") > OUTPUT
19
20 cat <<EOF > EXPECTED
21 A Xapian exception occurred opening database: Couldn't stat 'CWD/fakedb/.notmuch/xapian'
22 caught No backend database found at path 'CWD/nonexistent'
23 EOF
24 test_expect_equal_file EXPECTED OUTPUT
25
26 test_begin_subtest 'checking output'
27 test_expect_equal "$result" "$output"
28
29 test_begin_subtest 'comparing existing to exported symbols'
30 nm -P $TEST_DIRECTORY/../lib/libnotmuch.so | awk '$2 == "T" && $1 ~ "^notmuch" {print $1}' | sort | uniq > ACTUAL
31 sed -n 's/[[:blank:]]*\(notmuch_[^;]*\);/\1/p' $TEST_DIRECTORY/../notmuch.sym | sort | uniq > EXPORTED
32 test_expect_equal_file EXPORTED ACTUAL
33
34 test_done