unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 1/3] test: replace deprecated use of notmuch_database_open_verbose
@ 2022-05-21 18:06 David Bremner
  2022-05-21 18:06 ` [PATCH 2/3] test: replace deprecated use of notmuch_database_open David Bremner
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: David Bremner @ 2022-05-21 18:06 UTC (permalink / raw)
  To: notmuch

We need to do it some day, and it is a bit annoying to read
deprecation messages in broken tests.
---
 test/T560-lib-error.sh     | 4 +++-
 test/T562-lib-database.sh  | 4 +++-
 test/T563-lib-directory.sh | 4 +++-
 test/T564-lib-query.sh     | 4 +++-
 test/T566-lib-message.sh   | 4 +++-
 test/T568-lib-thread.sh    | 4 +++-
 6 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh
index 1f4482cb..1d45dc7d 100755
--- a/test/T560-lib-error.sh
+++ b/test/T560-lib-error.sh
@@ -206,7 +206,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);
diff --git a/test/T562-lib-database.sh b/test/T562-lib-database.sh
index 2314efd2..64233c37 100755
--- a/test/T562-lib-database.sh
+++ b/test/T562-lib-database.sh
@@ -17,7 +17,9 @@ int main (int argc, char** argv)
    notmuch_status_t stat = NOTMUCH_STATUS_SUCCESS;
    char *msg = NULL;
 
-   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);
diff --git a/test/T563-lib-directory.sh b/test/T563-lib-directory.sh
index ebd7fcb2..22b9e0b9 100755
--- a/test/T563-lib-directory.sh
+++ b/test/T563-lib-directory.sh
@@ -18,7 +18,9 @@ int main (int argc, char** argv)
    notmuch_status_t stat = NOTMUCH_STATUS_SUCCESS;
    char *msg = NULL;
 
-   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);
diff --git a/test/T564-lib-query.sh b/test/T564-lib-query.sh
index ff1d4984..53a63bf6 100755
--- a/test/T564-lib-query.sh
+++ b/test/T564-lib-query.sh
@@ -17,7 +17,9 @@ int main (int argc, char** argv)
    notmuch_status_t stat;
    char *msg = NULL;
 
-   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);
diff --git a/test/T566-lib-message.sh b/test/T566-lib-message.sh
index 8b61d182..b6a9e536 100755
--- a/test/T566-lib-message.sh
+++ b/test/T566-lib-message.sh
@@ -29,7 +29,9 @@ int main (int argc, char** argv)
    notmuch_message_t *message = NULL;
    const char *id = "1258471718-6781-1-git-send-email-dottedmag@dottedmag.net";
 
-   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);
diff --git a/test/T568-lib-thread.sh b/test/T568-lib-thread.sh
index b45836cd..b4c24ca2 100755
--- a/test/T568-lib-thread.sh
+++ b/test/T568-lib-thread.sh
@@ -36,7 +36,9 @@ int main (int argc, char** argv)
    notmuch_query_t *query = NULL;
    const char *id = "${THREAD}";
 
-   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);
-- 
2.35.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] test: replace deprecated use of notmuch_database_open
  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
  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
  2 siblings, 0 replies; 4+ messages in thread
From: David Bremner @ 2022-05-21 18:06 UTC (permalink / raw)
  To: notmuch

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] test: replace deprecated use of notmuch_database_create
  2022-05-21 18:06 [PATCH 1/3] test: replace deprecated use of notmuch_database_open_verbose David Bremner
  2022-05-21 18:06 ` [PATCH 2/3] test: replace deprecated use of notmuch_database_open David Bremner
@ 2022-05-21 18:06 ` David Bremner
  2022-05-29 10:48 ` [PATCH 1/3] test: replace deprecated use of notmuch_database_open_verbose David Bremner
  2 siblings, 0 replies; 4+ messages in thread
From: David Bremner @ 2022-05-21 18:06 UTC (permalink / raw)
  To: notmuch

Like notmuch_database_open, we need to conditionally print the error
message.
---
 test/T560-lib-error.sh | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh
index 470537cc..80527afd 100755
--- a/test/T560-lib-error.sh
+++ b/test/T560-lib-error.sh
@@ -60,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
@@ -99,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
@@ -117,7 +123,10 @@ 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
-- 
2.35.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] test: replace deprecated use of notmuch_database_open_verbose
  2022-05-21 18:06 [PATCH 1/3] test: replace deprecated use of notmuch_database_open_verbose David Bremner
  2022-05-21 18:06 ` [PATCH 2/3] test: replace deprecated use of notmuch_database_open David Bremner
  2022-05-21 18:06 ` [PATCH 3/3] test: replace deprecated use of notmuch_database_create David Bremner
@ 2022-05-29 10:48 ` David Bremner
  2 siblings, 0 replies; 4+ messages in thread
From: David Bremner @ 2022-05-29 10:48 UTC (permalink / raw)
  To: notmuch

David Bremner <david@tethera.net> writes:

> We need to do it some day, and it is a bit annoying to read
> deprecation messages in broken tests.

series applied to master

d

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-29 10:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-21 18:06 [PATCH 1/3] test: replace deprecated use of notmuch_database_open_verbose David Bremner
2022-05-21 18:06 ` [PATCH 2/3] test: replace deprecated use of notmuch_database_open David Bremner
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

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).