unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Cc: spwhitton@spwhitton.name
Subject: [PATCH 3/6] test/path-config: set database.mail_root but not database.path
Date: Fri, 29 Jul 2022 09:19:58 -0300	[thread overview]
Message-ID: <20220729122001.1556787-4-david@tethera.net> (raw)
In-Reply-To: <20220729122001.1556787-1-david@tethera.net>

The failing "create database" test replicates a bug reported by Sean
Whitton [1]. The other two failures also look related to the database
being (re)created in the wrong place.

[1]: id:87y1wqkw13.fsf@athena.silentflame.com.
---
 test/T055-path-config.sh | 30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/test/T055-path-config.sh b/test/T055-path-config.sh
index 45545d88..149aa6a1 100755
--- a/test/T055-path-config.sh
+++ b/test/T055-path-config.sh
@@ -92,7 +92,20 @@ xdg_config () {
     notmuch --config=${CONFIG_PATH} config set database.path
 }
 
-for config in traditional split XDG XDG+profile symlink home_mail maildir_env; do
+mailroot_only_config () {
+    local dir
+
+    backup_config
+    notmuch config set database.mail_root ${TMP_DIRECTORY}/mail
+    notmuch config set database.path
+    DATABASE_PATH="${HOME}/.local/share/notmuch/default"
+    rm -rf $DATABASE_PATH
+    mkdir -p $DATABASE_PATH
+    XAPIAN_PATH="${DATABASE_PATH}/xapian"
+    mv mail/.notmuch/xapian $DATABASE_PATH
+}
+
+for config in traditional split XDG XDG+profile symlink home_mail maildir_env mailroot_only; do
     #start each set of tests with an known set of messages
     add_email_corpus
 
@@ -122,6 +135,9 @@ for config in traditional split XDG XDG+profile symlink home_mail maildir_env; d
 	maildir_env)
 	    maildir_env_config
 	    ;;
+	mailroot_only)
+	    mailroot_only_config
+	    ;;
     esac
 
     test_begin_subtest "count ($config)"
@@ -314,11 +330,6 @@ user.primary_email
 EOF
    test_expect_equal_file EXPECTED OUTPUT
 
-   test_begin_subtest "create database ($config)"
-   rm -r ${XAPIAN_PATH}
-   notmuch new
-   test_expect_equal "$(xapian-metadata get ${XAPIAN_PATH} version)" 3
-
    case $config in
        XDG*)
 	   test_begin_subtest "Set shadowed config value in database ($config)"
@@ -355,6 +366,13 @@ Added 1 new message to the database.
 thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Do not ignore, very important (inbox unread)
 EOF
 	   test_expect_equal_file EXPECTED OUTPUT
+	   ;&
+       mailroot_only)
+	   test_begin_subtest "create database parent dir ($config)"
+	   test_subtest_known_broken
+	   rm -r ${DATABASE_PATH}
+	   notmuch new
+	   test_expect_equal "$(xapian-metadata get ${XAPIAN_PATH} version)" 3
 	   ;;
        *)
 	   backup_database
-- 
2.35.2

  parent reply	other threads:[~2022-07-29 12:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-29 12:19 v1 Create database directory David Bremner
2022-07-29 12:19 ` [PATCH 1/6] tests: remove dead code from T055-path-config.sh David Bremner
2022-08-06 12:19   ` David Bremner
2022-07-29 12:19 ` [PATCH 2/6] test: add test for creating database in various configurations David Bremner
2022-09-03 11:33   ` David Bremner
2022-07-29 12:19 ` David Bremner [this message]
2022-07-29 12:19 ` [PATCH 4/6] lib/open: refactor call to mkdir into function David Bremner
2022-07-29 12:20 ` [PATCH 5/6] lib/open: return non-SUCCESS on missing database path David Bremner
2022-07-29 12:20 ` [PATCH 6/6] lib/open: create database path in some cases David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220729122001.1556787-4-david@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    --cc=spwhitton@spwhitton.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).