r23172 - gnucash/trunk/src/backend/dbi/test - Work around differing pgsql protocol and dbi name

John Ralls jralls at code.gnucash.org
Tue Sep 17 19:25:12 EDT 2013


Author: jralls
Date: 2013-09-17 19:25:11 -0400 (Tue, 17 Sep 2013)
New Revision: 23172
Trac: http://svn.gnucash.org/trac/changeset/23172

Modified:
   gnucash/trunk/src/backend/dbi/test/test-backend-dbi-basic.c
Log:
Work around differing pgsql protocol and dbi name

Also silence postgres notices during test.

Modified: gnucash/trunk/src/backend/dbi/test/test-backend-dbi-basic.c
===================================================================
--- gnucash/trunk/src/backend/dbi/test/test-backend-dbi-basic.c	2013-09-17 23:24:31 UTC (rev 23171)
+++ gnucash/trunk/src/backend/dbi/test/test-backend-dbi-basic.c	2013-09-17 23:25:11 UTC (rev 23172)
@@ -224,6 +224,7 @@
     gchar *basename = NULL;
     gint portnum = 0;
     gchar *port = NULL;
+    gchar *pgsql = "pgsql";
     dbi_conn conn = NULL;
     gchar *errfmt = "Unable to delete tables in %s: %s";
     gint fail = 0;
@@ -232,7 +233,10 @@
 
     gnc_uri_get_components  (url, &protocol, &host, &portnum,
                              &username, &password, &dbname);
-    conn = dbi_conn_new (protocol);
+    if (g_strcmp0 (protocol, "postgres") == 0)
+	conn = dbi_conn_new (pgsql);
+    else
+	conn = dbi_conn_new (protocol);
     port = g_strdup_printf ("%d", portnum);
     if (conn == NULL)
     {
@@ -240,7 +244,7 @@
         return;
     }
     fail = dbi_conn_set_option (conn, "host", host);
-    if (!fail)
+    if (!fail && portnum)
         fail = dbi_conn_set_option (conn, "port", port);
     if (!fail)
         fail = dbi_conn_set_option (conn, "dbname", dbname);
@@ -580,6 +584,9 @@
     if (strlen (TEST_MYSQL_URL) > 0)
         create_dbi_test_suite ("mysql", TEST_MYSQL_URL);
     if (strlen (TEST_PGSQL_URL) > 0)
+    {
+	g_setenv ("PGOPTIONS", "-c client_min_messages=WARNING", FALSE);
         create_dbi_test_suite ("postgres", TEST_PGSQL_URL);
+    }
 
 }



More information about the gnucash-changes mailing list