[libgda] ci: add enable ci environment to tests



commit 509790f5d8893a405b1bf5a1b56edb3715b3fb69
Author: Daniel Espinosa Ortiz <esodan gmail com>
Date:   Fri Dec 14 16:51:51 2018 -0600

    ci: add enable ci environment to tests

 .gitlab-ci.yml                           |  2 +-
 libgda/gda-connection.c                  |  4 ++--
 meson.build                              |  4 ----
 tests/ddl/check-ddl-creator-postgresql.c | 29 +++++++++++------------------
 tests/ddl/meson.build                    |  3 ++-
 tests/meson.build                        | 10 ++++++++++
 tests/meta-store/meson.build             |  1 +
 7 files changed, 27 insertions(+), 26 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ab9dd34ea..1ff0f3fa8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -78,7 +78,7 @@ autotools_build:
 meson_build:
   stage: build
   script:
-  - meson _build --prefix=/usr
+  - meson _build --prefix=/usr -Denable-ci-environment=true
   - cd _build
   - ninja
   - broadwayd &
diff --git a/libgda/gda-connection.c b/libgda/gda-connection.c
index 95762a83c..c7985ac9c 100644
--- a/libgda/gda-connection.c
+++ b/libgda/gda-connection.c
@@ -5190,7 +5190,7 @@ prepare_meta_statements_hash (void)
 }
 
 /**
- * gda_connection_get_meta_store_data:
+ * gda_connection_get_meta_store_data: (skip)
  * @cnc: a #GdaConnection object.
  * @meta_type: describes which data to get.
  * @error: a place to store errors, or %NULL
@@ -5270,7 +5270,7 @@ gda_connection_get_meta_store_data (GdaConnection *cnc,
 }
 
 /**
- * gda_connection_get_meta_store_data_v:
+ * gda_connection_get_meta_store_data_v: (rename-to get_meta_store_data)
  * @cnc: a #GdaConnection object.
  * @meta_type: describes which data to get.
  * @error: a place to store errors, or %NULL
diff --git a/meson.build b/meson.build
index 19e823ce1..d276dc420 100644
--- a/meson.build
+++ b/meson.build
@@ -244,10 +244,6 @@ if get_option('enable-debug')
   c_args += '-DGDA_DEBUG'
 endif
 
-if get_option('enable-ci-environment')
-  c_args += '-DCI_ENVIRONMENT'
-endif
-
 add_global_arguments(c_args, language : 'c')
 
 # Files references by sqlite embedded and provider
diff --git a/tests/ddl/check-ddl-creator-postgresql.c b/tests/ddl/check-ddl-creator-postgresql.c
index b861cb102..dd6bb7084 100644
--- a/tests/ddl/check-ddl-creator-postgresql.c
+++ b/tests/ddl/check-ddl-creator-postgresql.c
@@ -26,9 +26,9 @@
 
 typedef struct {
   GdaDdlCreator *creator;
-  gchar *xmlfile;
   GdaConnection *cnc;
   gboolean started_db;
+  gboolean cont;
 } CheckDdlObject;
 
 
@@ -219,22 +219,10 @@ test_ddl_creator_start (CheckDdlObject *self,
                      gconstpointer user_data)
 {
   gda_init();
-  self->xmlfile = NULL;
   self->creator = NULL;
   self->cnc = NULL;
   self->started_db = FALSE;
-
-  const gchar *topsrcdir = g_getenv ("GDA_TOP_SRC_DIR");
-
-  g_print ("ENV: %s\n",topsrcdir);
-  g_assert_nonnull (topsrcdir);
-
-  self->xmlfile = g_build_filename(topsrcdir,
-                                   "tests",
-                                   "ddl",
-                                   "ddl-db.xml",NULL);
-
-  g_assert_nonnull (self->xmlfile);
+  self->cont = FALSE;
 
 #ifdef CI_ENVIRONMENT
   const gchar *cnc_string = "DB_NAME=test;HOST=postgres;USERNAME=test;PASSWORD=test1";
@@ -266,16 +254,18 @@ test_ddl_creator_start (CheckDdlObject *self,
   create_users_table (self);
   create_companies_table (self);
   create_countries_table (self);
+  self->cont = TRUE;
 }
 
 static void
 test_ddl_creator_finish (CheckDdlObject *self,
                       gconstpointer user_data)
 {
-  gda_connection_close(self->cnc,NULL);
-  g_free (self->xmlfile);
-  g_object_unref (self->creator);
-  g_object_unref (self->cnc);
+  if (self->cnc != NULL) {
+    gda_connection_close(self->cnc,NULL);
+    g_object_unref (self->creator);
+    g_object_unref (self->cnc);
+  }
 }
 
 
@@ -283,6 +273,9 @@ static void
 test_tables (CheckDdlObject *self,
              gconstpointer user_data)
 {
+  if (!self->cont) {
+    g_message ("Test skiped");
+  }
   g_message ("Testing Tables...");
   if (self->cnc == NULL) {
       return;
diff --git a/tests/ddl/meson.build b/tests/ddl/meson.build
index dbd8a5ff5..7d3f6aff7 100644
--- a/tests/ddl/meson.build
+++ b/tests/ddl/meson.build
@@ -153,7 +153,8 @@ tcpg = executable('check-ddl-creator-postgresql',
                '-include',
                meson.build_root() + '/config.h',
                '-DCHECK_FILES="'+meson.source_root()+'"',
-               '-DTOP_BUILD_DIR="'+meson.build_root()+'"'
+               '-DTOP_BUILD_DIR="'+meson.build_root()+'"',
+               ci_args
                ],
        link_with: libgda,
        dependencies: [
diff --git a/tests/meson.build b/tests/meson.build
index 730e3a506..f7558bcbc 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,3 +1,13 @@
+
+ci_args = []
+
+if get_option('enable-ci-environment')
+       ci_args += [
+               '-DCI_ENVIRONMENT'
+               ]
+endif
+
+
 test_headers = files([
        'raw-ddl-creator.h'
        ])
diff --git a/tests/meta-store/meson.build b/tests/meta-store/meson.build
index f59da3574..33998fcec 100644
--- a/tests/meta-store/meson.build
+++ b/tests/meta-store/meson.build
@@ -56,6 +56,7 @@ tchkmstspg = executable('check_meta_store_postgresql',
                '-include',
                meson.build_root() + '/config.h',
                '-DTOP_SRC_DIR="'+meson.source_root()+'"',
+               ci_args
                ],
        link_with: libgda,
        dependencies: [


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]