test: renamed test scripts to format T\d\d\d-name.sh
[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 http://gcc.gnu.org/wiki/Visibility'
9
10 test_description='exception symbol hiding'
11
12 . ./test-lib.sh
13
14 run_test(){
15     result=$(LD_LIBRARY_PATH="$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" $TEST_DIRECTORY/symbol-test 2>&1)
16 }
17
18 output="A Xapian exception occurred opening database: Couldn't stat 'fakedb/.notmuch/xapian'
19 caught No chert database found at path \`./nonexistant'"
20
21 mkdir -p fakedb/.notmuch
22
23 test_expect_success 'running test' run_test
24
25 test_begin_subtest 'checking output'
26 test_expect_equal "$result" "$output"
27
28 test_begin_subtest 'comparing existing to exported symbols'
29 objdump -t $TEST_DIRECTORY/../lib/*.o | awk '$4 == ".text" && $6 ~ "^notmuch" {print $6}' | sort | uniq > ACTUAL
30 sed -n 's/[[:blank:]]*\(notmuch_[^;]*\);/\1/p' $TEST_DIRECTORY/../notmuch.sym | sort | uniq > EXPORTED
31 test_expect_equal_file EXPORTED ACTUAL
32
33 test_done