X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=test%2FT055-path-config.sh;h=0a34e67fa9409d7ecc512861ae5d2ebc80750723;hb=f5d4349921ded021756d6754d347420e68b23111;hp=e4812c820ee961c985fc0d82c61e2a9ffed03f6c;hpb=b30a59157d5ba0421c01fa3dc05d238d18738839;p=notmuch diff --git a/test/T055-path-config.sh b/test/T055-path-config.sh index e4812c82..0a34e67f 100755 --- a/test/T055-path-config.sh +++ b/test/T055-path-config.sh @@ -2,6 +2,8 @@ test_description='Configuration of mail-root and database path' . $(dirname "$0")/test-lib.sh || exit 1 +test_require_external_prereq xapian-metdata + backup_config () { local test_name=$(basename $0 .sh) cp ${NOTMUCH_CONFIG} notmuch-config-backup.${test_name} @@ -13,6 +15,7 @@ restore_config () { unset CONFIG_PATH unset DATABASE_PATH unset NOTMUCH_PROFILE + unset XAPIAN_PATH cp notmuch-config-backup.${test_name} ${NOTMUCH_CONFIG} } @@ -25,6 +28,7 @@ split_config () { notmuch config set database.path $dir notmuch config set database.mail_root $MAIL_DIR DATABASE_PATH=$dir + XAPIAN_PATH="$dir/xapian" } symlink_config () { @@ -34,6 +38,7 @@ symlink_config () { ln -s $MAIL_DIR $dir notmuch config set database.path $dir notmuch config set database.mail_root $MAIL_DIR + XAPIAN_PATH="$MAIL_DIR/.notmuch/xapian" unset DATABASE_PATH } @@ -56,6 +61,7 @@ xdg_config () { mv ${NOTMUCH_CONFIG} $CONFIG_PATH unset NOTMUCH_CONFIG + XAPIAN_PATH="${DATABASE_PATH}/xapian" notmuch --config=${CONFIG_PATH} config set database.mail_root ${TMP_DIRECTORY}/mail notmuch --config=${CONFIG_PATH} config set database.path } @@ -67,6 +73,7 @@ for config in traditional split XDG XDG+profile symlink; do case $config in traditional) backup_config + XAPIAN_PATH="$MAIL_DIR/.notmuch/xapian" ;; split) split_config @@ -184,6 +191,30 @@ EOF notmuch search --output=messages '*' | sort > OUTPUT test_expect_equal_file EXPECTED OUTPUT + test_begin_subtest "upgrade backup ($config)" + features=$(xapian-metadata get $XAPIAN_PATH features | grep -v "^relative directory paths") + xapian-metadata set $XAPIAN_PATH features "$features" + output=$(notmuch new | grep Welcome) + test_expect_equal \ + "$output" \ + "Welcome to a new version of notmuch! Your database will now be upgraded." + + 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 + restore_config done