summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
a821ba5)
We were sleeping merely to ensure that our updates to the mail store
would result in the mtime of the appropriate directories being
updated. We make the test suite run faster by not sleeping, but
instead explicitly updating the mtime of the directory to a future
time with touch.
We're careful to ensure that the time is not merely in the future
compared to the current time, but also later than any previous update
to the same directory mtime.
+increment_mtime_amount=0
+increment_mtime ()
+{
+ dir=$1
+
+ increment_mtime_amount=$((increment_mtime_amount + 1))
+ touch -d "+${increment_mtime_amount} seconds" $dir
+}
+
# Generate a new message in the mail directory, with
# a unique message ID and subject.
#
# Generate a new message in the mail directory, with
# a unique message ID and subject.
#
-do_sleep ()
-{
- sleep 1
+ # Ensure that the mtime of the containing directory is updated
+ increment_mtime $(dirname ${gen_msg_filename})
}
NOTMUCH_IGNORED_OUTPUT_REGEXP='^Processed [0-9]*( total)? file|Found [0-9]* total file'
}
NOTMUCH_IGNORED_OUTPUT_REGEXP='^Processed [0-9]*( total)? file|Found [0-9]* total file'
execute_expecting new "No new mail."
printf " Single new message...\t\t"
execute_expecting new "No new mail."
printf " Single new message...\t\t"
generate_message
execute_expecting new "Added 1 new message to the database."
printf " Multiple new messages...\t"
generate_message
execute_expecting new "Added 1 new message to the database."
printf " Multiple new messages...\t"
generate_message
generate_message
execute_expecting new "Added 2 new messages to the database."
generate_message
generate_message
execute_expecting new "Added 2 new messages to the database."
tmp_msg_filename=tmp/$gen_msg_filename
mkdir -p $(dirname $tmp_msg_filename)
mv $gen_msg_filename $tmp_msg_filename
tmp_msg_filename=tmp/$gen_msg_filename
mkdir -p $(dirname $tmp_msg_filename)
mv $gen_msg_filename $tmp_msg_filename
+increment_mtime ${MAIL_DIR}
mv $tmp_msg_filename $gen_msg_filename
mv $tmp_msg_filename $gen_msg_filename
+increment_mtime ${MAIL_DIR}
execute_expecting new "Added 1 new message to the database."
printf " Renamed message...\t\t"
execute_expecting new "Added 1 new message to the database."
printf " Renamed message...\t\t"
generate_message
$NOTMUCH new > /dev/null
generate_message
$NOTMUCH new > /dev/null
mv $gen_msg_filename ${gen_msg_filename}-renamed
mv $gen_msg_filename ${gen_msg_filename}-renamed
+increment_mtime ${MAIL_DIR}
execute_expecting new "No new mail. Detected 1 file rename."
printf " Deleted message...\t\t"
execute_expecting new "No new mail. Detected 1 file rename."
printf " Deleted message...\t\t"
rm ${gen_msg_filename}-renamed
rm ${gen_msg_filename}-renamed
+increment_mtime ${MAIL_DIR}
execute_expecting new "No new mail. Removed 1 message."
printf " Renamed directory...\t\t"
execute_expecting new "No new mail. Removed 1 message."
printf " Renamed directory...\t\t"
generate_message [dir]=dir
generate_message [dir]=dir
generate_message [dir]=dir
$NOTMUCH new > /dev/null
generate_message [dir]=dir
generate_message [dir]=dir
generate_message [dir]=dir
$NOTMUCH new > /dev/null
mv ${MAIL_DIR}/dir ${MAIL_DIR}/dir-renamed
mv ${MAIL_DIR}/dir ${MAIL_DIR}/dir-renamed
+increment_mtime ${MAIL_DIR}
execute_expecting new "No new mail. Detected 3 file renames."
printf " Deleted directory...\t\t"
execute_expecting new "No new mail. Detected 3 file renames."
printf " Deleted directory...\t\t"
rm -rf ${MAIL_DIR}/dir-renamed
rm -rf ${MAIL_DIR}/dir-renamed
+increment_mtime ${MAIL_DIR}
execute_expecting new "No new mail. Removed 3 messages."
printf " New directory (at end of list)... "
execute_expecting new "No new mail. Removed 3 messages."
printf " New directory (at end of list)... "
generate_message [dir]=zzz
generate_message [dir]=zzz
generate_message [dir]=zzz
generate_message [dir]=zzz
generate_message [dir]=zzz
generate_message [dir]=zzz
printf " Deleted directory (end of list)... "
printf " Deleted directory (end of list)... "
+increment_mtime ${MAIL_DIR}
execute_expecting new "No new mail. Removed 3 messages."
execute_expecting new "No new mail. Removed 3 messages."
execute_expecting new "Added 1 new message to the database."
printf " New symlink to a file...\t"
execute_expecting new "Added 1 new message to the database."
printf " New symlink to a file...\t"
generate_message
external_msg_filename=${TEST_DIR}/external/$(basename $gen_msg_filename)
mkdir -p $(dirname $external_msg_filename)
mv $gen_msg_filename $external_msg_filename
ln -s $external_msg_filename $gen_msg_filename
generate_message
external_msg_filename=${TEST_DIR}/external/$(basename $gen_msg_filename)
mkdir -p $(dirname $external_msg_filename)
mv $gen_msg_filename $external_msg_filename
ln -s $external_msg_filename $gen_msg_filename
+increment_mtime ${MAIL_DIR}
execute_expecting new "Added 1 new message to the database."
printf " New two-level directory...\t"
execute_expecting new "Added 1 new message to the database."
printf " New two-level directory...\t"
generate_message [dir]=two/levels
generate_message [dir]=two/levels
generate_message [dir]=two/levels
generate_message [dir]=two/levels
generate_message [dir]=two/levels
generate_message [dir]=two/levels
printf " Deleted two-level directory... "
printf " Deleted two-level directory... "
+increment_mtime ${MAIL_DIR}
execute_expecting new "No new mail. Removed 3 messages."
execute_expecting new "No new mail. Removed 3 messages."