GNOME Bugzilla – Bug 711715
gtk object tests: run under local environment
Last modified: 2013-12-03 13:22:55 UTC
This patch makes the object sanity tests run uninstalled. It generates a local gschemas.compiled and wraps tests in a GTestDBus. Can we set the gsettings and gvfs environment variables in gtk_test_init() instead of duplicating that code in every test?
Created attachment 259305 [details] [review] gtk object tests: run under local environment Make sure that the tests don't access the host's session bus or installed gsettings schemas. Also disable tests for some classes that leak a connection to the session bus.
Shouldn't we fix those leaks instead ?
Of course. The primary purpose of this patch is to have a working `make check` on a system that does not have gtk installed (or an older version). I had to blacklist a few classes in one of the tests because of the leaks I mentioned. (Note that the test already had other classes blacklisted.) I plan on fixing the leaks, but that will be in separate patches. I'm okay if you don't want to land this until then.
Review of attachment 259305 [details] [review]: Shouldn't we fix those leaks instead? ::: testsuite/gtk/defaultvalue.c @@ +397,3 @@ + /* These must be set before before gtk_test_init */ + g_setenv ("GIO_USE_VFS", "local", TRUE); + g_setenv ("GSETTINGS_BACKEND", "memory", TRUE); Why do you have to set these ? The tests here don't write any settings, afaics... ::: testsuite/gtk/object.c @@ +310,3 @@ guint i; + + g_setenv ("GSETTINGS_BACKEND", "memory", TRUE); Same question here - what goes wrong if you don't set this ?
Review of attachment 259305 [details] [review]: ::: testsuite/gtk/object.c @@ +310,3 @@ guint i; + + g_setenv ("GSETTINGS_BACKEND", "memory", TRUE); you're going to want to set GSETTINGS_SCHEMA_DIR here, as with the other tests...
Created attachment 263300 [details] [review] gtk object tests: run under local environment Set GSETTINGS_SCHEMA_DIR in object.c. Thanks Ryan. Get rid of the file glob for settings schemas in Makefile.am as discussed with Ryan on irc. I'm using --schema-file now, but would feel more comfortable doing so if that was a publicly documented option.
(In reply to comment #4) > ::: testsuite/gtk/defaultvalue.c > @@ +397,3 @@ > + /* These must be set before before gtk_test_init */ > + g_setenv ("GIO_USE_VFS", "local", TRUE); > + g_setenv ("GSETTINGS_BACKEND", "memory", TRUE); > > Why do you have to set these ? The tests here don't write any settings, > afaics... No, but they might read them which can fail on systems that don't have dconf running.
(In reply to comment #7) > No, but they might read them which can fail on systems that don't have dconf > running. This doesn't really make sense... dconf doesn't need to be 'running' for reads... OTOH, GSettings will emit a warning about using the memory backend if not explicitly selected and this warning may cause gtester to trap, so maybe it's a good thing to do this explicitly?
(In reply to comment #8) > (In reply to comment #7) > > No, but they might read them which can fail on systems that don't have dconf > > running. > > This doesn't really make sense... dconf doesn't need to be 'running' for > reads... OTOH, GSettings will emit a warning about using the memory backend if > not explicitly selected and this warning may cause gtester to trap, so maybe > it's a good thing to do this explicitly? Ah sorry, you're right. Another reason is that we want the tests to operate on default values, not the ones set on the system that the test is running on.
Review of attachment 263300 [details] [review]: Overall this now looks OK to me... ::: testsuite/gtk/defaultvalue.c @@ +92,3 @@ + return; + + /* These leak their GDBusConnections */ GSettings also leaks its D-Bus connection, perhaps explaining your concerns...
Review of attachment 263300 [details] [review]: ok, lets go with this for now then
Attachment 263300 [details] pushed as fbff02f - gtk object tests: run under local environment