1 Return-Path: <bremner@tethera.net>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 391C3431FD0
\r
6 for <notmuch@notmuchmail.org>; Wed, 22 Jun 2011 05:02:56 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id 5m3MiZV+gfDY for <notmuch@notmuchmail.org>;
\r
16 Wed, 22 Jun 2011 05:02:54 -0700 (PDT)
\r
17 Received: from tempo.its.unb.ca (tempo.its.unb.ca [131.202.1.21])
\r
18 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 81287431FB6
\r
21 for <notmuch@notmuchmail.org>; Wed, 22 Jun 2011 05:02:54 -0700 (PDT)
\r
22 Received: from zancas.localnet
\r
23 (fctnnbsc30w-142167176081.pppoe-dynamic.High-Speed.nb.bellaliant.net
\r
24 [142.167.176.81]) (authenticated bits=0)
\r
25 by tempo.its.unb.ca (8.13.8/8.13.8) with ESMTP id p5MC2nS7031945
\r
26 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO);
\r
27 Wed, 22 Jun 2011 09:02:50 -0300
\r
28 Received: from bremner by zancas.localnet with local (Exim 4.76)
\r
29 (envelope-from <bremner@tethera.net>)
\r
30 id 1QZM8u-0004ip-Vw; Wed, 22 Jun 2011 09:02:48 -0300
\r
31 From: david@tethera.net
\r
32 To: notmuch@notmuchmail.org
\r
33 Subject: [PATCH] tests: add a test for symbol hiding side effects
\r
34 Date: Wed, 22 Jun 2011 09:02:36 -0300
\r
35 Message-Id: <1308744156-18123-1-git-send-email-david@tethera.net>
\r
36 X-Mailer: git-send-email 1.7.5.3
\r
37 In-Reply-To: <87tybir2s9.fsf@zancas.localnet>
\r
38 References: <87tybir2s9.fsf@zancas.localnet>
\r
39 Cc: David Bremner <bremner@debian.org>
\r
40 X-BeenThere: notmuch@notmuchmail.org
\r
41 X-Mailman-Version: 2.1.13
\r
43 List-Id: "Use and development of the notmuch mail system."
\r
44 <notmuch.notmuchmail.org>
\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
48 List-Post: <mailto:notmuch@notmuchmail.org>
\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
51 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
52 X-List-Received-Date: Wed, 22 Jun 2011 12:02:56 -0000
\r
54 From: David Bremner <bremner@debian.org>
\r
56 The worry here is that a binary linking with libnotmuch might lose
\r
57 access to Xapian::Error symbols because libnotmuch hides them.
\r
60 test/notmuch-test | 1 +
\r
61 test/symbol-hiding | 21 +++++++++++++++++++++
\r
62 test/symbol-test.cc | 17 +++++++++++++++++
\r
63 4 files changed, 40 insertions(+), 1 deletions(-)
\r
64 create mode 100755 test/symbol-hiding
\r
65 create mode 100644 test/symbol-test.cc
\r
67 diff --git a/test/basic b/test/basic
\r
68 index 808c968..d6e8c10 100755
\r
71 @@ -56,7 +56,7 @@ tests_in_suite=$(for i in $TESTS; do echo $i; done | sort)
\r
72 available=$(ls -1 ../ | \
\r
73 sed -r -e "/^(aggregate-results.sh|Makefile|Makefile.local|notmuch-test)/d" \
\r
74 -e "/^(README|test-lib.sh|test-lib.el|test-results|tmp.*|valgrind|corpus*)/d" \
\r
75 - -e "/^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose)/d" \
\r
76 + -e "/^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose|symbol-test.cc)/d" \
\r
77 -e "/^(test.expected-output|.*~)/d" \
\r
78 -e "/^(gnupg-secret-key.asc)/d" \
\r
79 -e "/^(gnupg-secret-key.NOTE)/d" \
\r
80 diff --git a/test/notmuch-test b/test/notmuch-test
\r
81 index 83f284d..fe85c6a 100755
\r
82 --- a/test/notmuch-test
\r
83 +++ b/test/notmuch-test
\r
84 @@ -40,6 +40,7 @@ TESTS="
\r
85 emacs-large-search-buffer
\r
90 TESTS=${NOTMUCH_TESTS:=$TESTS}
\r
92 diff --git a/test/symbol-hiding b/test/symbol-hiding
\r
93 new file mode 100755
\r
94 index 0000000..1c1f34e
\r
96 +++ b/test/symbol-hiding
\r
98 +#!/usr/bin/env bash
\r
100 +# Copyright (c) 2011 David Bremner
\r
103 +test_description='exception symbol test
\r
105 +This test tests whether hiding Xapian::Error symbols in libnotmuch
\r
106 +also hides them for other users of libxapian. This is motivated by
\r
107 +the discussion in http://gcc.gnu.org/wiki/Visibility'
\r
111 +output="Error opening database at /nonexistant/.notmuch: No such file or directory
\r
112 +caught No chert database found at path \`/nonexistant'"
\r
114 +g++ -o symbol-test ../symbol-test.cc -L../lib -lnotmuch -lxapian
\r
115 +test_expect_success "$message" ./symbol-test
\r
119 diff --git a/test/symbol-test.cc b/test/symbol-test.cc
\r
120 new file mode 100644
\r
121 index 0000000..f077845
\r
123 +++ b/test/symbol-test.cc
\r
125 +#include <stdio.h>
\r
126 +#include <xapian.h>
\r
127 +#include <notmuch.h>
\r
128 +main (int argc, char **argv){
\r
130 + notmuch_database_t *notmuch
\r
131 + = notmuch_database_open ("/nonexistant",
\r
132 + NOTMUCH_DATABASE_MODE_READ_ONLY);
\r
135 + (void)new Xapian::WritableDatabase ("/nonexistant",
\r
136 + Xapian::DB_OPEN);
\r
137 + } catch (const Xapian::Error &error) {
\r
138 + printf("caught %s\n",error.get_msg().c_str());
\r