X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=test%2FT055-path-config.sh;h=8ef76aed9273305f0b977eb8d4d4ee3bbdb58474;hb=b3258244c84a7673db39c46cad96ddb63b131dae;hp=d8828342dd3bcfbe6ef08ca83b2a33c7edcd15a0;hpb=4e209ca99ac8084a357c6fc8d7773f6207cfa16d;p=notmuch diff --git a/test/T055-path-config.sh b/test/T055-path-config.sh index d8828342..8ef76aed 100755 --- a/test/T055-path-config.sh +++ b/test/T055-path-config.sh @@ -16,6 +16,7 @@ restore_config () { unset DATABASE_PATH unset NOTMUCH_PROFILE unset XAPIAN_PATH + rm -f "$HOME/mail" cp notmuch-config-backup.${test_name} ${NOTMUCH_CONFIG} } @@ -42,6 +43,18 @@ symlink_config () { unset DATABASE_PATH } + +home_mail_config () { + local dir + backup_config + dir="${HOME}/mail" + ln -s $MAIL_DIR $dir + notmuch config set database.path + notmuch config set database.mail_root + XAPIAN_PATH="$MAIL_DIR/.notmuch/xapian" + unset DATABASE_PATH +} + xdg_config () { local dir local profile=${1:-default} @@ -66,7 +79,7 @@ xdg_config () { notmuch --config=${CONFIG_PATH} config set database.path } -for config in traditional split XDG XDG+profile symlink; do +for config in traditional split XDG XDG+profile symlink home_mail; do #start each set of tests with an known set of messages add_email_corpus @@ -90,6 +103,9 @@ for config in traditional split XDG XDG+profile symlink; do symlink) symlink_config ;; + home_mail) + home_mail_config + ;; esac test_begin_subtest "count ($config)" @@ -199,7 +215,82 @@ EOF "$output" \ "Welcome to a new version of notmuch! Your database will now be upgraded." - restore_config + test_begin_subtest "notmuch +config -database suggests notmuch new ($config)" + mv "$XAPIAN_PATH" "${XAPIAN_PATH}.bak" + notmuch > OUTPUT +cat < EXPECTED +Notmuch is configured, but no database was found. +You probably want to run "notmuch new" now to create a database. + +Note that the first run of "notmuch new" can take a very long time +and that the resulting database will use roughly the same amount of +storage space as the email being indexed. + +EOF + mv "${XAPIAN_PATH}.bak" "$XAPIAN_PATH" + + test_expect_equal_file EXPECTED OUTPUT + + test_begin_subtest "Set config value ($config)" + name=${RANDOM} + value=${RANDOM} + notmuch config set test${test_count}.${name} ${value} + output=$(notmuch config get test${test_count}.${name}) + notmuch config set test${test_count}.${name} + output2=$(notmuch config get test${test_count}.${name}) + test_expect_equal "${output}+${output2}" "${value}+" + + test_begin_subtest "Set config value in database ($config)" + name=${RANDOM} + value=${RANDOM} + notmuch config set --database test${test_count}.${name} ${value} + output=$(notmuch config get test${test_count}.${name}) + notmuch config set --database test${test_count}.${name} + output2=$(notmuch config get test${test_count}.${name}) + test_expect_equal "${output}+${output2}" "${value}+" + + test_begin_subtest "Config list ($config)" + notmuch config list | notmuch_dir_sanitize | sed -e "s/^database.backup_dir=.*$/database.backup_dir/" \ + -e "s/^database.hook_dir=.*$/database.hook_dir/" \ + -e "s/^database.path=.*$/database.path/" \ + -e "s,^database.mail_root=CWD/home/mail,database.mail_root=MAIL_DIR," \ + > OUTPUT + cat < EXPECTED +built_with.compact=true +built_with.field_processor=true +built_with.retry_lock=true +database.backup_dir +database.hook_dir +database.mail_root=MAIL_DIR +database.path +maildir.synchronize_flags=true +new.ignore= +new.tags=unread;inbox +search.exclude_tags= +user.name=Notmuch Test Suite +user.other_email=test_suite_other@notmuchmail.org;test_suite@otherdomain.org +user.primary_email=test_suite@notmuchmail.org +EOF + test_expect_equal_file EXPECTED OUTPUT + + case $config in + XDG*) + test_begin_subtest "Set shadowed config value in database ($config)" + name=${RANDOM} + value=${RANDOM} + key=test${test_count}.${name} + notmuch config set --database ${key} ${value} + notmuch config set ${key} shadow${value} + output=$(notmuch --config='' config get ${key}) + notmuch config set --database ${key} + output2=$(notmuch --config='' config get ${key}) + notmuch config set ${key} + test_expect_equal "${output}+${output2}" "${value}+" + ;; + esac + restore_config + rm -rf home/.local + rm -rf home/.config done test_done