[dconf] tests: stop setting environment variables



commit 79b9e14a9617009236e5b2c44f13a45de949007a
Author: Ryan Lortie <desrt desrt ca>
Date:   Tue Nov 26 13:49:28 2013 -0500

    tests: stop setting environment variables
    
    Stop setting the DCONF_PROFILE environment variable while threads are
    running.  Leave only one case where we set it explicitly to check that
    the variable itself is working correctly.

 tests/engine.c |   21 +++++----------------
 1 files changed, 5 insertions(+), 16 deletions(-)
---
diff --git a/tests/engine.c b/tests/engine.c
index abf3000..1f043e9 100644
--- a/tests/engine.c
+++ b/tests/engine.c
@@ -1036,8 +1036,6 @@ test_read (void)
   close (g_file_open_tmp ("dconf-testcase.XXXXXX", &profile_filename, &error));
   g_assert_no_error (error);
 
-  g_setenv ("DCONF_PROFILE", profile_filename, TRUE);
-
   for (n = 0; n <= MAX_N_SOURCES; n++)
     for (i = 0; i < pow (2, n); i++)
       {
@@ -1055,7 +1053,7 @@ test_read (void)
               setup_state (n, i, j, (j != k) ? state : NULL);
 
               /* Step 3: create the engine */
-              engine = dconf_engine_new (NULL, NULL, NULL);
+              engine = dconf_engine_new (profile_filename, NULL, NULL);
 
               /* Step 4: read, and check result */
               check_read (engine, n, i, j);
@@ -1081,7 +1079,6 @@ test_read (void)
       }
 
   /* Clean up the tempfile we were using... */
-  g_unsetenv ("DCONF_PROFILE");
   g_unlink (profile_filename);
   g_free (profile_filename);
   dconf_mock_shm_reset ();
@@ -1106,9 +1103,7 @@ test_watch_fast (void)
 
   triv = g_variant_ref_sink (g_variant_new ("()"));
 
-  g_setenv ("DCONF_PROFILE", SRCDIR "/profile/dos", TRUE);
-  engine = dconf_engine_new (NULL, NULL, NULL);
-  g_unsetenv ("DCONF_PROFILE");
+  engine = dconf_engine_new (SRCDIR "/profile/dos", NULL, NULL);
 
   /* Check that establishing a watch works properly in the normal case.
    */
@@ -1195,9 +1190,7 @@ test_watch_sync (void)
 
   dconf_mock_dbus_sync_call_handler = handle_match_request;
 
-  g_setenv ("DCONF_PROFILE", SRCDIR "/profile/dos", TRUE);
-  engine = dconf_engine_new (NULL, NULL, NULL);
-  g_unsetenv ("DCONF_PROFILE");
+  engine = dconf_engine_new (SRCDIR "/profile/dos", NULL, NULL);
 
   match_request_type = "AddMatch";
   dconf_engine_watch_sync (engine, "/a/b/c");
@@ -1245,9 +1238,7 @@ test_change_fast (void)
   slightly_bad_write = dconf_changeset_new_write ("/locked", g_variant_new_string ("value"));
   dconf_changeset_set (slightly_bad_write, "/to-reset", NULL);
 
-  g_setenv ("DCONF_PROFILE", SRCDIR "/profile/dos", TRUE);
-  engine = dconf_engine_new (NULL, NULL, NULL);
-  g_unsetenv ("DCONF_PROFILE");
+  engine = dconf_engine_new (SRCDIR "/profile/dos", NULL, NULL);
 
   success = dconf_engine_change_fast (engine, empty, NULL, &error);
   g_assert_no_error (error);
@@ -1425,9 +1416,7 @@ test_change_sync (void)
   slightly_bad_write = dconf_changeset_new_write ("/locked", g_variant_new_string ("value"));
   dconf_changeset_set (slightly_bad_write, "/to-reset", NULL);
 
-  g_setenv ("DCONF_PROFILE", SRCDIR "/profile/dos", TRUE);
-  engine = dconf_engine_new (NULL, NULL, NULL);
-  g_unsetenv ("DCONF_PROFILE");
+  engine = dconf_engine_new (SRCDIR "/profile/dos", NULL, NULL);
 
   success = dconf_engine_change_sync (engine, empty, &tag, &error);
   g_assert_no_error (error);


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