GNOME Bugzilla – Bug 765905
GI_TYPELIB_PATH does not override g_irepository_prepend_search_path() anymore
Last modified: 2016-05-05 17:13:49 UTC
This bug is spawn in reaction to: https://bugzilla.gnome.org/show_bug.cgi?id=765735#c12 https://bugzilla.gnome.org/show_bug.cgi?id=765735#c13 The TL;DR of it is: As of gobject-introspection bd475c0 (in master), GI_TYPELIB_PATH does no longer override paths added in code through g_irepository_prepend_search_path(). This has implications in how does gjs/installed-tests expect to use the in-tree private libraries when running make check. Right now, only later g_irepository_prepend_search_path() calls may override earlier ones, so two possible approaches to fix this are: - Adding an extra envvar for gjs-context.cpp to lookup the GjsPrivate directory, which can then be overriden in Makefile-test.am - Doing an ad-hoc call to g_irepository_prepend_search_path(g_getenv ("TOP_BUILDDIR")) in gjs/installed-tests/gjs-unit.cpp, although it should ensure that this is performed after the call in gjs_context_class_init().
If I understand the problem correctly, and the fallout is only limited to the tests, I am leaning towards the ad-hoc call to g_irepository_prepend_search_path() from the test runner.
As far as gjs is concerned, I think it's only limited to tests indeed. More generically, the referred bug could be read as "don't rely on GI_TYPELIB_PATH if you want to run code entirely from inside your project tree". AFAICS gjs is doing the right thing in the other seemingly affected places: https://git.gnome.org/browse/gjs/tree/modules/package.js#n125 https://git.gnome.org/browse/gjs/tree/modules/package.js#n236
Sounds good then - want to prepare a patch? :-)
Created attachment 327335 [details] [review] installed-tests: Avoid usage of GI_TYPELIB_PATH to override lookups As of gobject-introspection bd475c00d96, this environment variable won't override the search paths set through g_irepository_prepend_search_path, so use this function in tests, ensuring that it overrides search paths added internally by the GjsContext.
Note that there is one test that is failing here (testUtf8 in installed-tests/js/testEverythingBasic.js) both with and without this patch, skipping that one, the rest seems to work ok. I also triple checked that the search paths are in the expected order.
Review of attachment 327335 [details] [review]: Looks good, thanks.
(In reply to Carlos Garnacho from comment #5) > Note that there is one test that is failing here (testUtf8 in > installed-tests/js/testEverythingBasic.js) both with and without this patch, > skipping that one, the rest seems to work ok. I also triple checked that the > search paths are in the expected order. Thank you - I think the other failure is known and is bug 761068.
Yup, looks like that one :). Pushing this patch.
Attachment 327335 [details] pushed as 482d251 - installed-tests: Avoid usage of GI_TYPELIB_PATH to override lookups