libgda r3102 - in trunk: . doc/C doc/C/tmpl libgda tests/meta-store tests/providers



Author: vivien
Date: Wed Mar 26 20:36:51 2008
New Revision: 3102
URL: http://svn.gnome.org/viewvc/libgda?rev=3102&view=rev

Log:
2008-03-26  Vivien Malerba <malerba gnome-db org>

	* libgda/gda-config.c: don't write a warning when configuration file does not load, and use
	the GDA_TOP_BUILD_DIR environment variable if set (instead of GDA_PROVIDERS_ROOT_DIR) to
	find database providers (used when running check tests)
	* libgda/gda-meta-store.c: use the GDA_TOP_SRC_DIR environment variable if set to find
	the information_schema.xml file (used when running check tests)
	* libgda/gda-init.c: use the GDA_TOP_SRC_DIR environment variable if set to find
	the DTD files (used when running check tests)
	* tests/meta-store/Makefile.am:
	* tests/meta-store/common.c:
	* tests/meta-store/check_meta_store_sqlite.c:
	* tests/meta-store/check_meta_store_postgresql.c:
	* tests/meta-store/check_meta_store_mysql.c:
	* tests/meta-store/check_meta_store_memory.c:
	* tests/providers/check_sqlite.c:
	* tests/providers/check_oracle.c:
	* tests/providers/check_odbc.c:
	* tests/providers/check_msql.c:
	* tests/providers/check_ldap.c:
	* tests/providers/check_firebird.c:
	* tests/providers/check_sybase.c:
	* tests/providers/check_bdb.c:
	* tests/providers/check_mdb.c:
	* tests/providers/check_xbase.c:
	* tests/providers/check_mysql.c:
	* tests/providers/check_postgres.c:
	* tests/providers/Makefile.am:
	* tests/providers/check_freetds.c:
	* tests/providers/check_ibmdb2.c: set the GDA_TOP_SRC_DIR and GDA_TOP_BUILD_DIR
	environment variables
	* doc/C: doc. updates
	* libgda/gda-config.c: restored the V3 behaviour of creating the ${HOME}/.libgda config
	dir if it does not yet exist.
	* libgda/gda-data-model-dsn-list.c: fixed warning if DSN does not have any authentification string


Modified:
   trunk/ChangeLog
   trunk/doc/C/libgda-4.0-docs.sgml
   trunk/doc/C/migration2.xml
   trunk/doc/C/tmpl/gda-config.sgml
   trunk/libgda/gda-config.c
   trunk/libgda/gda-data-model-dsn-list.c
   trunk/libgda/gda-init.c
   trunk/libgda/gda-meta-store.c
   trunk/tests/meta-store/Makefile.am
   trunk/tests/meta-store/check_meta_store_memory.c
   trunk/tests/meta-store/check_meta_store_mysql.c
   trunk/tests/meta-store/check_meta_store_postgresql.c
   trunk/tests/meta-store/check_meta_store_sqlite.c
   trunk/tests/meta-store/common.c
   trunk/tests/providers/Makefile.am
   trunk/tests/providers/check_bdb.c
   trunk/tests/providers/check_firebird.c
   trunk/tests/providers/check_freetds.c
   trunk/tests/providers/check_ibmdb2.c
   trunk/tests/providers/check_ldap.c
   trunk/tests/providers/check_mdb.c
   trunk/tests/providers/check_msql.c
   trunk/tests/providers/check_mysql.c
   trunk/tests/providers/check_odbc.c
   trunk/tests/providers/check_oracle.c
   trunk/tests/providers/check_postgres.c
   trunk/tests/providers/check_sqlite.c
   trunk/tests/providers/check_sybase.c
   trunk/tests/providers/check_xbase.c

Modified: trunk/doc/C/libgda-4.0-docs.sgml
==============================================================================
--- trunk/doc/C/libgda-4.0-docs.sgml	(original)
+++ trunk/doc/C/libgda-4.0-docs.sgml	Wed Mar 26 20:36:51 2008
@@ -437,10 +437,6 @@
 		displayed on STDOUT</para>
 	    </listitem>
 	    <listitem>
-              <para>GDA_DSN_LIST_IN_MEMORY: if set, then the list of defined data sources (DSN) will remain in 
-	      memory (will not be written to disk) and will be lost when the application terminates.</para>
-	    </listitem>
-	    <listitem>
               <para>GDA_PROVIDERS_ROOT_DIR: if set, must point to the directory where the providers files are (providers
 	      files are shared libraries)</para>
 	    </listitem>

Modified: trunk/doc/C/migration2.xml
==============================================================================
--- trunk/doc/C/migration2.xml	(original)
+++ trunk/doc/C/migration2.xml	Wed Mar 26 20:36:51 2008
@@ -68,6 +68,20 @@
   </sect1>  
 
   <sect1><title>Other changes</title>
+    <sect2><title>Configuration management</title>
+      <para>
+	<itemizedlist>
+	  <listitem><para>Data sources and installed providers are now handled using the 
+	      <link linkend="GdaConfig">GdaConfig</link> object, with the particularity that there can only be one 
+	      such object instanciated per program.</para></listitem>
+	  <listitem><para>The GDA_DSN_LIST_IN_MEMORY environment variable which , if set, prevented &LIBGDA; from
+	      writing the list of defined data sources to a file has been removed. To obtain the same result,
+	      one must force the creation of the unique <link linkend="GdaConfig">GdaConfig</link> object with
+	      the <link linkend="GdaConfig--user-file">user-file</link> property set to NULL.</para></listitem>
+	</itemizedlist>
+      </para>
+    </sect2>
+
     <sect2><title>API changes</title>
       <para>
 	<itemizedlist>
@@ -75,7 +89,7 @@
 	      <link linkend="gda-connection-open-from-dsn">gda_connection_open_from_dsn ()</link> or
 	      <link linkend="gda-connection-open-from-string">gda_connection_open_from_string () depending
 		on how the connection is defined</link></para></listitem>
-	  <listitem><para>Upon opening a connection, the <argument>username</argument> and <argument>password</argument>
+	  <listitem><para>Upon opening a connection, the <parameter>username</parameter> and <parameter>password</parameter>
 	      arguments have heen replaced by a more flexible arguments passing mechanism where providers can specify
 	      what authorization parameters they use</para></listitem>
  	  <listitem><para>gda_server_provider_get_last_insert_id() has been removed in favor of the "last_insert_row" argument

Modified: trunk/doc/C/tmpl/gda-config.sgml
==============================================================================
--- trunk/doc/C/tmpl/gda-config.sgml	(original)
+++ trunk/doc/C/tmpl/gda-config.sgml	Wed Mar 26 20:36:51 2008
@@ -11,9 +11,27 @@
   configured in the system, for instance.
 </para>
 <para>
-  Upon initialization, a single instance <link linkend="GdaConfig">GdaConfig</link> object is created, 
+  As soon as a <link linkend="GdaConfig">GdaConfig</link> is needed (for example when requesting information
+  about a data source or about a server provider), a single instance object is created, 
   and no other will need to be created. A pointer to this object can be obtained with
-  <link linkend="gda-config-get">gda_config_get()</link>.
+  <link linkend="gda-config-get">gda_config_get()</link>. Of course one can (right after having called
+  <link linkend="gda-init">gda_init()</link>) force the creation of a GdaConfig object with some
+  specific properties set, using a simple call like:
+  <programlisting>
+g_object_new (GDA_TYPE_CONFIG, "user-file", "my_file", NULL);
+  </programlisting>
+  Please note that after that call, the caller has a reference to the newly created object, and should technically
+  call <link linkend="g-object-unref">g_object_unref()</link> when finished using it. It is safe to do this
+  but also poinless since that object should not be destroyed (as no other will be created) as &LIBGDA; also
+  keeps a reference for itself.
+</para>
+<para>
+  Data sources are defined in a per-user configuration file which is by default <filename>${HOME}/.libgda/config</filename> and
+  in a system wide configuration file which is by default <filename>${prefix}/etc/libgda-4.0/config</filename>. Those
+  filenames can be modified by setting the <link linkend="GdaConfig--user-file">user-file</link> and 
+  <link linkend="GdaConfig--system-file">system-file</link> properties for the single <link linkend="GdaConfig">GdaConfig</link>
+  instance. Note that setting either of these properties to <literal>NULL</literal> will disable using the corresponding
+  configuration file (DSN will exist only in memory and their definition will be lost when the application finishes).
 </para>
 
 <!-- ##### SECTION See_Also ##### -->

Modified: trunk/libgda/gda-config.c
==============================================================================
--- trunk/libgda/gda-config.c	(original)
+++ trunk/libgda/gda-config.c	Wed Mar 26 20:36:51 2008
@@ -77,7 +77,7 @@
 static void data_source_info_free (GdaDataSourceInfo *info);
 static void internal_provider_free (InternalProvider *ip);
 static void load_config_file (const gchar *file, gboolean is_system);
-static void save_config_file (const gchar *file, gboolean is_system);
+static void save_config_file (gboolean is_system);
 static void load_all_providers (void);
 
 enum {
@@ -202,10 +202,9 @@
 	xmlNodePtr root;
 
 	doc = xmlParseFile (file);
-	if (!doc) {
-		g_warning (_("Could not load config file '%s'"), file);
+	if (!doc) 
 		return;
-	}
+
 	root = xmlDocGetRootElement (doc);
 	if (root) {
 		xmlNodePtr node;
@@ -299,7 +298,7 @@
 }
 
 static void
-save_config_file (const gchar *file, gboolean is_system)
+save_config_file (gboolean is_system)
 {
 	xmlDocPtr doc;
 	xmlNodePtr root;
@@ -389,11 +388,11 @@
 			GObjectConstructParam *prop = &(construct_properties[i]);
 			if (!strcmp (g_param_spec_get_name (prop->pspec), "user_file")) {
 				user_file_set = TRUE;
-				g_print ("GdaConfig user dir set\n");
+				/*g_print ("GdaConfig user dir set\n");*/
 			}
 			else if (!strcmp (g_param_spec_get_name (prop->pspec), "system_file")) {
 				system_file_set = TRUE;
-				g_print ("GdaConfig system dir set\n");
+				/*g_print ("GdaConfig system dir set\n");*/
 			}
 		}
 
@@ -402,9 +401,80 @@
 
 		/* define user and system dirs. if not already defined */
 		if (!user_file_set) {
-			if (g_get_home_dir ()) 
-				unique_instance->priv->user_file = g_build_filename (g_get_home_dir (),
-										    ".libgda", "config", NULL);
+			if (g_get_home_dir ()) {
+				gchar *confdir, *conffile;
+				gboolean setup_ok = TRUE;
+				confdir = g_build_path (G_DIR_SEPARATOR_S, g_get_home_dir (), ".libgda", NULL);
+				conffile = g_build_filename (g_get_home_dir (), ".libgda", "config", NULL);
+
+				if (!g_file_test (confdir, G_FILE_TEST_EXISTS)) {
+#ifdef LIBGDA_WIN32
+					if (mkdir (confdir))
+#else
+					if (mkdir (confdir, 0700))
+#endif
+						{
+							setup_ok = FALSE;
+							g_warning (_("Error creating user specific "
+								     "configuration directory '%s'"), 
+								   confdir);
+						}
+					if (setup_ok) {
+						gchar *str;
+						gchar *full_file;
+						gsize len;
+#define DB_FILE "sales_test.db"
+#define DEFAULT_CONFIG \
+"<?xml version=\"1.0\"?>\n" \
+"<libgda-config>\n" \
+"    <section path=\"/apps/libgda/Datasources/SalesTest\">\n" \
+"        <entry name=\"DSN\" type=\"string\" value=\"DB_DIR=%s;DB_NAME=sales_test.db\"/>\n" \
+"        <entry name=\"Description\" type=\"string\" value=\"Test database for a sales department\"/>\n" \
+"        <entry name=\"Provider\" type=\"string\" value=\"SQLite\"/>\n" \
+"    </section>\n" \
+"</libgda-config>\n"
+#define DEFAULT_CONFIG_EMPTY \
+"<?xml version=\"1.0\"?>\n" \
+"<libgda-config>\n" \
+"    <!-- User specific data sources go here -->\n" \
+"</libgda-config>\n"
+
+						str = gda_gbr_get_file_path (GDA_ETC_DIR, 
+									     LIBGDA_ABI_NAME, DB_FILE, NULL);
+						if (g_file_get_contents (str, &full_file, &len, NULL)) {
+							gchar *dbfile;
+							
+							/* copy the Sales test database */
+							dbfile = g_build_filename (confdir, DB_FILE, NULL);
+							if (g_file_set_contents (dbfile, full_file, len, NULL)) {
+								gchar *str2;
+								str2 = g_strdup_printf (DEFAULT_CONFIG, confdir);
+								g_file_set_contents (conffile, str2, -1, NULL);
+								g_free (str2);
+							}
+							else
+								g_file_set_contents (conffile, DEFAULT_CONFIG_EMPTY, -1, NULL);
+							g_free (dbfile);
+							g_free (full_file);
+						}
+						else 
+							g_file_set_contents (conffile, DEFAULT_CONFIG_EMPTY, -1, NULL);
+						g_free (str);
+					}
+				}
+				else if (!g_file_test (confdir, G_FILE_TEST_IS_DIR)) {
+					setup_ok = FALSE;
+					g_warning (_("User specific "
+						     "configuration directory '%s' exists and is not a directory"), 
+						   confdir);
+				}
+				g_free (confdir);
+
+				if (setup_ok)
+					unique_instance->priv->user_file = conffile;
+				else
+					g_free (conffile);
+			}
 		}
 		if (!system_file_set) 
 			unique_instance->priv->system_file = gda_gbr_get_file_path (GDA_ETC_DIR, 
@@ -714,9 +784,9 @@
 	}
 	
 	if (save_system)
-		save_config_file (unique_instance->priv->system_file, TRUE);
+		save_config_file (TRUE);
 	if (save_user)
-		save_config_file (unique_instance->priv->user_file, FALSE);
+		save_config_file (FALSE);
 
 	GDA_CONFIG_UNLOCK ();
 	return TRUE;
@@ -769,9 +839,9 @@
 	data_source_info_free (info);
 	
 	if (save_system)
-		save_config_file (unique_instance->priv->system_file, TRUE);
+		save_config_file (TRUE);
 	if (save_user)
-		save_config_file (unique_instance->priv->user_file, FALSE);
+		save_config_file (FALSE);
 
 	GDA_CONFIG_UNLOCK ();
 	return TRUE;
@@ -1085,16 +1155,18 @@
 	const gchar *dirname;
 	g_assert (unique_instance);
 
-	dirname = getenv ("GDA_PROVIDERS_ROOT_DIR");
-	if (dirname)
-		load_providers_from_dir (dirname, TRUE);
+	dirname = g_getenv ("GDA_TOP_BUILD_DIR");
+	if (dirname) {
+		gchar *pdir;
+		pdir = g_build_path (G_DIR_SEPARATOR_S, dirname, "providers", NULL);
+		load_providers_from_dir (pdir, TRUE);
+	}
 	else {
 		gchar *str;
 		str = gda_gbr_get_file_path (GDA_LIB_DIR, LIBGDA_ABI_NAME, "providers", NULL);
 		load_providers_from_dir (str, FALSE);
 		g_free (str);
 	}
-
 }
 
 static void 

Modified: trunk/libgda/gda-data-model-dsn-list.c
==============================================================================
--- trunk/libgda/gda-data-model-dsn-list.c	(original)
+++ trunk/libgda/gda-data-model-dsn-list.c	Wed Mar 26 20:36:51 2008
@@ -309,14 +309,17 @@
 		case 3:
 			g_value_set_string (val, info->cnc_string);
 			break;
-		case 4: {
-			GdaQuarkList* ql;
-			ql = gda_quark_list_new_from_string (info->auth_string);
-			
-			g_value_set_string (val, gda_quark_list_find (ql, "USERNAME"));
-			gda_quark_list_free (ql);
+		case 4: 
+			if (info->auth_string) {
+				GdaQuarkList* ql;
+				ql = gda_quark_list_new_from_string (info->auth_string);
+				
+				g_value_set_string (val, gda_quark_list_find (ql, "USERNAME"));
+				gda_quark_list_free (ql);
+			}
+			else
+				g_value_set_string (val, "");
 			break;
-		}
 		case 5:
 			g_value_set_boolean (val, info->is_system);
 			break;

Modified: trunk/libgda/gda-init.c
==============================================================================
--- trunk/libgda/gda-init.c	(original)
+++ trunk/libgda/gda-init.c	Wed Mar 26 20:36:51 2008
@@ -109,34 +109,56 @@
 	/* array DTD */
 	file = gda_gbr_get_file_path (GDA_DATA_DIR, LIBGDA_ABI_NAME, "dtd", "libgda-array.dtd", NULL);
 	gda_array_dtd = xmlParseDTD (NULL, (xmlChar*)file);
+	if (!gda_array_dtd) {
+		if (g_getenv ("GDA_TOP_SRC_DIR")) {
+			g_free (file);
+			file = g_build_filename (g_getenv ("GDA_TOP_SRC_DIR"), "libgda", "libgda-array.dtd", NULL);
+			gda_array_dtd = xmlParseDTD (NULL, (xmlChar*)file);
+		}
+		if (!gda_array_dtd)
+			g_message (_("Could not parse '%s': "
+				     "XML data import validation will not be performed (some weird errors may occur)"),
+				   file);
+	}
 	if (gda_array_dtd)
 		gda_array_dtd->name = xmlStrdup((xmlChar*) "gda_array");
-	else
-		g_message (_("Could not parse '%s': "
-			     "XML data import validation will not be performed (some weird errors may occur)"),
-			   file);
 	g_free (file);
 
 	/* paramlist DTD */
 	file = gda_gbr_get_file_path (GDA_DATA_DIR, LIBGDA_ABI_NAME, "dtd", "libgda-paramlist.dtd", NULL);
 	gda_paramlist_dtd = xmlParseDTD (NULL, (xmlChar*)file);
+	if (!gda_paramlist_dtd) {
+		if (g_getenv ("GDA_TOP_SRC_DIR")) {
+			g_free (file);
+			file = g_build_filename (g_getenv ("GDA_TOP_SRC_DIR"), "libgda", "libgda-paramlist.dtd", NULL);
+			gda_paramlist_dtd = xmlParseDTD (NULL, (xmlChar*)file);
+		}
+		if (!gda_paramlist_dtd)
+			g_message (_("Could not parse '%s': "
+				     "XML data import validation will not be performed (some weird errors may occur)"),
+				   file);
+	}
 	if (gda_paramlist_dtd)
 		gda_paramlist_dtd->name = xmlStrdup((xmlChar*) "data-set-spec");
-	else
-		g_message (_("Could not parse '%s': "
-			     "XML data import validation will not be performed (some weird errors may occur)"),
-			   file);
 	g_free (file);
 
 	/* server operation DTD */
 	file = gda_gbr_get_file_path (GDA_DATA_DIR, LIBGDA_ABI_NAME, "dtd", "libgda-server-operation.dtd", NULL);
 	gda_server_op_dtd = xmlParseDTD (NULL, (xmlChar*)file);
+	if (!gda_server_op_dtd) {
+		if (g_getenv ("GDA_TOP_SRC_DIR")) {
+			g_free (file);
+			file = g_build_filename (g_getenv ("GDA_TOP_SRC_DIR"), "libgda", "libgda-server-operation.dtd", NULL);
+			gda_server_op_dtd = xmlParseDTD (NULL, (xmlChar*)file);
+		}
+		if (!gda_server_op_dtd)
+			g_message (_("Could not parse '%s': "
+				     "Validation for XML files for server operations will not be performed (some weird errors may occur)"),
+				   file);
+	}
+
 	if (gda_server_op_dtd)
 		gda_server_op_dtd->name = xmlStrdup((xmlChar*) "serv_op");
-	else
-		g_message (_("Could not parse '%s': "
-			     "Validation for XML files for server operations will not be performed (some weird errors may occur)"),
-			   file);
 	g_free (file);
 
 	initialized = TRUE;

Modified: trunk/libgda/gda-meta-store.c
==============================================================================
--- trunk/libgda/gda-meta-store.c	(original)
+++ trunk/libgda/gda-meta-store.c	Wed Mar 26 20:36:51 2008
@@ -943,8 +943,16 @@
 	file = gda_gbr_get_file_path (GDA_DATA_DIR, LIBGDA_ABI_NAME, "information_schema.xml", NULL);
 	doc = xmlParseFile (file);
 	if (!doc) {
-		g_warning ("Missing or malformed file '%s', check your installation", file);
-		return;
+		if (g_getenv ("GDA_TOP_SRC_DIR")) {
+			g_free (file);
+			file = g_build_filename (g_getenv ("GDA_TOP_SRC_DIR"), "libgda", "information_schema.xml", NULL);
+			doc = xmlParseFile (file);
+		}
+		if (!doc) {
+			g_warning ("Missing or malformed file '%s', check your installation", file);
+			g_free (file);
+			return;
+		}
 	}
 	
 	node = xmlDocGetRootElement (doc);

Modified: trunk/tests/meta-store/Makefile.am
==============================================================================
--- trunk/tests/meta-store/Makefile.am	(original)
+++ trunk/tests/meta-store/Makefile.am	Wed Mar 26 20:36:51 2008
@@ -3,9 +3,11 @@
 	-I$(top_srcdir)/libgda \
 	-I$(top_builddir) \
 	$(LIBGDA_CFLAGS) \
-	-DROOT_DIR=\""$(top_srcdir)"\"
+	-DTOP_SRC_DIR=\""$(top_srcdir)"\" \
+	-DTOP_BUILD_DIR=\""$(top_builddir)"\"
 
-noinst_PROGRAMS = check_meta_store_memory check_meta_store_sqlite check_meta_store_postgresql check_meta_store_mysql
+TESTS = check_meta_store_memory check_meta_store_sqlite check_meta_store_postgresql check_meta_store_mysql
+check_PROGRAMS = check_meta_store_memory check_meta_store_sqlite check_meta_store_postgresql check_meta_store_mysql
 
 common_sources = common.c common.h
 
@@ -46,3 +48,5 @@
 	data_triggers.csv \
 	data_view_column_usage.csv \
 	data_views.csv
+
+DISTCLEANFILES = test.db
\ No newline at end of file

Modified: trunk/tests/meta-store/check_meta_store_memory.c
==============================================================================
--- trunk/tests/meta-store/check_meta_store_memory.c	(original)
+++ trunk/tests/meta-store/check_meta_store_memory.c	Wed Mar 26 20:36:51 2008
@@ -4,11 +4,13 @@
 #include "common.h"
 
 int 
-main(int argc, char ** argv)
+main (int argc, char ** argv)
 {
 	GdaMetaStore *store;
-	gchar *cnc_string;
-	
+
+	/* set up test environment */
+	g_setenv ("GDA_TOP_SRC_DIR", TOP_SRC_DIR, TRUE);
+	g_setenv ("GDA_TOP_BUILD_DIR", TOP_BUILD_DIR, TRUE);
 	gda_init ("GdaMetaStore", "0.1", argc, argv);
 
 	/* Clean eveything which might exist in the store */

Modified: trunk/tests/meta-store/check_meta_store_mysql.c
==============================================================================
--- trunk/tests/meta-store/check_meta_store_mysql.c	(original)
+++ trunk/tests/meta-store/check_meta_store_mysql.c	Wed Mar 26 20:36:51 2008
@@ -9,6 +9,9 @@
 	GdaMetaStore *store;
 	gchar *cnc_string;
 	
+	/* set up test environment */
+	g_setenv ("GDA_TOP_SRC_DIR", TOP_SRC_DIR, TRUE);
+	g_setenv ("GDA_TOP_BUILD_DIR", TOP_BUILD_DIR, TRUE);
 	gda_init ("GdaMetaStore", "0.1", argc, argv);
 
 	/* connection parameters */

Modified: trunk/tests/meta-store/check_meta_store_postgresql.c
==============================================================================
--- trunk/tests/meta-store/check_meta_store_postgresql.c	(original)
+++ trunk/tests/meta-store/check_meta_store_postgresql.c	Wed Mar 26 20:36:51 2008
@@ -9,6 +9,9 @@
 	GdaMetaStore *store;
 	gchar *cnc_string;
 	
+	/* set up test environment */
+	g_setenv ("GDA_TOP_SRC_DIR", TOP_SRC_DIR, TRUE);
+	g_setenv ("GDA_TOP_BUILD_DIR", TOP_BUILD_DIR, TRUE);
 	gda_init ("GdaMetaStore", "0.1", argc, argv);
 
 	/* connection parameters */

Modified: trunk/tests/meta-store/check_meta_store_sqlite.c
==============================================================================
--- trunk/tests/meta-store/check_meta_store_sqlite.c	(original)
+++ trunk/tests/meta-store/check_meta_store_sqlite.c	Wed Mar 26 20:36:51 2008
@@ -8,6 +8,9 @@
 {
 	GdaMetaStore *store;
 
+	/* set up test environment */
+	g_setenv ("GDA_TOP_SRC_DIR", TOP_SRC_DIR, TRUE);
+	g_setenv ("GDA_TOP_BUILD_DIR", TOP_BUILD_DIR, TRUE);
 	gda_init ("GdaMetaStore", "0.1", argc, argv);
 
 	/* Clean eveything which might exist in the store */

Modified: trunk/tests/meta-store/common.c
==============================================================================
--- trunk/tests/meta-store/common.c	(original)
+++ trunk/tests/meta-store/common.c	Wed Mar 26 20:36:51 2008
@@ -143,7 +143,7 @@
 	va_end (args);
 	
 	/* load file */
-	fname = g_build_filename (ROOT_DIR, "tests", "meta-store", data_file, NULL);
+	fname = g_build_filename (TOP_SRC_DIR, "tests", "meta-store", data_file, NULL);
 	model = gda_data_model_import_new_file (fname, TRUE, options);
 	g_object_unref (options);
 	

Modified: trunk/tests/providers/Makefile.am
==============================================================================
--- trunk/tests/providers/Makefile.am	(original)
+++ trunk/tests/providers/Makefile.am	Wed Mar 26 20:36:51 2008
@@ -4,7 +4,7 @@
 	-I$(top_builddir) \
 	$(LIBGDA_CFLAGS) \
 	-DCHECK_SQL_FILES=\""$(top_srcdir)"\" \
-	-DGDA_PROVIDERS_ROOT_DIR=\""$(top_builddir)/providers"\"
+	-DTOP_BUILD_DIR=\""$(top_builddir)"\"
 
 check_PROGRAMS = check_sqlite
 TESTS = check_sqlite

Modified: trunk/tests/providers/check_bdb.c
==============================================================================
--- trunk/tests/providers/check_bdb.c	(original)
+++ trunk/tests/providers/check_bdb.c	Wed Mar 26 20:36:51 2008
@@ -13,9 +13,10 @@
 {
 	int number_failed = 0;
 
+	/* set up test environment */
+	g_setenv ("GDA_TOP_BUILD_DIR", TOP_BUILD_DIR, 0);
 	gda_init ("check-providers", PACKAGE_VERSION, argc, argv);
 
-	setenv ("GDA_PROVIDERS_ROOT_DIR", GDA_PROVIDERS_ROOT_DIR, 0);
 	pinfo = gda_config_get_provider_info (PROVIDER);
 	if (!pinfo) {
 		g_warning ("Could not find provider information for %s", PROVIDER);

Modified: trunk/tests/providers/check_firebird.c
==============================================================================
--- trunk/tests/providers/check_firebird.c	(original)
+++ trunk/tests/providers/check_firebird.c	Wed Mar 26 20:36:51 2008
@@ -13,9 +13,10 @@
 {
 	int number_failed = 0;
 
+	/* set up test environment */
+	g_setenv ("GDA_TOP_BUILD_DIR", TOP_BUILD_DIR, 0);
 	gda_init ("check-providers", PACKAGE_VERSION, argc, argv);
 
-	setenv ("GDA_PROVIDERS_ROOT_DIR", GDA_PROVIDERS_ROOT_DIR, 0);
 	pinfo = gda_config_get_provider_info (PROVIDER);
 	if (!pinfo) {
 		g_warning ("Could not find provider information for %s", PROVIDER);

Modified: trunk/tests/providers/check_freetds.c
==============================================================================
--- trunk/tests/providers/check_freetds.c	(original)
+++ trunk/tests/providers/check_freetds.c	Wed Mar 26 20:36:51 2008
@@ -13,9 +13,10 @@
 {
 	int number_failed = 0;
 
+	/* set up test environment */
+	g_setenv ("GDA_TOP_BUILD_DIR", TOP_BUILD_DIR, 0);
 	gda_init ("check-providers", PACKAGE_VERSION, argc, argv);
 
-	setenv ("GDA_PROVIDERS_ROOT_DIR", GDA_PROVIDERS_ROOT_DIR, 0);
 	pinfo = gda_config_get_provider_info (PROVIDER);
 	if (!pinfo) {
 		g_warning ("Could not find provider information for %s", PROVIDER);

Modified: trunk/tests/providers/check_ibmdb2.c
==============================================================================
--- trunk/tests/providers/check_ibmdb2.c	(original)
+++ trunk/tests/providers/check_ibmdb2.c	Wed Mar 26 20:36:51 2008
@@ -13,9 +13,10 @@
 {
 	int number_failed = 0;
 
+	/* set up test environment */
+	g_setenv ("GDA_TOP_BUILD_DIR", TOP_BUILD_DIR, 0);
 	gda_init ("check-providers", PACKAGE_VERSION, argc, argv);
 
-	setenv ("GDA_PROVIDERS_ROOT_DIR", GDA_PROVIDERS_ROOT_DIR, 0);
 	pinfo = gda_config_get_provider_info (PROVIDER);
 	if (!pinfo) {
 		g_warning ("Could not find provider information for %s", PROVIDER);

Modified: trunk/tests/providers/check_ldap.c
==============================================================================
--- trunk/tests/providers/check_ldap.c	(original)
+++ trunk/tests/providers/check_ldap.c	Wed Mar 26 20:36:51 2008
@@ -13,9 +13,10 @@
 {
 	int number_failed = 0;
 
+	/* set up test environment */
+	g_setenv ("GDA_TOP_BUILD_DIR", TOP_BUILD_DIR, 0);
 	gda_init ("check-providers", PACKAGE_VERSION, argc, argv);
 
-	setenv ("GDA_PROVIDERS_ROOT_DIR", GDA_PROVIDERS_ROOT_DIR, 0);
 	pinfo = gda_config_get_provider_info (PROVIDER);
 	if (!pinfo) {
 		g_warning ("Could not find provider information for %s", PROVIDER);

Modified: trunk/tests/providers/check_mdb.c
==============================================================================
--- trunk/tests/providers/check_mdb.c	(original)
+++ trunk/tests/providers/check_mdb.c	Wed Mar 26 20:36:51 2008
@@ -13,9 +13,10 @@
 {
 	int number_failed = 0;
 
+	/* set up test environment */
+	g_setenv ("GDA_TOP_BUILD_DIR", TOP_BUILD_DIR, 0);
 	gda_init ("check-providers", PACKAGE_VERSION, argc, argv);
 
-	setenv ("GDA_PROVIDERS_ROOT_DIR", GDA_PROVIDERS_ROOT_DIR, 0);
 	pinfo = gda_config_get_provider_info (PROVIDER);
 	if (!pinfo) {
 		g_warning ("Could not find provider information for %s", PROVIDER);

Modified: trunk/tests/providers/check_msql.c
==============================================================================
--- trunk/tests/providers/check_msql.c	(original)
+++ trunk/tests/providers/check_msql.c	Wed Mar 26 20:36:51 2008
@@ -13,9 +13,10 @@
 {
 	int number_failed = 0;
 
+	/* set up test environment */
+	g_setenv ("GDA_TOP_BUILD_DIR", TOP_BUILD_DIR, 0);
 	gda_init ("check-providers", PACKAGE_VERSION, argc, argv);
 
-	setenv ("GDA_PROVIDERS_ROOT_DIR", GDA_PROVIDERS_ROOT_DIR, 0);
 	pinfo = gda_config_get_provider_info (PROVIDER);
 	if (!pinfo) {
 		g_warning ("Could not find provider information for %s", PROVIDER);

Modified: trunk/tests/providers/check_mysql.c
==============================================================================
--- trunk/tests/providers/check_mysql.c	(original)
+++ trunk/tests/providers/check_mysql.c	Wed Mar 26 20:36:51 2008
@@ -13,9 +13,10 @@
 {
 	int number_failed = 0;
 
+	/* set up test environment */
+	g_setenv ("GDA_TOP_BUILD_DIR", TOP_BUILD_DIR, 0);
 	gda_init ("check-providers", PACKAGE_VERSION, argc, argv);
 
-	setenv ("GDA_PROVIDERS_ROOT_DIR", GDA_PROVIDERS_ROOT_DIR, 0);
 	pinfo = gda_config_get_provider_info (PROVIDER);
 	if (!pinfo) {
 		g_warning ("Could not find provider information for %s", PROVIDER);

Modified: trunk/tests/providers/check_odbc.c
==============================================================================
--- trunk/tests/providers/check_odbc.c	(original)
+++ trunk/tests/providers/check_odbc.c	Wed Mar 26 20:36:51 2008
@@ -13,9 +13,10 @@
 {
 	int number_failed = 0;
 
+	/* set up test environment */
+	g_setenv ("GDA_TOP_BUILD_DIR", TOP_BUILD_DIR, 0);
 	gda_init ("check-providers", PACKAGE_VERSION, argc, argv);
 
-	setenv ("GDA_PROVIDERS_ROOT_DIR", GDA_PROVIDERS_ROOT_DIR, 0);
 	pinfo = gda_config_get_provider_info (PROVIDER);
 	if (!pinfo) {
 		g_warning ("Could not find provider information for %s", PROVIDER);

Modified: trunk/tests/providers/check_oracle.c
==============================================================================
--- trunk/tests/providers/check_oracle.c	(original)
+++ trunk/tests/providers/check_oracle.c	Wed Mar 26 20:36:51 2008
@@ -13,9 +13,10 @@
 {
 	int number_failed = 0;
 
+	/* set up test environment */
+	g_setenv ("GDA_TOP_BUILD_DIR", TOP_BUILD_DIR, 0);
 	gda_init ("check-providers", PACKAGE_VERSION, argc, argv);
 
-	setenv ("GDA_PROVIDERS_ROOT_DIR", GDA_PROVIDERS_ROOT_DIR, 0);
 	pinfo = gda_config_get_provider_info (PROVIDER);
 	if (!pinfo) {
 		g_warning ("Could not find provider information for %s", PROVIDER);

Modified: trunk/tests/providers/check_postgres.c
==============================================================================
--- trunk/tests/providers/check_postgres.c	(original)
+++ trunk/tests/providers/check_postgres.c	Wed Mar 26 20:36:51 2008
@@ -15,9 +15,10 @@
 	int number_failed = 0;
 	fork_tests = FALSE;
 
+	/* set up test environment */
+	g_setenv ("GDA_TOP_BUILD_DIR", TOP_BUILD_DIR, 0);
 	gda_init ("check-providers", PACKAGE_VERSION, argc, argv);
 
-	setenv ("GDA_PROVIDERS_ROOT_DIR", GDA_PROVIDERS_ROOT_DIR, 0);
 	pinfo = gda_config_get_provider_info (PROVIDER);
 	if (!pinfo) {
 		g_warning ("Could not find provider information for %s", PROVIDER);

Modified: trunk/tests/providers/check_sqlite.c
==============================================================================
--- trunk/tests/providers/check_sqlite.c	(original)
+++ trunk/tests/providers/check_sqlite.c	Wed Mar 26 20:36:51 2008
@@ -15,9 +15,10 @@
 	int number_failed = 0;
 	fork_tests = FALSE;
 
+	/* set up test environment */
+	g_setenv ("GDA_TOP_BUILD_DIR", TOP_BUILD_DIR, 0);
 	gda_init ("check-providers", PACKAGE_VERSION, argc, argv);
 
-	setenv ("GDA_PROVIDERS_ROOT_DIR", GDA_PROVIDERS_ROOT_DIR, 0);
 	pinfo = gda_config_get_provider_info (PROVIDER);
 	if (!pinfo) {
 		g_warning ("Could not find provider information for %s", PROVIDER);

Modified: trunk/tests/providers/check_sybase.c
==============================================================================
--- trunk/tests/providers/check_sybase.c	(original)
+++ trunk/tests/providers/check_sybase.c	Wed Mar 26 20:36:51 2008
@@ -13,9 +13,10 @@
 {
 	int number_failed = 0;
 
+	/* set up test environment */
+	g_setenv ("GDA_TOP_BUILD_DIR", TOP_BUILD_DIR, 0);
 	gda_init ("check-providers", PACKAGE_VERSION, argc, argv);
 
-	setenv ("GDA_PROVIDERS_ROOT_DIR", GDA_PROVIDERS_ROOT_DIR, 0);
 	pinfo = gda_config_get_provider_info (PROVIDER);
 	if (!pinfo) {
 		g_warning ("Could not find provider information for %s", PROVIDER);

Modified: trunk/tests/providers/check_xbase.c
==============================================================================
--- trunk/tests/providers/check_xbase.c	(original)
+++ trunk/tests/providers/check_xbase.c	Wed Mar 26 20:36:51 2008
@@ -13,9 +13,10 @@
 {
 	int number_failed = 0;
 
+	/* set up test environment */
+	g_setenv ("GDA_TOP_BUILD_DIR", TOP_BUILD_DIR, 0);
 	gda_init ("check-providers", PACKAGE_VERSION, argc, argv);
 
-	setenv ("GDA_PROVIDERS_ROOT_DIR", GDA_PROVIDERS_ROOT_DIR, 0);
 	pinfo = gda_config_get_provider_info (PROVIDER);
 	if (!pinfo) {
 		g_warning ("Could not find provider information for %s", PROVIDER);



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