mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
test: add known broken test for exception handling in _n_m_delete
In [1], Thomas Schneider reported an uncaught Xapian exception when running out of disk space. We generate the same exception via database corruption. [1]: id:wwuk039sk2p.fsf@chaotikum.eu
This commit is contained in:
parent
16d92abf9f
commit
966f40086f
1 changed files with 28 additions and 0 deletions
|
@ -516,4 +516,32 @@ cat <<EOF > EXPECTED
|
|||
EOF
|
||||
test_expect_equal_file EXPECTED OUTPUT
|
||||
|
||||
TERMLIST_PATH=(${MAIL_DIR}/.notmuch/xapian/termlist.*)
|
||||
test_begin_subtest "remove message with corrupted db"
|
||||
test_subtest_known_broken
|
||||
backup_database
|
||||
cat c_head0 - c_tail <<'EOF' | test_private_C ${MAIL_DIR} ${TERMLIST_PATH}
|
||||
{
|
||||
notmuch_status_t status;
|
||||
|
||||
int fd = open(argv[2],O_WRONLY|O_TRUNC);
|
||||
if (fd < 0) {
|
||||
fprintf (stderr, "error opening %s\n", argv[1]);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
stat = _notmuch_message_delete (message);
|
||||
printf ("%d\n", stat == NOTMUCH_STATUS_XAPIAN_EXCEPTION);
|
||||
}
|
||||
EOF
|
||||
cat <<EOF > EXPECTED
|
||||
== stdout ==
|
||||
1
|
||||
== stderr ==
|
||||
A Xapian exception occurred at message.cc:XXX: EOF reading block YYY
|
||||
EOF
|
||||
sed 's/EOF reading block [0-9]*/EOF reading block YYY/' < OUTPUT > OUTPUT.clean
|
||||
test_expect_equal_file EXPECTED OUTPUT.clean
|
||||
restore_database
|
||||
|
||||
test_done
|
||||
|
|
Loading…
Reference in a new issue