* xapian 1.3.5 compatibility, v3
@ 2016-04-09 1:49 David Bremner
2016-04-09 1:49 ` [PATCH 1/4] test: improve error handling in lib-error tests David Bremner
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: David Bremner @ 2016-04-09 1:49 UTC (permalink / raw)
To: notmuch
Tomi convinced me (with his review of my previous attempt) to go the
route of testing the default xapian backend once in configure, and
using that variable elsewhere.
This obsoletes the series(s)
id:1459855082-5715-2-git-send-email-david@tethera.net
id:1459938431-28670-2-git-send-email-david@tethera.net
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/4] test: improve error handling in lib-error tests
2016-04-09 1:49 xapian 1.3.5 compatibility, v3 David Bremner
@ 2016-04-09 1:49 ` David Bremner
2016-04-09 1:49 ` [PATCH 2/4] test/atomicity: guard chert-only optimization David Bremner
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: David Bremner @ 2016-04-09 1:49 UTC (permalink / raw)
To: notmuch
There is at least one bug fixed here (missing parameter to printf), even
if exiting via segfault is considered OK.
---
test/T560-lib-error.sh | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh
index 59a479c..49d3674 100755
--- a/test/T560-lib-error.sh
+++ b/test/T560-lib-error.sh
@@ -202,16 +202,20 @@ int main (int argc, char** argv)
notmuch_database_t *db;
notmuch_status_t stat;
char *path;
+ char *msg = NULL;
int fd;
- stat = notmuch_database_open (argv[1], NOTMUCH_DATABASE_MODE_READ_WRITE, &db);
+ stat = notmuch_database_open_verbose (argv[1], NOTMUCH_DATABASE_MODE_READ_WRITE, &db, &msg);
if (stat != NOTMUCH_STATUS_SUCCESS) {
- fprintf (stderr, "error opening database: %d\n", stat);
+ fprintf (stderr, "error opening database: %d %s\n", stat, msg ? msg : "");
+ exit (1);
}
path = talloc_asprintf (db, "%s/.notmuch/xapian/postlist.DB", argv[1]);
fd = open(path,O_WRONLY|O_TRUNC);
- if (fd < 0)
- fprintf (stderr, "error opening %s\n");
+ if (fd < 0) {
+ fprintf (stderr, "error opening %s\n", argv[1]);
+ exit (1);
+ }
EOF
cat <<'EOF' > c_tail
if (stat) {
--
2.8.0.rc3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/4] test/atomicity: guard chert-only optimization
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 ` David Bremner
2016-04-09 1:49 ` [PATCH 3/4] configure: add test for default xapian backend David Bremner
2016-04-09 1:49 ` [PATCH 4/4] test: cope with glass backend file naming variations David Bremner
3 siblings, 0 replies; 9+ messages in thread
From: David Bremner @ 2016-04-09 1:49 UTC (permalink / raw)
To: notmuch
This should potentially be updated to have an equivalent optimization
for the glass backend, but it in my unscientific tests, the glass backend
without the optimization is faster then the chert backend with.
---
test/atomicity.py | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/test/atomicity.py b/test/atomicity.py
index 01a4205..1ca52b9 100644
--- a/test/atomicity.py
+++ b/test/atomicity.py
@@ -29,16 +29,19 @@ class RenameBreakpoint(gdb.Breakpoint):
self.n = 0
def stop(self):
- # As an optimization, only consider snapshots after a Xapian
- # has really committed. Xapian overwrites record.base? as the
- # last step in the commit, so keep an eye on their inumbers.
- inodes = {}
- for path in glob.glob('%s/.notmuch/xapian/record.base*' % maildir):
- inodes[path] = os.stat(path).st_ino
- if inodes == self.last_inodes:
- # Continue
- return False
- self.last_inodes = inodes
+ xapiandir = '%s/.notmuch/xapian' % maildir
+ if os.path.isfile('%s/iamchert' % xapiandir):
+ # As an optimization, only consider snapshots after a
+ # Xapian has really committed. The chert backend
+ # overwrites record.base? as the last step in the commit,
+ # so keep an eye on their inumbers.
+ inodes = {}
+ for path in glob.glob('%s/record.base*' % xapiandir):
+ inodes[path] = os.stat(path).st_ino
+ if inodes == self.last_inodes:
+ # Continue
+ return False
+ self.last_inodes = inodes
# Save a backtrace in case the test does fail
backtrace = gdb.execute('backtrace', to_string=True)
--
2.8.0.rc3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/4] configure: add test for default xapian backend
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
2016-04-09 1:49 ` [PATCH 4/4] test: cope with glass backend file naming variations David Bremner
3 siblings, 0 replies; 9+ messages in thread
From: David Bremner @ 2016-04-09 1:49 UTC (permalink / raw)
To: notmuch
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/4] test: cope with glass backend file naming variations
2016-04-09 1:49 xapian 1.3.5 compatibility, v3 David Bremner
` (2 preceding siblings ...)
2016-04-09 1:49 ` [PATCH 3/4] configure: add test for default xapian backend David Bremner
@ 2016-04-09 1:49 ` David Bremner
2016-04-09 21:00 ` Tomi Ollila
3 siblings, 1 reply; 9+ messages in thread
From: David Bremner @ 2016-04-09 1:49 UTC (permalink / raw)
To: notmuch
In several places in the test suite we intentionally corrupt the Xapian
database in order to test error handling. This corruption is specific to
the on-disk organization of the database, and that changed with the
glass backend. We use the previously computed default backend to make
the tests adapt to changing names.
---
test/T050-new.sh | 2 +-
test/T060-count.sh | 4 ++--
test/T150-tagging.sh | 4 ++--
test/T360-symbol-hiding.sh | 4 ++--
test/T560-lib-error.sh | 4 ++--
5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/test/T050-new.sh b/test/T050-new.sh
index 93a6fa9..df9e89a 100755
--- a/test/T050-new.sh
+++ b/test/T050-new.sh
@@ -284,7 +284,7 @@ notmuch config set new.tags $OLDCONFIG
test_begin_subtest "Xapian exception: read only files"
-chmod u-w ${MAIL_DIR}/.notmuch/xapian/*.DB
+chmod u-w ${MAIL_DIR}/.notmuch/xapian/*.${db_ending}
output=$(NOTMUCH_NEW --debug 2>&1 | sed 's/: .*$//' )
chmod u+w ${MAIL_DIR}/.notmuch/xapian/*.DB
test_expect_equal "$output" "A Xapian exception occurred opening database"
diff --git a/test/T060-count.sh b/test/T060-count.sh
index 3fec94e..0ac8314 100755
--- a/test/T060-count.sh
+++ b/test/T060-count.sh
@@ -95,7 +95,7 @@ test_expect_equal_file EXPECTED OUTPUT
backup_database
test_begin_subtest "error message for database open"
-dd if=/dev/zero of="${MAIL_DIR}/.notmuch/xapian/postlist.DB" count=3
+dd if=/dev/zero of="${MAIL_DIR}/.notmuch/xapian/postlist.${db_ending}" count=3
notmuch count '*' 2>OUTPUT 1>/dev/null
output=$(sed 's/^\(A Xapian exception [^:]*\):.*$/\1/' OUTPUT)
test_expect_equal "${output}" "A Xapian exception occurred opening database"
@@ -105,7 +105,7 @@ cat <<EOF > count-files.gdb
set breakpoint pending on
break count_files
commands
-shell cp /dev/null ${MAIL_DIR}/.notmuch/xapian/postlist.DB
+shell cp /dev/null ${MAIL_DIR}/.notmuch/xapian/postlist.${db_ending}
continue
end
run
diff --git a/test/T150-tagging.sh b/test/T150-tagging.sh
index 8adcabc..6fd6a18 100755
--- a/test/T150-tagging.sh
+++ b/test/T150-tagging.sh
@@ -287,9 +287,9 @@ test_expect_code 1 "Empty tag names" 'notmuch tag + One'
test_expect_code 1 "Tag name beginning with -" 'notmuch tag +- One'
test_begin_subtest "Xapian exception: read only files"
-chmod u-w ${MAIL_DIR}/.notmuch/xapian/*.DB
+chmod u-w ${MAIL_DIR}/.notmuch/xapian/*.${db_ending}
output=$(notmuch tag +something '*' 2>&1 | sed 's/: .*$//' )
-chmod u+w ${MAIL_DIR}/.notmuch/xapian/*.DB
+chmod u+w ${MAIL_DIR}/.notmuch/xapian/{*.DB,*.glass}
test_expect_equal "$output" "A Xapian exception occurred opening database"
test_done
diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh
index 89e7f16..3f18ec1 100755
--- a/test/T360-symbol-hiding.sh
+++ b/test/T360-symbol-hiding.sh
@@ -15,11 +15,11 @@ test_begin_subtest 'running test' run_test
mkdir -p ${PWD}/fakedb/.notmuch
( LD_LIBRARY_PATH="$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" \
$TEST_DIRECTORY/symbol-test ${PWD}/fakedb ${PWD}/nonexistent \
- 2>&1 | notmuch_dir_sanitize | sed "s,\`,\',g") > OUTPUT
+ 2>&1 | notmuch_dir_sanitize | sed -e "s,\`,\',g" -e "s,${NOTMUCH_DEFAULT_XAPIAN_BACKEND},backend,g") > OUTPUT
cat <<EOF > EXPECTED
A Xapian exception occurred opening database: Couldn't stat 'CWD/fakedb/.notmuch/xapian'
-caught No chert database found at path 'CWD/nonexistent'
+caught No backend database found at path 'CWD/nonexistent'
EOF
test_expect_equal_file EXPECTED OUTPUT
diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh
index 49d3674..087c6bd 100755
--- a/test/T560-lib-error.sh
+++ b/test/T560-lib-error.sh
@@ -189,7 +189,7 @@ Path already exists: MAIL_DIR
EOF
test_expect_equal_file EXPECTED OUTPUT
-cat <<'EOF' > c_head
+cat <<EOF > c_head
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -210,7 +210,7 @@ int main (int argc, char** argv)
fprintf (stderr, "error opening database: %d %s\n", stat, msg ? msg : "");
exit (1);
}
- path = talloc_asprintf (db, "%s/.notmuch/xapian/postlist.DB", argv[1]);
+ path = talloc_asprintf (db, "%s/.notmuch/xapian/postlist.${db_ending}", argv[1]);
fd = open(path,O_WRONLY|O_TRUNC);
if (fd < 0) {
fprintf (stderr, "error opening %s\n", argv[1]);
--
2.8.0.rc3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 4/4] test: cope with glass backend file naming variations
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
0 siblings, 2 replies; 9+ messages in thread
From: Tomi Ollila @ 2016-04-09 21:00 UTC (permalink / raw)
To: David Bremner, notmuch
On Sat, Apr 09 2016, David Bremner <david@tethera.net> wrote:
> ...
> diff --git a/test/T150-tagging.sh b/test/T150-tagging.sh
> index 8adcabc..6fd6a18 100755
> --- a/test/T150-tagging.sh
> +++ b/test/T150-tagging.sh
> @@ -287,9 +287,9 @@ test_expect_code 1 "Empty tag names" 'notmuch tag + One'
> test_expect_code 1 "Tag name beginning with -" 'notmuch tag +- One'
>
> test_begin_subtest "Xapian exception: read only files"
> -chmod u-w ${MAIL_DIR}/.notmuch/xapian/*.DB
> +chmod u-w ${MAIL_DIR}/.notmuch/xapian/*.${db_ending}
> output=$(notmuch tag +something '*' 2>&1 | sed 's/: .*$//' )
> -chmod u+w ${MAIL_DIR}/.notmuch/xapian/*.DB
> +chmod u+w ${MAIL_DIR}/.notmuch/xapian/{*.DB,*.glass}
wat?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4/4] test: cope with glass backend file naming variations
2016-04-09 21:00 ` Tomi Ollila
@ 2016-04-09 22:36 ` David Bremner
2016-04-12 18:46 ` Tomi Ollila
1 sibling, 0 replies; 9+ messages in thread
From: David Bremner @ 2016-04-09 22:36 UTC (permalink / raw)
To: Tomi Ollila, notmuch
Tomi Ollila <tomi.ollila@iki.fi> writes:
> On Sat, Apr 09 2016, David Bremner <david@tethera.net> wrote:
>
>> ...
>
>> diff --git a/test/T150-tagging.sh b/test/T150-tagging.sh
>> index 8adcabc..6fd6a18 100755
>> --- a/test/T150-tagging.sh
>> +++ b/test/T150-tagging.sh
>> @@ -287,9 +287,9 @@ test_expect_code 1 "Empty tag names" 'notmuch tag + One'
>> test_expect_code 1 "Tag name beginning with -" 'notmuch tag +- One'
>>
>> test_begin_subtest "Xapian exception: read only files"
>> -chmod u-w ${MAIL_DIR}/.notmuch/xapian/*.DB
>> +chmod u-w ${MAIL_DIR}/.notmuch/xapian/*.${db_ending}
>> output=$(notmuch tag +something '*' 2>&1 | sed 's/: .*$//' )
>> -chmod u+w ${MAIL_DIR}/.notmuch/xapian/*.DB
>> +chmod u+w ${MAIL_DIR}/.notmuch/xapian/{*.DB,*.glass}
>
> wat?
oops. I guess that should have the *.${db_ending} in both cases
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4/4] test: cope with glass backend file naming variations
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
1 sibling, 1 reply; 9+ messages in thread
From: Tomi Ollila @ 2016-04-12 18:46 UTC (permalink / raw)
To: David Bremner, notmuch
On Sun, Apr 10 2016, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> On Sat, Apr 09 2016, David Bremner <david@tethera.net> wrote:
>
>> ...
>
>> diff --git a/test/T150-tagging.sh b/test/T150-tagging.sh
>> index 8adcabc..6fd6a18 100755
>> --- a/test/T150-tagging.sh
>> +++ b/test/T150-tagging.sh
>> @@ -287,9 +287,9 @@ test_expect_code 1 "Empty tag names" 'notmuch tag + One'
>> test_expect_code 1 "Tag name beginning with -" 'notmuch tag +- One'
>>
>> test_begin_subtest "Xapian exception: read only files"
>> -chmod u-w ${MAIL_DIR}/.notmuch/xapian/*.DB
>> +chmod u-w ${MAIL_DIR}/.notmuch/xapian/*.${db_ending}
>> output=$(notmuch tag +something '*' 2>&1 | sed 's/: .*$//' )
>> -chmod u+w ${MAIL_DIR}/.notmuch/xapian/*.DB
>> +chmod u+w ${MAIL_DIR}/.notmuch/xapian/{*.DB,*.glass}
>
> wat?
Otherwise looks good and tests pass.
Tomi
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4/4] test: cope with glass backend file naming variations
2016-04-12 18:46 ` Tomi Ollila
@ 2016-04-12 23:34 ` David Bremner
0 siblings, 0 replies; 9+ messages in thread
From: David Bremner @ 2016-04-12 23:34 UTC (permalink / raw)
To: Tomi Ollila, notmuch
Tomi Ollila <tomi.ollila@iki.fi> writes:
> On Sun, Apr 10 2016, Tomi Ollila <tomi.ollila@iki.fi> wrote:
>
>> On Sat, Apr 09 2016, David Bremner <david@tethera.net> wrote:
>>
>>> ...
>>
>>> diff --git a/test/T150-tagging.sh b/test/T150-tagging.sh
>>> index 8adcabc..6fd6a18 100755
>>> --- a/test/T150-tagging.sh
>>> +++ b/test/T150-tagging.sh
>>> @@ -287,9 +287,9 @@ test_expect_code 1 "Empty tag names" 'notmuch tag + One'
>>> test_expect_code 1 "Tag name beginning with -" 'notmuch tag +- One'
>>>
>>> test_begin_subtest "Xapian exception: read only files"
>>> -chmod u-w ${MAIL_DIR}/.notmuch/xapian/*.DB
>>> +chmod u-w ${MAIL_DIR}/.notmuch/xapian/*.${db_ending}
>>> output=$(notmuch tag +something '*' 2>&1 | sed 's/: .*$//' )
>>> -chmod u+w ${MAIL_DIR}/.notmuch/xapian/*.DB
>>> +chmod u+w ${MAIL_DIR}/.notmuch/xapian/{*.DB,*.glass}
Pushed with Tomi's fix, and a similar one in T050-new.sh
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-04-12 23:34 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 3/4] configure: add test for default xapian backend David Bremner
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
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).