on xenial help sign in
Respect pre-set import and library paths and prevent segfault in startShell.

Approved by PS Jenkins bot, Gerry Boland.

commit38bcdf4d01da0ba567bd98857837d5d193c0dcc0 authorMichał Sawicz <michal.sawicz@canonical.com> dateSat 5 Oct 2013, 14:37 (13 years ago) parent5ccd88cb599083
2 files changed+16−7
main.cpp+3−3 tests/autopilot/unity8/shell/tests/__init__.py+13−4
main.cpp+3−3
@@ -160,10 +160,10 @@ int startShell(int argc, const char** argv, void* server)
160160 prependImportPaths(view->engine(), ::overrideImportPaths());
161161 appendImportPaths(view->engine(), ::fallbackImportPaths());
162162
163− QStringList importPath = view->engine()->importPathList().filter("qt5/imports");
164163 if (isUbuntuMirServer) {
165− importPath.first().append("/Unity-Mir");
166− view->engine()->addImportPath(importPath.first());
164+ QStringList importPaths = view->engine()->importPathList();
165+ importPaths.replaceInStrings(QRegExp("qt5/imports$"), "qt5/imports/Unity-Mir");
166+ view->engine()->setImportPathList(importPaths);
167167 }
168168
169169 view->setSource(source);
tests/autopilot/unity8/shell/tests/__init__.py+13−4
@@ -183,10 +183,14 @@ class UnityTestCase(AutopilotTestCase):
183183 def patch_lightdm_mock(self, mock_type='single'):
184184 self._lightdm_mock_type = mock_type
185185 logger.info("Setting up LightDM mock type '%s'", mock_type)
186− new_ld_library_path = "%s:%s" % (
186+ new_ld_library_path = [
187187 get_default_extra_mock_libraries(),
188188 self._get_lightdm_mock_path(mock_type)
189− )
189+ ]
190+ if os.getenv('LD_LIBRARY_PATH') is not None:
191+ new_ld_library_path.append(os.getenv('LD_LIBRARY_PATH'))
192+
193+ new_ld_library_path = ':'.join(new_ld_library_path)
190194 logger.info("New library path: %s", new_ld_library_path)
191195
192196 self.patch_environment('LD_LIBRARY_PATH', new_ld_library_path)
@@ -205,8 +209,13 @@ class UnityTestCase(AutopilotTestCase):
205209 return lightdm_mock_path
206210
207211 def _setup_extra_mock_environment_patch(self):
208− mocks_library_path = get_mocks_library_path()
209− self.patch_environment('QML2_IMPORT_PATH', mocks_library_path)
212+ qml_import_path = [get_mocks_library_path()]
213+ if os.getenv('QML2_IMPORT_PATH') is not None:
214+ qml_import_path.append(os.getenv('QML2_IMPORT_PATH'))
215+
216+ qml_import_path = ':'.join(qml_import_path)
217+ logger.info("New QML2 import path: %s", qml_import_path)
218+ self.patch_environment('QML2_IMPORT_PATH', qml_import_path)
210219
211220 def _set_proxy(self, proxy):
212221 """Keep a copy of the proxy object, so we can use it to get common