X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=test%2FT566-lib-message.sh;h=6905193788a4b22419897119d2e1d14d50c405bc;hb=HEAD;hp=87e70441c95edec553b1fded906ffaaed1e15270;hpb=3f27cce71f9f154cb0c2134c32d41c31eb62a239;p=notmuch diff --git a/test/T566-lib-message.sh b/test/T566-lib-message.sh index 87e70441..69051937 100755 --- a/test/T566-lib-message.sh +++ b/test/T566-lib-message.sh @@ -3,6 +3,10 @@ test_description="API tests for notmuch_message_*" . $(dirname "$0")/test-lib.sh || exit 1 +if [ -n "${NOTMUCH_TEST_INSTALLED}" ]; then + test_done +fi + add_email_corpus test_begin_subtest "building database" @@ -375,7 +379,6 @@ EOF test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "Handle converting tags to maildir flags with closed db" -test_subtest_known_broken cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} { notmuch_status_t status; @@ -517,4 +520,31 @@ cat < EXPECTED EOF test_expect_equal_file EXPECTED OUTPUT +TERMLIST_PATH=(${MAIL_DIR}/.notmuch/xapian/termlist.*) +test_begin_subtest "remove message with corrupted db" +backup_database +cat c_head0 - c_tail <<'EOF' | test_private_C ${MAIL_DIR} ${TERMLIST_PATH} + { + notmuch_status_t status; + + int fd = open(argv[2],O_WRONLY|O_TRUNC); + if (fd < 0) { + fprintf (stderr, "error opening %s\n", argv[1]); + exit (1); + } + + stat = _notmuch_message_delete (message); + printf ("%d\n", stat == NOTMUCH_STATUS_XAPIAN_EXCEPTION); + } +EOF +cat < EXPECTED +== stdout == +1 +== stderr == +A Xapian exception occurred at message.cc:XXX: EOF reading block YYY +EOF +sed 's/EOF reading block [0-9]*/EOF reading block YYY/' < OUTPUT > OUTPUT.clean +test_expect_equal_file EXPECTED OUTPUT.clean +restore_database + test_done