From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 3801D6DE02C2 for ; Wed, 6 Apr 2016 03:27:37 -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 JFcQty5MZ2gK for ; Wed, 6 Apr 2016 03:27:29 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id C11CB6DE02C9 for ; Wed, 6 Apr 2016 03:27:21 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.84) (envelope-from ) id 1ankgl-00033f-38; Wed, 06 Apr 2016 06:27:55 -0400 Received: (nullmailer pid 28738 invoked by uid 1000); Wed, 06 Apr 2016 10:27:16 -0000 From: David Bremner To: David Bremner , notmuch@notmuchmail.org Subject: [PATCH 1/3] test: improve error handling in lib-error tests Date: Wed, 6 Apr 2016 07:27:09 -0300 Message-Id: <1459938431-28670-2-git-send-email-david@tethera.net> X-Mailer: git-send-email 2.8.0.rc3 In-Reply-To: <1459938431-28670-1-git-send-email-david@tethera.net> References: <1459855082-5715-2-git-send-email-david@tethera.net> <1459938431-28670-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: Wed, 06 Apr 2016 10:27:37 -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