v2 of insert tempfail series
Tomi Ollila
tomi.ollila at iki.fi
Sun Dec 4 12:51:05 PST 2016
On Tue, Nov 29 2016, David Bremner <david at tethera.net> wrote:
> 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 :).
This series looks good to me -- also my part which I had a slight
afterthought when I looked what brew install gdb printed out -- it
suggested setting 'startup-with-shell off' which would have borken
my version (on macOS), but
http://apple.stackexchange.com/questions/246245/macos-sierra-gdb-not-codesigned
informed that setting startup-with-shell has so far not been necessary
(and it would be major pain everywhere if it were required; in addition to
everything else using `exec-wrapper` also requires shell...)
I.e. if it makes gdb use more robust in general that is good reason to use it.
Last (and least) (i.e. I could not resist the templation): the code block
below would be simpler in this format -- but perhaps what happends there is
less understandable -- although now the where the expansion is done is more
visible ;)
+ test_expect_code 75 "EX_TEMPFAIL when add_message returns $code" \
+ "gdb --batch-silent --return-child-result \
+ -ex 'set args insert < $gen_msg_filename' \
+ -x index-file-$code.gdb notmuch"
(all variable expansions are done here (in context of the outermost "gdb...")
and not in the `eval` that is done by test_expect_code -- unless any of the
variables expanded to yet another variable syntax ;)
Tomi
>
> 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