From: david@tethera.net
To: notmuch@notmuchmail.org
Cc: David Bremner <bremner@debian.org>
Subject: [PATCH] tests: add a test for symbol hiding side effects
Date: Wed, 22 Jun 2011 09:02:36 -0300 [thread overview]
Message-ID: <1308744156-18123-1-git-send-email-david@tethera.net> (raw)
In-Reply-To: <87tybir2s9.fsf@zancas.localnet>
From: David Bremner <bremner@debian.org>
The worry here is that a binary linking with libnotmuch might lose
access to Xapian::Error symbols because libnotmuch hides them.
---
test/basic | 2 +-
test/notmuch-test | 1 +
test/symbol-hiding | 21 +++++++++++++++++++++
test/symbol-test.cc | 17 +++++++++++++++++
4 files changed, 40 insertions(+), 1 deletions(-)
create mode 100755 test/symbol-hiding
create mode 100644 test/symbol-test.cc
diff --git a/test/basic b/test/basic
index 808c968..d6e8c10 100755
--- a/test/basic
+++ b/test/basic
@@ -56,7 +56,7 @@ tests_in_suite=$(for i in $TESTS; do echo $i; done | sort)
available=$(ls -1 ../ | \
sed -r -e "/^(aggregate-results.sh|Makefile|Makefile.local|notmuch-test)/d" \
-e "/^(README|test-lib.sh|test-lib.el|test-results|tmp.*|valgrind|corpus*)/d" \
- -e "/^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose)/d" \
+ -e "/^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose|symbol-test.cc)/d" \
-e "/^(test.expected-output|.*~)/d" \
-e "/^(gnupg-secret-key.asc)/d" \
-e "/^(gnupg-secret-key.NOTE)/d" \
diff --git a/test/notmuch-test b/test/notmuch-test
index 83f284d..fe85c6a 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -40,6 +40,7 @@ TESTS="
emacs-large-search-buffer
maildir-sync
crypto
+ symbol-hiding
"
TESTS=${NOTMUCH_TESTS:=$TESTS}
diff --git a/test/symbol-hiding b/test/symbol-hiding
new file mode 100755
index 0000000..1c1f34e
--- /dev/null
+++ b/test/symbol-hiding
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+#
+# Copyright (c) 2011 David Bremner
+#
+
+test_description='exception symbol test
+
+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-lib.sh
+
+output="Error opening database at /nonexistant/.notmuch: No such file or directory
+caught No chert database found at path \`/nonexistant'"
+
+g++ -o symbol-test ../symbol-test.cc -L../lib -lnotmuch -lxapian
+test_expect_success "$message" ./symbol-test
+test_done
+
+
diff --git a/test/symbol-test.cc b/test/symbol-test.cc
new file mode 100644
index 0000000..f077845
--- /dev/null
+++ b/test/symbol-test.cc
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <xapian.h>
+#include <notmuch.h>
+main (int argc, char **argv){
+
+ notmuch_database_t *notmuch
+ = notmuch_database_open ("/nonexistant",
+ 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;
+}
--
1.7.5.3
next prev parent reply other threads:[~2011-06-22 12:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-22 1:08 david
2011-06-22 1:08 ` [PATCH 1/2] libnotmuch: add linker script to declare only notmuch_* symbols as global david
2011-06-22 1:08 ` [PATCH 2/2] remove Xapian exceptions symbols from libnotmuch1.symbols david
2011-06-22 2:05 ` hiding xapian symbols Daniel Kahn Gillmor
2011-06-22 2:57 ` David Bremner
2011-06-22 12:02 ` david [this message]
2011-06-23 10:24 ` [PATCH] tests: add a test for symbol hiding side effects David Bremner
2011-06-23 22:26 ` Carl Worth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1308744156-18123-1-git-send-email-david@tethera.net \
--to=david@tethera.net \
--cc=bremner@debian.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).