Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 391C3431FD0 for ; Wed, 22 Jun 2011 05:02:56 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.3 X-Spam-Level: X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5m3MiZV+gfDY for ; Wed, 22 Jun 2011 05:02:54 -0700 (PDT) Received: from tempo.its.unb.ca (tempo.its.unb.ca [131.202.1.21]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 81287431FB6 for ; Wed, 22 Jun 2011 05:02:54 -0700 (PDT) Received: from zancas.localnet (fctnnbsc30w-142167176081.pppoe-dynamic.High-Speed.nb.bellaliant.net [142.167.176.81]) (authenticated bits=0) by tempo.its.unb.ca (8.13.8/8.13.8) with ESMTP id p5MC2nS7031945 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Wed, 22 Jun 2011 09:02:50 -0300 Received: from bremner by zancas.localnet with local (Exim 4.76) (envelope-from ) id 1QZM8u-0004ip-Vw; Wed, 22 Jun 2011 09:02:48 -0300 From: david@tethera.net To: notmuch@notmuchmail.org Subject: [PATCH] tests: add a test for symbol hiding side effects Date: Wed, 22 Jun 2011 09:02:36 -0300 Message-Id: <1308744156-18123-1-git-send-email-david@tethera.net> X-Mailer: git-send-email 1.7.5.3 In-Reply-To: <87tybir2s9.fsf@zancas.localnet> References: <87tybir2s9.fsf@zancas.localnet> Cc: David Bremner X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jun 2011 12:02:56 -0000 From: David Bremner 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 +#include +#include +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