From 32f299fe137a4ac731750d576e65337b395a42ef Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sat, 21 May 2022 15:06:30 -0300 Subject: [PATCH] test: replace deprecated use of notmuch_database_open This is a bit more involved than replacing the use of notmuch_database_open_verbose, as we have to effectively inline the definition of notmuch_database_open. --- test/T560-lib-error.sh | 28 +++++++++++++++++++++++----- test/T570-revision-tracking.sh | 7 ++++++- test/T610-message-property.sh | 6 +++++- test/T620-lock.sh | 14 ++++++++++++-- test/T640-database-modified.sh | 12 ++++++++++-- test/T720-lib-lifetime.sh | 8 +++++++- 6 files changed, 63 insertions(+), 12 deletions(-) diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh index 1d45dc7d..470537cc 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 @@ -70,7 +78,11 @@ 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 @@ -123,7 +135,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 +164,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); } diff --git a/test/T570-revision-tracking.sh b/test/T570-revision-tracking.sh index a59e7c98..e1cc684d 100755 --- a/test/T570-revision-tracking.sh +++ b/test/T570-revision-tracking.sh @@ -19,7 +19,12 @@ int main (int argc, char** argv) unsigned long rev; - 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) fputs ("open failed\n", stderr); revision = notmuch_database_get_revision (db, &uuid); diff --git a/test/T610-message-property.sh b/test/T610-message-property.sh index 4ec85474..2685f3b5 100755 --- a/test/T610-message-property.sh +++ b/test/T610-message-property.sh @@ -23,8 +23,12 @@ int main (int argc, char** argv) notmuch_message_t *message = NULL; const char *val; notmuch_status_t stat; + char* msg = NULL; - EXPECT0(notmuch_database_open (argv[1], NOTMUCH_DATABASE_MODE_READ_WRITE, &db)); + EXPECT0(notmuch_database_open_with_config (argv[1], + NOTMUCH_DATABASE_MODE_READ_WRITE, + "", NULL, &db, &msg)); + if (msg) fputs (msg, stderr); EXPECT0(notmuch_database_find_message(db, "4EFC743A.3060609@april.org", &message)); if (message == NULL) { fprintf (stderr, "unable to find message"); diff --git a/test/T620-lock.sh b/test/T620-lock.sh index 8f4c380f..99cc7010 100755 --- a/test/T620-lock.sh +++ b/test/T620-lock.sh @@ -40,15 +40,25 @@ main (int argc, char **argv) if (child == 0) { notmuch_database_t *db2; + char* msg = NULL; sleep (1); - EXPECT0 (notmuch_database_open (path, NOTMUCH_DATABASE_MODE_READ_WRITE, &db2)); + + EXPECT0(notmuch_database_open_with_config (argv[1], + NOTMUCH_DATABASE_MODE_READ_WRITE, + "", NULL, &db2, &msg)); + if (msg) fputs (msg, stderr); + taggit (db2, "child"); EXPECT0 (notmuch_database_close (db2)); } else { notmuch_database_t *db; + char* msg = NULL; - EXPECT0 (notmuch_database_open (path, NOTMUCH_DATABASE_MODE_READ_WRITE, &db)); + EXPECT0(notmuch_database_open_with_config (argv[1], + NOTMUCH_DATABASE_MODE_READ_WRITE, + "", NULL, &db, &msg)); + if (msg) fputs (msg, stderr); taggit (db, "parent"); sleep (2); EXPECT0 (notmuch_database_close (db)); diff --git a/test/T640-database-modified.sh b/test/T640-database-modified.sh index 636b20c7..2c3fa735 100755 --- a/test/T640-database-modified.sh +++ b/test/T640-database-modified.sh @@ -23,14 +23,22 @@ main (int argc, char **argv) notmuch_query_t *query; notmuch_tags_t *tags; int i; + char* msg = NULL; - EXPECT0 (notmuch_database_open (path, NOTMUCH_DATABASE_MODE_READ_ONLY, &ro_db)); + EXPECT0(notmuch_database_open_with_config (argv[1], + NOTMUCH_DATABASE_MODE_READ_ONLY, + "", NULL, &ro_db, &msg)); + if (msg) fputs (msg, stderr); assert(ro_db); EXPECT0 (notmuch_database_find_message (ro_db, "${first_id}", &ro_message)); assert(ro_message); - EXPECT0 (notmuch_database_open (path, NOTMUCH_DATABASE_MODE_READ_WRITE, &rw_db)); + EXPECT0(notmuch_database_open_with_config (argv[1], + NOTMUCH_DATABASE_MODE_READ_WRITE, + "", NULL, &rw_db, &msg)); + if (msg) fputs (msg, stderr); + query = notmuch_query_create(rw_db, ""); EXPECT0 (notmuch_query_search_messages (query, &messages)); diff --git a/test/T720-lib-lifetime.sh b/test/T720-lib-lifetime.sh index 3d94d4df..e5afeaa2 100755 --- a/test/T720-lib-lifetime.sh +++ b/test/T720-lib-lifetime.sh @@ -23,7 +23,13 @@ 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); exit (1);