unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [PATCH 1/4] test: improve error handling in lib-error tests
Date: Fri,  8 Apr 2016 22:49:47 -0300	[thread overview]
Message-ID: <1460166590-6526-2-git-send-email-david@tethera.net> (raw)
In-Reply-To: <1460166590-6526-1-git-send-email-david@tethera.net>

There is at least one bug fixed here (missing parameter to printf), even
if exiting via segfault is considered OK.
---
 test/T560-lib-error.sh | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh
index 59a479c..49d3674 100755
--- a/test/T560-lib-error.sh
+++ b/test/T560-lib-error.sh
@@ -202,16 +202,20 @@ int main (int argc, char** argv)
    notmuch_database_t *db;
    notmuch_status_t stat;
    char *path;
+   char *msg = NULL;
    int fd;
 
-   stat = notmuch_database_open (argv[1], NOTMUCH_DATABASE_MODE_READ_WRITE, &db);
+   stat = notmuch_database_open_verbose (argv[1], NOTMUCH_DATABASE_MODE_READ_WRITE, &db, &msg);
    if (stat != NOTMUCH_STATUS_SUCCESS) {
-     fprintf (stderr, "error opening database: %d\n", stat);
+     fprintf (stderr, "error opening database: %d %s\n", stat, msg ? msg : "");
+     exit (1);
    }
    path = talloc_asprintf (db, "%s/.notmuch/xapian/postlist.DB", argv[1]);
    fd = open(path,O_WRONLY|O_TRUNC);
-   if (fd < 0)
-       fprintf (stderr, "error opening %s\n");
+   if (fd < 0) {
+       fprintf (stderr, "error opening %s\n", argv[1]);
+       exit (1);
+   }
 EOF
 cat <<'EOF' > c_tail
    if (stat) {
-- 
2.8.0.rc3

  reply	other threads:[~2016-04-09  1:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-09  1:49 xapian 1.3.5 compatibility, v3 David Bremner
2016-04-09  1:49 ` David Bremner [this message]
2016-04-09  1:49 ` [PATCH 2/4] test/atomicity: guard chert-only optimization David Bremner
2016-04-09  1:49 ` [PATCH 3/4] configure: add test for default xapian backend David Bremner
2016-04-09  1:49 ` [PATCH 4/4] test: cope with glass backend file naming variations David Bremner
2016-04-09 21:00   ` Tomi Ollila
2016-04-09 22:36     ` David Bremner
2016-04-12 18:46     ` Tomi Ollila
2016-04-12 23:34       ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1460166590-6526-2-git-send-email-david@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).