Example #1
0
    def patch_lightdm_mock(self):
        logger.info("Setting up LightDM mock lib")
        new_ld_library_path = [
            get_default_extra_mock_libraries(),
            self._get_lightdm_mock_path()
        ]
        if os.getenv('LD_LIBRARY_PATH') is not None:
            new_ld_library_path.append(os.getenv('LD_LIBRARY_PATH'))

        new_ld_library_path = ':'.join(new_ld_library_path)
        logger.info("New library path: %s", new_ld_library_path)

        self._environment['LD_LIBRARY_PATH'] = new_ld_library_path
Example #2
0
    def patch_lightdm_mock(self):
        logger.info("Setting up LightDM mock lib")
        new_ld_library_path = [
            get_default_extra_mock_libraries(),
            self._get_lightdm_mock_path()
        ]
        if os.getenv('LD_LIBRARY_PATH') is not None:
            new_ld_library_path.append(os.getenv('LD_LIBRARY_PATH'))

        new_ld_library_path = ':'.join(new_ld_library_path)
        logger.info("New library path: %s", new_ld_library_path)

        self._environment['LD_LIBRARY_PATH'] = new_ld_library_path
    def _restart_unity_with_testability(self):
        _environment = {}

        data_dirs = get_data_dirs(True)
        if data_dirs is not None:
            _environment['XDG_DATA_DIRS'] = data_dirs

        _environment['QML2_IMPORT_PATH'] = (
            self._get_qml_import_path_with_mock()
        )

        new_ld_library_path = [
            get_default_extra_mock_libraries(),
            self._get_lightdm_mock_path()
        ]
        if os.getenv('LD_LIBRARY_PATH') is not None:
            new_ld_library_path.append(os.getenv('LD_LIBRARY_PATH'))
        new_ld_library_path = ':'.join(new_ld_library_path)
        _environment['LD_LIBRARY_PATH'] = new_ld_library_path

        # FIXME: we shouldn't be doing this
        # $MIR_SOCKET, fallback to $XDG_RUNTIME_DIR/mir_socket and
        # /tmp/mir_socket as last resort
        try:
            os.unlink(
                os.getenv('MIR_SOCKET',
                          os.path.join(os.getenv('XDG_RUNTIME_DIR', "/tmp"),
                                       "mir_socket")))
        except OSError:
            pass
        try:
            os.unlink("/tmp/mir_socket")
        except OSError:
            pass

        binary_arg = "BINARY=%s" % get_binary_path()
        env_args = ["%s=%s" % (k, v) for k, v in _environment.items()]
        args = [binary_arg] + env_args
        self.unity_proxy = process_helpers.restart_unity_with_testability(
            *args)
        self.main_win = self.unity_proxy.select_single(shell.ShellView)