The mtime is cached, so closing the db is not a problem. Writing the
mtime throws an exception, which is caught.
---
test/T563-lib-directory.sh | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/test/T563-lib-directory.sh b/test/T563-lib-directory.sh
index 4de31078..c45bc5f8 100755
--- a/test/T563-lib-directory.sh
+++ b/test/T563-lib-directory.sh
@@ -91,4 +91,22 @@ EOF
test_expect_equal_file EXPECTED OUTPUT
restore_database
+backup_database
+test_begin_subtest "get/set mtime of directory for a closed db"
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
+ {
+ time_t stamp = notmuch_directory_get_mtime (dir);
+ stat = notmuch_directory_set_mtime (dir, stamp);
+ printf ("%d\n", stat == NOTMUCH_STATUS_XAPIAN_EXCEPTION);
+ }
+EOF
+cat <<EOF > EXPECTED
+== stdout ==
+1
+== stderr ==
+A Xapian exception occurred setting directory mtime: Database has been closed.
+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