From d658915420a23938105828363f77c41ecb6ba0ce Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sat, 9 Apr 2016 22:49:47 +2100 Subject: [PATCH] [PATCH 1/4] test: improve error handling in lib-error tests --- 45/501e8507da22c2323706f13fe92aafc58762bd | 84 +++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 45/501e8507da22c2323706f13fe92aafc58762bd diff --git a/45/501e8507da22c2323706f13fe92aafc58762bd b/45/501e8507da22c2323706f13fe92aafc58762bd new file mode 100644 index 000000000..01a0feabc --- /dev/null +++ b/45/501e8507da22c2323706f13fe92aafc58762bd @@ -0,0 +1,84 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id F338C6DE02DD + for ; Fri, 8 Apr 2016 18:50:08 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.02 +X-Spam-Level: +X-Spam-Status: No, score=-0.02 tagged_above=-999 required=5 tests=[AWL=-0.009, + SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id XjAFmJ7AsthO for ; + Fri, 8 Apr 2016 18:49:59 -0700 (PDT) +Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) + by arlo.cworth.org (Postfix) with ESMTPS id A20E96DE0173 + for ; Fri, 8 Apr 2016 18:49:59 -0700 (PDT) +Received: from remotemail by fethera.tethera.net with local (Exim 4.84) + (envelope-from ) + id 1aoi2J-00022G-Qo; Fri, 08 Apr 2016 21:50:07 -0400 +Received: (nullmailer pid 6630 invoked by uid 1000); + Sat, 09 Apr 2016 01:49:55 -0000 +From: David Bremner +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 +Message-Id: <1460166590-6526-2-git-send-email-david@tethera.net> +X-Mailer: git-send-email 2.8.0.rc3 +In-Reply-To: <1460166590-6526-1-git-send-email-david@tethera.net> +References: <1460166590-6526-1-git-send-email-david@tethera.net> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sat, 09 Apr 2016 01:50:09 -0000 + +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 + -- 2.26.2