From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [PATCH 3/4] configure: add test for default xapian backend
Date: Fri, 8 Apr 2016 22:49:49 -0300 [thread overview]
Message-ID: <1460166590-6526-4-git-send-email-david@tethera.net> (raw)
In-Reply-To: <1460166590-6526-1-git-send-email-david@tethera.net>
This is mainly for the test suite. We already expect the tests to be
run in the same environment as configure was run, at least to get the
name of the python interpreter. So we are not really imposing a new
restriction.
---
configure | 26 +++++++++++++++++++++++++-
test/test-lib.sh | 11 +++++++++++
2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
index eb6dbac..4fc31cc 100755
--- a/configure
+++ b/configure
@@ -371,7 +371,25 @@ if [ ${have_xapian} = "1" ]; then
esac
fi
-
+default_xapian_backend=""
+if [ ${have_xapian} = "1" ]; then
+ printf "Testing default Xapian backend... "
+ cat >_default_backend.cc <<EOF
+#include <xapian.h>
+int main(int argc, char** argv) {
+ Xapian::WritableDatabase db("test.db",Xapian::DB_CREATE_OR_OPEN);
+}
+EOF
+ ${CXX} ${CXXLAGS} ${xapian_cxxflags} _default_backend.cc -o _default_backend ${xapian_ldflags}
+ ./_default_backend
+ if [ -f test.db/iamglass ]; then
+ default_xapian_backend=glass
+ else
+ default_xapian_backend=chert
+ fi
+ printf "${default_xapian_backend}\n";
+ rm -rf test.db _default_backend _default_backend.cc
+fi
# we need to have a version >= 2.6.5 to avoid a crypto bug. We need
# 2.6.7 for permissive "From " header handling.
GMIME_MINVER=2.6.7
@@ -1001,6 +1019,9 @@ LINKER_RESOLVES_LIBRARY_DEPENDENCIES = ${linker_resolves_library_dependencies}
XAPIAN_CXXFLAGS = ${xapian_cxxflags}
XAPIAN_LDFLAGS = ${xapian_ldflags}
+# Which backend will Xapian use by default?
+DEFAULT_XAPIAN_BACKEND = ${default_xapian_backend}
+
# Flags needed to compile and link against GMime
GMIME_CFLAGS = ${gmime_cflags}
GMIME_LDFLAGS = ${gmime_ldflags}
@@ -1077,6 +1098,9 @@ cat > sh.config <<EOF
# Whether the Xapian version in use supports compaction
NOTMUCH_HAVE_XAPIAN_COMPACT=${have_xapian_compact}
+# Which backend will Xapian use by default?
+NOTMUCH_DEFAULT_XAPIAN_BACKEND=${default_xapian_backend}
+
# do we have man pages?
NOTMUCH_HAVE_MAN=$((have_sphinx))
diff --git a/test/test-lib.sh b/test/test-lib.sh
index cc08a98..ac04b15 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -1327,6 +1327,17 @@ test -z "$NO_PYTHON" && test_set_prereq PYTHON
ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS
rm -f y
+# convert variable from configure to more convenient form
+case "$NOTMUCH_DEFAULT_XAPIAN_BACKEND" in
+ glass)
+ db_ending=glass
+ ;;
+ chert)
+ db_ending=DB
+ ;;
+ *)
+ error "Unknown Xapian backend $NOTMUCH_DEFAULT_XAPIAN_BACKEND"
+esac
# declare prerequisites for external binaries used in tests
test_declare_external_prereq dtach
test_declare_external_prereq emacs
--
2.8.0.rc3
next prev parent reply other threads:[~2016-04-09 1:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-09 1:49 xapian 1.3.5 compatibility, v3 David Bremner
2016-04-09 1:49 ` [PATCH 1/4] test: improve error handling in lib-error tests David Bremner
2016-04-09 1:49 ` [PATCH 2/4] test/atomicity: guard chert-only optimization David Bremner
2016-04-09 1:49 ` David Bremner [this message]
2016-04-09 1:49 ` [PATCH 4/4] test: cope with glass backend file naming variations David Bremner
2016-04-09 21:00 ` Tomi Ollila
2016-04-09 22:36 ` David Bremner
2016-04-12 18:46 ` Tomi Ollila
2016-04-12 23:34 ` David Bremner
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=1460166590-6526-4-git-send-email-david@tethera.net \
--to=david@tethera.net \
--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).