X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=test%2FT560-lib-error.sh;h=30cce9437faecc2d0414ae5053fba6f19db1d5aa;hb=8ba3057d01b11fb806581f8dc451a8891a4d4e0e;hp=1f4482cbe3d30cadf43ca362aa7f4ea946e22d70;hpb=9d6f4641d17a6100cb8d96bc1e09d3d4999c34f3;p=notmuch diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh index 1f4482cb..30cce943 100755 --- a/test/T560-lib-error.sh +++ b/test/T560-lib-error.sh @@ -16,7 +16,11 @@ int main (int argc, char** argv) { notmuch_database_t *db; notmuch_status_t stat; - stat = notmuch_database_open (NULL, 0, 0); + char* msg = NULL; + stat = notmuch_database_open_with_config (NULL, + NOTMUCH_DATABASE_MODE_READ_ONLY, + "", NULL, &db, &msg); + if (msg) fputs (msg, stderr); } EOF cat <<'EOF' >EXPECTED @@ -34,7 +38,11 @@ int main (int argc, char** argv) { notmuch_database_t *db; notmuch_status_t stat; - stat = notmuch_database_open ("./nonexistent/foo", 0, 0); + char *msg = NULL; + stat = notmuch_database_open_with_config ("./nonexistent/foo", + NOTMUCH_DATABASE_MODE_READ_ONLY, + "", NULL, &db, &msg); + if (msg) fputs (msg, stderr); } EOF cat <<'EOF' >EXPECTED @@ -52,7 +60,10 @@ int main (int argc, char** argv) { notmuch_database_t *db; notmuch_status_t stat; - stat = notmuch_database_create ("./nonexistent/foo", &db); + char *msg = NULL; + + stat = notmuch_database_create_with_config ("./nonexistent/foo", "", NULL, &db, &msg); + if (msg) fputs (msg, stderr); } EOF cat <<'EOF' >EXPECTED @@ -70,13 +81,17 @@ int main (int argc, char** argv) { notmuch_database_t *db; notmuch_status_t stat; - stat = notmuch_database_open (argv[1], 0, 0); + char* msg = NULL; + stat = notmuch_database_open_with_config (argv[1], + NOTMUCH_DATABASE_MODE_READ_ONLY, + "", NULL, &db, &msg); + if (msg) fputs (msg, stderr); } EOF cat <<'EOF' >EXPECTED == stdout == == stderr == -Error: Cannot open database at CWD/nonexistent/foo: No such file or directory. +Error: database path 'CWD/nonexistent/foo' does not exist or is not a directory. EOF test_expect_equal_file EXPECTED OUTPUT @@ -87,7 +102,10 @@ test_C <<'EOF' int main (int argc, char** argv) { notmuch_status_t stat; - stat = notmuch_database_create (NULL, NULL); + char *msg; + + stat = notmuch_database_create_with_config (NULL, "", NULL, NULL, &msg); + if (msg) fputs (msg, stderr); } EOF cat <<'EOF' >EXPECTED @@ -105,13 +123,16 @@ int main (int argc, char** argv) { notmuch_database_t *db; notmuch_status_t stat; - stat = notmuch_database_create (argv[1], &db); + char *msg; + + stat = notmuch_database_create_with_config (argv[1], "", NULL, &db, &msg); + if (msg) fputs (msg, stderr); } EOF cat <<'EOF' >EXPECTED == stdout == == stderr == -Error: Cannot open database at CWD/nonexistent/foo: No such file or directory. +Error: database path 'CWD/nonexistent/foo' does not exist or is not a directory. EOF test_expect_equal_file EXPECTED OUTPUT @@ -123,7 +144,11 @@ int main (int argc, char** argv) { notmuch_database_t *db; notmuch_status_t stat; - stat = notmuch_database_open (argv[1], NOTMUCH_DATABASE_MODE_READ_ONLY, &db); + char* msg = NULL; + stat = notmuch_database_open_with_config (argv[1], + NOTMUCH_DATABASE_MODE_READ_ONLY, + "", NULL, &db, &msg); + if (msg) fputs (msg, stderr); if (stat != NOTMUCH_STATUS_SUCCESS) { fprintf (stderr, "error opening database: %d\n", stat); } @@ -148,7 +173,9 @@ int main (int argc, char** argv) { notmuch_database_t *db; notmuch_status_t stat; - stat = notmuch_database_open (argv[1], NOTMUCH_DATABASE_MODE_READ_WRITE, &db); + stat = notmuch_database_open_with_config (argv[1], + NOTMUCH_DATABASE_MODE_READ_WRITE, + "", NULL, &db, NULL); if (stat != NOTMUCH_STATUS_SUCCESS) { fprintf (stderr, "error opening database: %d\n", stat); } @@ -206,7 +233,9 @@ int main (int argc, char** argv) char *msg = NULL; int fd; - stat = notmuch_database_open_verbose (argv[1], NOTMUCH_DATABASE_MODE_READ_WRITE, &db, &msg); + stat = notmuch_database_open_with_config (argv[1], + NOTMUCH_DATABASE_MODE_READ_WRITE, + NULL, NULL, &db, &msg); if (stat != NOTMUCH_STATUS_SUCCESS) { fprintf (stderr, "error opening database: %d %s\n", stat, msg ? msg : ""); exit (1); @@ -245,24 +274,6 @@ EOF test_expect_equal_file EXPECTED OUTPUT.clean restore_database -backup_database -test_begin_subtest "Xapian exception getting tags" -cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} ${POSTLIST_PATH} - { - notmuch_tags_t *tags = NULL; - tags = notmuch_database_get_all_tags (db); - stat = (tags == NULL); - } -EOF -sed 's/^\(A Xapian exception [^:]*\):.*$/\1/' < OUTPUT > OUTPUT.clean -cat <<'EOF' >EXPECTED -== stdout == -== stderr == -A Xapian exception occurred getting tags -EOF -test_expect_equal_file EXPECTED OUTPUT.clean -restore_database - backup_database test_begin_subtest "Xapian exception creating directory" cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} ${POSTLIST_PATH}