v2 of insert tempfail series
David Bremner
david at tethera.net
Mon Nov 28 14:12:28 PST 2016
This incorporates Tomi's patch of
id:1480367228-22183-1-git-send-email-tomi.ollila at iki.fi
verbatim, to sort out conflicts.
It fixes the issues I alread sent mail about, and puts back the --keep
tests for various error codes.
The interdiff follows; most of it is Tomi's fault :).
diff --git a/notmuch-insert.c b/notmuch-insert.c
index a152f15..bc96af0 100644
--- a/notmuch-insert.c
+++ b/notmuch-insert.c
@@ -541,7 +541,7 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
status = notmuch_database_open (notmuch_config_get_database_path (config),
NOTMUCH_DATABASE_MODE_READ_WRITE, ¬much);
if (status)
- return status_to_exit(status);
+ return keep ? NOTMUCH_STATUS_SUCCESS : status_to_exit (status);
notmuch_exit_if_unmatched_db_uuid (notmuch);
@@ -578,5 +578,5 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
notmuch_run_hook (db_path, "post-insert");
}
- return status ? status_to_exit(status) : EXIT_SUCCESS;
+ return status_to_exit (status);
}
diff --git a/test/T070-insert.sh b/test/T070-insert.sh
index fd620e5..3e7d582 100755
--- a/test/T070-insert.sh
+++ b/test/T070-insert.sh
@@ -206,14 +206,24 @@ gen_insert_msg
for code in FILE_NOT_EMAIL READ_ONLY_DATABASE UPGRADE_REQUIRED PATH_ERROR; do
test_expect_code 1 "EXIT_FAILURE when add_message returns $code" \
- "gdb --batch-silent --return-child-result -x index-file-$code.gdb \
- --args notmuch insert < $gen_msg_filename"
+ "gdb --batch-silent --return-child-result \
+ -ex \"set args insert < $gen_msg_filename\" \
+ -x index-file-$code.gdb notmuch"
+ test_expect_code 0 "success exit with --keep when add_message returns $code" \
+ "gdb --batch-silent --return-child-result \
+ -ex \"set args insert --keep < $gen_msg_filename\" \
+ -x index-file-$code.gdb notmuch"
done
for code in OUT_OF_MEMORY XAPIAN_EXCEPTION ; do
test_expect_code 75 "EX_TEMPFAIL when add_message returns $code" \
- "gdb --batch-silent --return-child-result -x index-file-$code.gdb \
- --args notmuch insert < $gen_msg_filename"
+ "gdb --batch-silent --return-child-result \
+ -ex \"set args insert < $gen_msg_filename\" \
+ -x index-file-$code.gdb notmuch"
+ test_expect_code 0 "success exit with --keep when add_message returns $code" \
+ "gdb --batch-silent --return-child-result \
+ -ex \"set args insert --keep < $gen_msg_filename\" \
+ -x index-file-$code.gdb notmuch"
done
test_done
More information about the notmuch
mailing list