[PATCH 08/13] test: regression test for n_directory_delete with closed db.

Subject: [PATCH 08/13] test: regression test for n_directory_delete with closed db.

Date: Sun, 26 Jul 2020 08:59:26 -0300

To: notmuch@notmuchmail.org

Cc: David Bremner

From: David Bremner


To the best of my current understanding, it's a bug in Xapian that no
exception is thrown here. The test should pass in either case.
---
 test/T563-lib-directory.sh | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/test/T563-lib-directory.sh b/test/T563-lib-directory.sh
index 739469a6..4de31078 100755
--- a/test/T563-lib-directory.sh
+++ b/test/T563-lib-directory.sh
@@ -26,7 +26,7 @@ int main (int argc, char** argv)
      exit (1);
    }
 
-   EXPECT0(notmuch_database_get_directory (db, "", &dir));
+   EXPECT0(notmuch_database_get_directory (db, "bar", &dir));
    EXPECT0(notmuch_database_close (db));
 EOF
 
@@ -74,4 +74,21 @@ A Xapian exception occurred at lib/directory.cc:XXX: Database has been closed
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+backup_database
+test_begin_subtest "delete directory document for a closed db"
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
+    {
+        stat = notmuch_directory_delete (dir);
+        printf ("%d\n", stat == NOTMUCH_STATUS_SUCCESS || stat == NOTMUCH_STATUS_XAPIAN_EXCEPTION);
+        stat = NOTMUCH_STATUS_SUCCESS;
+    }
+EOF
+cat <<EOF > EXPECTED
+== stdout ==
+1
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+restore_database
+
 test_done
-- 
2.27.0
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: