From fba968dbfa806dc517fc55d1f28cf208f0316863 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Wed, 22 Jun 2011 08:58:01 -0300 Subject: tests: add a test for symbol hiding side effects The worry here is that a binary linking with libnotmuch might lose access to Xapian::Error symbols because libnotmuch hides them. We are careful here to create ./fakedb/.notmuch in order to trigger a Xapian exception, and not just a missing file check. Thanks to jrollins and amddragon for suggestions. (cherry picked from commit 66f37f5f6864a988f94ddb893e3a176af57f6c8e) --- test/symbol-hiding | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 test/symbol-hiding (limited to 'test/symbol-hiding') diff --git a/test/symbol-hiding b/test/symbol-hiding new file mode 100755 index 00000000..bb555245 --- /dev/null +++ b/test/symbol-hiding @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2011 David Bremner +# + +# This test tests whether hiding Xapian::Error symbols in libnotmuch +# also hides them for other users of libxapian. This is motivated by +# the discussion in http://gcc.gnu.org/wiki/Visibility' + +test_description='exception symbol hiding' + +. ./test-lib.sh + +run_test(){ + result=$(LD_LIBRARY_PATH=../../lib ./symbol-test 2>&1) +} + +output="A Xapian exception occurred opening database: Couldn't stat 'fakedb/.notmuch/xapian' +caught No chert database found at path \`./nonexistant'" + +g++ -o symbol-test -I../../lib ../symbol-test.cc -L../../lib -lnotmuch -lxapian +mkdir -p fakedb/.notmuch +test_expect_success 'running test' run_test +test_begin_subtest 'checking output' +test_expect_equal "$result" "$output" +test_done -- cgit v1.2.3