X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=test%2FT050-new.sh;h=9115de820770181bd6ff8f8c9b655d047e9fd8c9;hb=31b8ce4558de69860c95bf319a0a162316dce6c6;hp=f38e626354f2b573e448c3c5af1c4ff5d4a751a2;hpb=e311aad182326a1dcb0f8512e10b0e0f0faa9e2c;p=notmuch diff --git a/test/T050-new.sh b/test/T050-new.sh index f38e6263..9115de82 100755 --- a/test/T050-new.sh +++ b/test/T050-new.sh @@ -169,6 +169,15 @@ output=$(NOTMUCH_NEW --debug) test_expect_equal "$output" "(D) add_files, pass 3: queuing leftover directory ${MAIL_DIR}/two for deletion from database No new mail. Removed 3 messages." +test_begin_subtest "One character directory at top level" + +generate_message [dir]=A +generate_message [dir]=A/B +generate_message [dir]=A/B/C + +output=$(NOTMUCH_NEW --debug) +test_expect_equal "$output" "Added 3 new messages to the database." + test_begin_subtest "Support single-message mbox" cat > "${MAIL_DIR}"/mbox_file1 <&1 | sed 's/: .*$//' ) chmod u+w ${MAIL_DIR}/.notmuch/xapian/*.${db_ending} test_expect_equal "$output" "A Xapian exception occurred opening database" + +test_begin_subtest "Handle files vanishing between scandir and add_file" + +# A file for scandir to find. It won't get indexed, so can be empty. +touch ${MAIL_DIR}/vanish + +# Breakpoint to remove the file before indexing +cat < notmuch-new-vanish.gdb +set breakpoint pending on +set logging file notmuch-new-vanish-gdb.log +set logging on +break add_file +commands +shell rm -f ${MAIL_DIR}/vanish +continue +end +run +EOF + +${TEST_GDB} --batch-silent --return-child-result -x notmuch-new-vanish.gdb \ + --args notmuch new 2>OUTPUT 1>/dev/null +echo "exit status: $?" >> OUTPUT + +# Clean up the file in case gdb isn't available. +rm -f ${MAIL_DIR}/vanish + +cat < EXPECTED +Unexpected error with file ${MAIL_DIR}/vanish +add_file: Something went wrong trying to read or write a file +Error opening ${MAIL_DIR}/vanish: No such file or directory +exit status: 75 +EOF +test_expect_equal_file EXPECTED OUTPUT + test_done