[PATCH 1/2] test: improve error handling in lib-error tests
authorDavid Bremner <david@tethera.net>
Tue, 5 Apr 2016 11:18:01 +0000 (08:18 +2100)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:21:29 +0000 (16:21 -0700)
62/a2307f9a3911db2777f2c8e50804eb1aa7499f [new file with mode: 0644]

diff --git a/62/a2307f9a3911db2777f2c8e50804eb1aa7499f b/62/a2307f9a3911db2777f2c8e50804eb1aa7499f
new file mode 100644 (file)
index 0000000..7698d4b
--- /dev/null
@@ -0,0 +1,84 @@
+Return-Path: <bremner@tethera.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 60ACC6DE0022\r
+ for <notmuch@notmuchmail.org>; Tue,  5 Apr 2016 04:18:29 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.02\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.02 tagged_above=-999 required=5 tests=[AWL=-0.009,\r
+  SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id v0p1vg7PN56E for <notmuch@notmuchmail.org>;\r
+ Tue,  5 Apr 2016 04:18:20 -0700 (PDT)\r
+Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 05EA26DE0159\r
+ for <notmuch@notmuchmail.org>; Tue,  5 Apr 2016 04:18:20 -0700 (PDT)\r
+Received: from remotemail by fethera.tethera.net with local (Exim 4.84)\r
+ (envelope-from <bremner@tethera.net>)\r
+ id 1anP0X-0002xy-Fk; Tue, 05 Apr 2016 07:18:53 -0400\r
+Received: (nullmailer pid 5779 invoked by uid 1000);\r
+ Tue, 05 Apr 2016 11:18:15 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/2] test: improve error handling in lib-error tests\r
+Date: Tue,  5 Apr 2016 08:18:01 -0300\r
+Message-Id: <1459855082-5715-2-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 2.8.0.rc3\r
+In-Reply-To: <1459855082-5715-1-git-send-email-david@tethera.net>\r
+References: <1459855082-5715-1-git-send-email-david@tethera.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 05 Apr 2016 11:18:29 -0000\r
+\r
+There is at least one bug fixed here (missing parameter to printf), even\r
+if exiting via segfault is considered OK.\r
+---\r
+ test/T560-lib-error.sh | 12 ++++++++----\r
+ 1 file changed, 8 insertions(+), 4 deletions(-)\r
+\r
+diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh\r
+index 59a479c..49d3674 100755\r
+--- a/test/T560-lib-error.sh\r
++++ b/test/T560-lib-error.sh\r
+@@ -202,16 +202,20 @@ int main (int argc, char** argv)\r
+    notmuch_database_t *db;\r
+    notmuch_status_t stat;\r
+    char *path;\r
++   char *msg = NULL;\r
+    int fd;\r
\r
+-   stat = notmuch_database_open (argv[1], NOTMUCH_DATABASE_MODE_READ_WRITE, &db);\r
++   stat = notmuch_database_open_verbose (argv[1], NOTMUCH_DATABASE_MODE_READ_WRITE, &db, &msg);\r
+    if (stat != NOTMUCH_STATUS_SUCCESS) {\r
+-     fprintf (stderr, "error opening database: %d\n", stat);\r
++     fprintf (stderr, "error opening database: %d %s\n", stat, msg ? msg : "");\r
++     exit (1);\r
+    }\r
+    path = talloc_asprintf (db, "%s/.notmuch/xapian/postlist.DB", argv[1]);\r
+    fd = open(path,O_WRONLY|O_TRUNC);\r
+-   if (fd < 0)\r
+-       fprintf (stderr, "error opening %s\n");\r
++   if (fd < 0) {\r
++       fprintf (stderr, "error opening %s\n", argv[1]);\r
++       exit (1);\r
++   }\r
+ EOF\r
+ cat <<'EOF' > c_tail\r
+    if (stat) {\r
+-- \r
+2.8.0.rc3\r
+\r