From 55ddc632c682affa67ca18600703e25fd1658a2d Mon Sep 17 00:00:00 2001 From: David Bremner Date: Wed, 6 Apr 2016 08:18:01 +2100 Subject: [PATCH] [PATCH 1/2] test: improve error handling in lib-error tests --- 62/a2307f9a3911db2777f2c8e50804eb1aa7499f | 84 +++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 62/a2307f9a3911db2777f2c8e50804eb1aa7499f diff --git a/62/a2307f9a3911db2777f2c8e50804eb1aa7499f b/62/a2307f9a3911db2777f2c8e50804eb1aa7499f new file mode 100644 index 000000000..7698d4be8 --- /dev/null +++ b/62/a2307f9a3911db2777f2c8e50804eb1aa7499f @@ -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 60ACC6DE0022 + for ; Tue, 5 Apr 2016 04:18:29 -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 v0p1vg7PN56E for ; + Tue, 5 Apr 2016 04:18:20 -0700 (PDT) +Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) + by arlo.cworth.org (Postfix) with ESMTPS id 05EA26DE0159 + for ; Tue, 5 Apr 2016 04:18:20 -0700 (PDT) +Received: from remotemail by fethera.tethera.net with local (Exim 4.84) + (envelope-from ) + id 1anP0X-0002xy-Fk; Tue, 05 Apr 2016 07:18:53 -0400 +Received: (nullmailer pid 5779 invoked by uid 1000); + Tue, 05 Apr 2016 11:18:15 -0000 +From: David Bremner +To: notmuch@notmuchmail.org +Subject: [PATCH 1/2] test: improve error handling in lib-error tests +Date: Tue, 5 Apr 2016 08:18:01 -0300 +Message-Id: <1459855082-5715-2-git-send-email-david@tethera.net> +X-Mailer: git-send-email 2.8.0.rc3 +In-Reply-To: <1459855082-5715-1-git-send-email-david@tethera.net> +References: <1459855082-5715-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: Tue, 05 Apr 2016 11:18:29 -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