X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=test%2FT560-lib-error.sh;h=e775216ee29bd47ff55f31fa03a202580c663eea;hb=069362ee10d0af108c7d0a275bda1a78c4a49f27;hp=59a479c849e998f16c7a08abd5d7b43ec83169a4;hpb=12534d5c4b02498173b0c63d063ae0a3c845b957;p=notmuch diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh index 59a479c8..e775216e 100755 --- a/test/T560-lib-error.sh +++ b/test/T560-lib-error.sh @@ -5,7 +5,8 @@ test_description="error reporting for library" add_email_corpus -test_expect_success "building database" "NOTMUCH_NEW" +test_begin_subtest "building database" +test_expect_success "NOTMUCH_NEW" test_begin_subtest "Open null pointer" test_C <<'EOF' @@ -189,7 +190,7 @@ Path already exists: MAIL_DIR EOF test_expect_equal_file EXPECTED OUTPUT -cat <<'EOF' > c_head +cat < c_head #include #include #include @@ -202,16 +203,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]); + path = talloc_asprintf (db, "%s/.notmuch/xapian/postlist.${db_ending}", 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) {