unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [PATCH 2/3] test: replace deprecated use of notmuch_database_open
Date: Sat, 21 May 2022 15:06:30 -0300	[thread overview]
Message-ID: <20220521180631.2419225-2-david@tethera.net> (raw)
In-Reply-To: <20220521180631.2419225-1-david@tethera.net>

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);
-- 
2.35.2

  reply	other threads:[~2022-05-21 18:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-21 18:06 [PATCH 1/3] test: replace deprecated use of notmuch_database_open_verbose David Bremner
2022-05-21 18:06 ` David Bremner [this message]
2022-05-21 18:06 ` [PATCH 3/3] test: replace deprecated use of notmuch_database_create David Bremner
2022-05-29 10:48 ` [PATCH 1/3] test: replace deprecated use of notmuch_database_open_verbose David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220521180631.2419225-2-david@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).