[PATCH 2/2] WIP: update test suite for glass xapian backend
David Bremner
david at tethera.net
Tue Apr 5 04:18:02 PDT 2016
This fixes all but one of the test failures I found with xapian 1.3.5.
Once I see what the real issue is with the atomicity test, I'll see how
to organize this. In particular it might make sense to define a global
variable in test-lib.sh for what the default xapian backend will be.
---
test/T050-new.sh | 2 +-
test/T060-count.sh | 2 ++
test/T150-tagging.sh | 4 ++--
test/T360-symbol-hiding.sh | 4 ++--
test/T560-lib-error.sh | 10 ++++++++--
5 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/test/T050-new.sh b/test/T050-new.sh
index 93a6fa9..fc93bfd 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,*.glass}
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..f1df4a2 100755
--- a/test/T060-count.sh
+++ b/test/T060-count.sh
@@ -96,6 +96,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.glass" 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"
@@ -106,6 +107,7 @@ 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.glass
continue
end
run
diff --git a/test/T150-tagging.sh b/test/T150-tagging.sh
index 8adcabc..601d091 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,*.glass}
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..2ccdc63 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,chert\|glass,foo,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 foo 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..7c5748b 100755
--- a/test/T560-lib-error.sh
+++ b/test/T560-lib-error.sh
@@ -189,7 +189,13 @@ Path already exists: MAIL_DIR
EOF
test_expect_equal_file EXPECTED OUTPUT
-cat <<'EOF' > c_head
+if [ -f "${MAIL_DIR}"/.notmuch/xapian/iamglass ]; then
+ db_ending=glass
+else
+ db_ending=DB
+fi
+
+cat <<EOF > c_head
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -210,7 +216,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
More information about the notmuch
mailing list