unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob 28fef585ac9e257d4a8bc1fce8ab044d939fc12b 2986 bytes (raw)
name: packages/patches/libgda-skip-postgresql-tests.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
 
Taken from upstream.

From b0cd77e588620465b78f7c017d3f240e13936aa3 Mon Sep 17 00:00:00 2001
From: Pavlo Solntsev <p.sun.fun@gmail.com>
Date: Sun, 19 Sep 2021 22:51:38 -0500
Subject: [PATCH] Test: Skip test if no server available

Two variables will be checked. If they set
and provide all needed information the test
will be executed. If they are not set, the test
will return TRUE and will terminate with
termination status EXIT_SUCCESS.
---
 tests/db/check-db-catalog-postgresql.c   | 16 ++++++++++++++++
 tests/test-server-operation-postgresql.c | 16 ++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/tests/db/check-db-catalog-postgresql.c b/tests/db/check-db-catalog-postgresql.c
index 5b8e9395c..bf9a8942c 100644
--- a/tests/db/check-db-catalog-postgresql.c
+++ b/tests/db/check-db-catalog-postgresql.c
@@ -25,6 +25,9 @@
 #include <libgda/libgda.h>
 #include "../test-cnc-utils.h"
 
+#define PROVIDER_DB_CREATE_PARAMS "POSTGRESQL_DBCREATE_PARAMS"
+#define PROVIDER_CNC_PARAMS "POSTGRESQL_CNC_PARAMS"
+
 typedef struct {
   GdaDbCatalog *catalog;
   GdaConnection *cnc;
@@ -359,6 +362,19 @@ main (gint   argc,
 {
   setlocale (LC_ALL,"");
 
+  const gchar *db_create_str;
+  const gchar *cnc_params;
+
+  db_create_str = g_getenv (PROVIDER_DB_CREATE_PARAMS);
+  cnc_params = g_getenv (PROVIDER_CNC_PARAMS);
+
+  if (!db_create_str || !cnc_params) {
+      g_print ("Please set POSTGRESQL_DBCREATE_PARAMS and POSTGRESQL_CNC_PARAMS variable"
+	      "with dbname, host, user and port (usually 5432)\n");
+      g_print ("Test will not be performed\n");
+      return EXIT_SUCCESS;
+  }
+
   g_test_init (&argc,&argv,NULL);
 
   g_test_add ("/test-db-postgresql/meta-tables",
diff --git a/tests/test-server-operation-postgresql.c b/tests/test-server-operation-postgresql.c
index 37796c4be..860f41a18 100644
--- a/tests/test-server-operation-postgresql.c
+++ b/tests/test-server-operation-postgresql.c
@@ -38,9 +38,12 @@
 #include <glib/gi18n.h>
 #include <locale.h>
 #include <libgda/libgda.h>
+/*#include <stdlib.h>*/
 #include "test-cnc-utils.h"
 
 #define PROVIDER_NAME "PostgreSQL"
+#define PROVIDER_DB_CREATE_PARAMS "POSTGRESQL_DBCREATE_PARAMS"
+#define PROVIDER_CNC_PARAMS "POSTGRESQL_CNC_PARAMS"
 
 #define GDA_PGSQL_ERROR_HANDLE(e) (g_print("Error: %s: %s\n", G_STRLOC, e && e->message ? e->message : "No default"));
 
@@ -1335,6 +1338,19 @@ main(gint argc, gchar *argv[])
 {
   setlocale (LC_ALL,"");
 
+  const gchar *db_create_str;
+  const gchar *cnc_params;
+
+  db_create_str = g_getenv (PROVIDER_DB_CREATE_PARAMS);
+  cnc_params = g_getenv (PROVIDER_CNC_PARAMS);
+
+  if (!db_create_str || !cnc_params) {
+      g_print ("Please set POSTGRESQL_DBCREATE_PARAMS and POSTGRESQL_CNC_PARAMS variable"
+	      "with dbname, host, user and port (usually 5432)\n");
+      g_print ("Test will not be performed\n");
+      return EXIT_SUCCESS;
+  }
+
   g_test_init (&argc,&argv,NULL);
 
   g_test_add ("/test-server-operation-sqlite/old-so-module",
-- 
GitLab


debug log:

solving 28fef585ac9e257d4a8bc1fce8ab044d939fc12b ...
found 28fef585ac9e257d4a8bc1fce8ab044d939fc12b in https://git.savannah.gnu.org/cgit/guix.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.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).