aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2016-04-08 22:49:47 -0300
committerDavid Bremner <david@tethera.net>2016-04-12 20:04:03 -0300
commit45df509cb6fd642bc5895f2c7869a354c1255f4b (patch)
tree84c4cb61786d220aae0bbe4dedf539f34e07d367 /test
parentfd6f65f241854cd55e7e4d7c9cb9a71bd9f70cb4 (diff)
test: improve error handling in lib-error tests
There is at least one bug fixed here (missing parameter to printf), even if exiting via segfault is considered OK.
Diffstat (limited to 'test')
-rwxr-xr-xtest/T560-lib-error.sh12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh
index 59a479c8..49d36740 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) {