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-test.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test/symbol-test.cc (limited to 'test/symbol-test.cc') diff --git a/test/symbol-test.cc b/test/symbol-test.cc new file mode 100644 index 00000000..1de06eae --- /dev/null +++ b/test/symbol-test.cc @@ -0,0 +1,17 @@ +#include +#include +#include +main (int argc, char **argv){ + + notmuch_database_t *notmuch + = notmuch_database_open ("fakedb", + NOTMUCH_DATABASE_MODE_READ_ONLY); + + try{ + (void)new Xapian::WritableDatabase ("./nonexistant", Xapian::DB_OPEN); + } catch (const Xapian::Error &error) { + printf("caught %s\n",error.get_msg().c_str()); + return 0; + } + return 1; +} -- cgit v1.2.3