]> git.cworth.org Git - notmuch/commitdiff
test/path-config: set database.mail_root but not database.path
authorDavid Bremner <david@tethera.net>
Tue, 26 Jul 2022 01:04:21 +0000 (21:04 -0400)
committerDavid Bremner <david@tethera.net>
Sat, 3 Sep 2022 11:24:43 +0000 (08:24 -0300)
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

index 45545d885182afd9095ff8925a20203057d48c03..149aa6a1c665a64a36fa59264e864ce450f41154 100755 (executable)
@@ -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