def _test_connect(self, server_args=(), auth="none", client_args=(), password=None, uri_prefix=":", exit_code=0): display_no = self.find_free_display_no() display = ":%s" % display_no log("starting test server on %s", display) server = self.start_server(display, "--auth=%s" % auth, "--printing=no", *server_args) #we should always be able to get the version: uri = uri_prefix + str(display_no) client = self.run_xpra(["version", uri] + server_args) if pollwait(client, 5)!=0: r = client.poll() if client.poll() is None: client.terminate() raise Exception("version client failed to connect, returned %s" % estr(r)) #try to connect cmd = ["connect-test", uri] + client_args f = None if password: f = self._temp_file(password) cmd += ["--password-file=%s" % f.name] cmd += ["--challenge-handlers=file:filename=%s" % f.name] client = self.run_xpra(cmd) r = pollwait(client, 10) if f: f.close() if client.poll() is None: client.terminate() server.terminate() if r!=exit_code: raise Exception("expected info client to return %s but got %s" % (estr(exit_code), estr(r)))
def _test_auth(self, auth="fail", uri_prefix="", exit_code=0, password=None): display = self.find_free_display() log("starting test server on %s", display) server = self.check_start_server(display, "--auth=%s" % auth, "--printing=no") #we should always be able to get the version: client = self.run_xpra(["version", uri_prefix + display]) assert pollwait(client, 5) == 0, "version client failed to connect" if client.poll() is None: client.terminate() #try to connect cmd = ["info", uri_prefix + display] f = None if password: f = self._temp_file(password) cmd += ["--password-file=%s" % f.name] client = self.run_xpra(cmd) r = pollwait(client, 5) if f: f.close() if client.poll() is None: client.terminate() server.terminate() assert r == exit_code, "expected info client to return %s but got %s" % ( exit_code, r)
def test_terminate_subcommands(self): if POSIX and not OSX: #can't test commands that require a display yet return subcommands = [ "mdns-gui", "sessions", "launcher", "gui", "bug-report", "_dialog", "_pass", #"send-file", needs a server socket #"splash", has its own test module "clipboard-test", "keyboard-test", "toolbox", "colors-test", "colors-gradient-test", "transparent-colors", ] for args in subcommands: proc = self._run_subcommand(args, 10, stdout=PIPE, stderr=PIPE) r = proc.poll() if r is not None: raise Exception("%s subcommand should not have terminated" % (args, )) noerr(proc.send_signal, signal.SIGTERM) if pollwait(proc, 2) is None: noerr(proc.terminate) if pollwait(proc, 2) is None: noerr(proc.kill)
def do_test_control_send_file(self, data): f = self._temp_file(data) try: display = self.find_free_display() server = self.check_start_server(display) xvfb, client = self.run_client(display, "--file-transfer=yes") assert pollwait(client, CLIENT_TIMEOUT) is None #send a file to this client: send_file_command = [ "control", display, "send-file", f.name, "0", "*" ] send_file = self.run_xpra(send_file_command) assert pollwait( send_file, CLIENT_TIMEOUT ) == 0, "send-file command returncode is %s" % send_file.poll() time.sleep(1) #now verify the file can be found in the download directory from xpra.platform.paths import get_download_dir filename = os.path.join(os.path.expanduser(get_download_dir()), os.path.basename(f.name)) assert os.path.exists(filename), "cannot find %s" % filename readback = load_binary_file(filename) assert readback == data, "file data corrupted" os.unlink(filename) #cleanup: client.terminate() xvfb.terminate() server.terminate() finally: f.close()
def stop_commands(self): for x in self.processes: try: if x.poll() is None: x.terminate() stdout_file = getattr(x, "stdout_file", None) if stdout_file: try: stdout_file.close() except OSError: pass stderr_file = getattr(x, "stderr_file", None) if stderr_file: try: stderr_file.close() except OSError: pass except OSError: log.error("failed to stop subprocess %s", x) def get_wait_for(): return tuple(proc for proc in self.processes if proc.poll() is None) wait_for = get_wait_for() start = monotonic_time() while wait_for and monotonic_time() - start < 5: if len(wait_for) == 1: pollwait(wait_for[0]) else: time.sleep(1) wait_for = get_wait_for()
def _test_connect(self, server_args=[], auth="none", client_args=[], password=None, uri_prefix=":", exit_code=0): display_no = self.find_free_display_no() display = ":%s" % display_no log("starting test server on %s", display) server = self.start_server(display, "--auth=%s" % auth, "--printing=no", *server_args) #we should always be able to get the version: uri = uri_prefix + str(display_no) client = self.run_xpra(["version", uri] + server_args) assert pollwait(client, 5)==0, "version client failed to connect" if client.poll() is None: client.terminate() #try to connect cmd = ["connect-test", uri] + client_args f = None if password: f = self._temp_file(password) cmd += ["--password-file=%s" % f.name] client = self.run_xpra(cmd) r = pollwait(client, 5) if f: f.close() assert r==exit_code, "expected info client to return %s but got %s" % (exit_code, client.poll()) if client.poll() is None: client.terminate() server.terminate()
def _test_connect(self, server_args=[], auth="none", client_args=[], password=None, uri_prefix=":", exit_code=0): display_no = self.find_free_display_no() display = ":%s" % display_no log("starting test server on %s", display) server = self.start_server(display, "--auth=%s" % auth, "--printing=no", *server_args) #we should always be able to get the version: uri = uri_prefix + str(display_no) client = self.run_xpra(["version", uri] + server_args) assert pollwait(client, 5) == 0, "version client failed to connect" if client.poll() is None: client.terminate() #try to connect cmd = ["connect-test", uri] + client_args f = None if password: f = self._temp_file(password) cmd += ["--password-file=%s" % f.name] client = self.run_xpra(cmd) r = pollwait(client, 5) if f: f.close() assert r == exit_code, "expected info client to return %s but got %s" % ( exit_code, client.poll()) if client.poll() is None: client.terminate() server.terminate()
def stop_server(self, server_proc, subcommand="stop", *connect_args): if server_proc.poll() is not None: return cmd = [subcommand]+list(connect_args) stopit = self.run_xpra(cmd) if pollwait(stopit, STOP_WAIT_TIMEOUT) is None: self.show_proc_error(stopit, "stop server error") assert pollwait(server_proc, STOP_WAIT_TIMEOUT) is not None, "server process %s failed to exit" % server_proc
def test_ssl_socket(self): server = None display_no = self.find_free_display_no() display = ":%s" % display_no tcp_port = get_free_tcp_port() ssl_port = get_free_tcp_port() try: tmpdir = tempfile.mkdtemp(suffix='ssl-xpra') certfile = os.path.join(tmpdir, "self.pem") openssl_command = [ "openssl", "req", "-new", "-newkey", "rsa:4096", "-days", "2", "-nodes", "-x509", "-subj", "/C=US/ST=Denial/L=Springfield/O=Dis/CN=localhost", "-keyout", certfile, "-out", certfile, ] openssl = self.run_command(openssl_command) assert pollwait(openssl, 10)==0, "openssl certificate generation failed" cert_data = load_binary_file(certfile) log("generated cert data: %s", repr_ellipsized(cert_data)) if not cert_data: #cannot run openssl? (happens from rpmbuild) log.warn("SSL test skipped, cannot run '%s'", b" ".join(openssl_command)) return server_args = [ "--bind-tcp=0.0.0.0:%i" % tcp_port, "--bind-ssl=0.0.0.0:%i" % ssl_port, "--ssl=on", "--ssl-cert=%s" % certfile] log("starting test ssl server on %s", display) server = self.start_server(display, *server_args) #test it with openssl client: for port in (tcp_port, ssl_port): openssl_verify_command = "openssl s_client -connect 127.0.0.1:%i -CAfile %s < /dev/null" % (port, certfile) openssl = self.run_command(openssl_verify_command, shell=True) assert pollwait(openssl, 10)==0, "openssl certificate verification failed" def test_connect(uri, exit_code, *client_args): cmd = ["info", uri] + list(client_args) client = self.run_xpra(cmd) r = pollwait(client, 5) if client.poll() is None: client.terminate() assert r==exit_code, "expected info client to return %s but got %s" % (exit_code, client.poll()) noverify = "--ssl-server-verify-mode=none" #connect to ssl socket: test_connect("ssl/127.0.0.1:%i/" % ssl_port, EXIT_OK, noverify) #tcp socket should upgrade: test_connect("ssl/127.0.0.1:%i/" % tcp_port, EXIT_OK, noverify) #self signed cert should fail without noverify: test_connect("ssl/127.0.0.1:%i/" % ssl_port, EXIT_CONNECTION_LOST) test_connect("ssl/127.0.0.1:%i/" % tcp_port, EXIT_CONNECTION_LOST) finally: shutil.rmtree(tmpdir) if server: server.terminate()
def stop_server(cls, server_proc, subcommand="stop", *connect_args): if server_proc.poll() is not None: return cmd = [subcommand] + list(connect_args) stopit = cls.run_xpra(cmd) assert pollwait( stopit) is not None, "%s command failed to exit" % subcommand assert pollwait( server_proc ) is not None, "server process %s failed to exit" % server_proc
def test_invalid(self): self._feed_splash([ "notanumber:ignoreit", "50:50", ]) r = pollwait(self.splash, 5) assert r is None, "splash screen should not have terminated" #try killing it with a signal: self.splash.send_signal(signal.SIGTERM) r = pollwait(self.splash, 5) assert r is not None, "expected splash to exit"
def _run_subcommand(self, args, wait=60, **kwargs): cmd = get_xpra_command() + shlex.split(args) if "stdout" not in kwargs: kwargs["stdout"] = DEVNULL if "stderr" not in kwargs: kwargs["stderr"] = DEVNULL try: proc = Popen(cmd, **kwargs) pollwait(proc, wait) return proc except Exception as e: raise Exception("failed on %s" % (cmd, )) from e
def _test_connect(self, server_args=(), auth="none", client_args=(), password=None, uri_prefix=DISPLAY_PREFIX, exit_code=0): display_no = self.find_free_display_no() display = ":%s" % display_no log("starting test server on %s", display) server = self.start_server(display, "--auth=%s" % auth, "--printing=no", *server_args) #we should always be able to get the version: uri = uri_prefix + str(display_no) start = monotonic_time() while True: client = self.run_xpra(["version", uri] + server_args) r = pollwait(client, CONNECT_WAIT) if r == 0: break if r is None: client.terminate() if monotonic_time() - start > SUBPROCESS_WAIT: raise Exception( "version client failed to connect, returned %s" % estr(r)) #try to connect cmd = ["connect-test", uri] + client_args f = None if password: f = self._temp_file(password) cmd += ["--password-file=%s" % f.name] cmd += ["--challenge-handlers=file:filename=%s" % f.name] client = self.run_xpra(cmd) r = pollwait(client, SUBPROCESS_WAIT) if f: f.close() if r is None: client.terminate() server.terminate() if r != exit_code: log.error("Exit code mismatch") log.error(" server args=%s", server_args) log.error(" client args=%s", client_args) if r is None: raise Exception( "expected info client to return %s but it is still running" % (estr(exit_code), )) raise Exception("expected info client to return %s but got %s" % (estr(exit_code), estr(r))) pollwait(server, 10)
def check_stop_server(cls, server_proc, subcommand="stop", display=":99999"): if server_proc.poll(): return stopit = cls.run_xpra([subcommand, display]) assert pollwait( stopit) is not None, "%s command failed to exit" % subcommand assert pollwait( server_proc ) is not None, "server process %s failed to exit" % server_proc assert display not in cls.dotxpra.displays( ), "server socket for display %s should have been removed" % display
def stop_server(self, server_proc, subcommand, *connect_args): assert subcommand in ("stop", "exit") if server_proc.poll() is not None: raise Exception( "cannot stop server, it has already exited, returncode=%i" % server_proc.poll()) cmd = [subcommand] + list(connect_args) stopit = self.run_xpra(cmd) if pollwait(stopit, STOP_WAIT_TIMEOUT) is None: log.warn("failed to stop %s:", server_proc) self.show_proc_pipes(server_proc) self.show_proc_error(stopit, "stop server error") assert pollwait( server_proc, STOP_WAIT_TIMEOUT ) is not None, "server process %s failed to exit" % server_proc
def do_test_copy_selection(self, selection="clipboard", direction="both"): log("do_test_copy(%s, %s)", selection, direction) server = self.run_server() server_display = server.display #connect a client: xvfb, client = self.run_client(server_display, "--clipboard-direction=%s" % direction, "--remote-logging=no") assert pollwait(client, 2) is None, "client has exited with return code %s" % client.poll() client_display = xvfb.display if SANITY_CHECKS: log("sanity checks") #xclip sanity check: retrieve from the same display: self.copy_and_verify(client_display, client_display, True, wait=0, selection=selection) self.copy_and_verify(server_display, server_display, True, wait=0, selection=selection) log("copy client %s to server %s", client_display, server_display) for _ in range(2): self.copy_and_verify(client_display, server_display, direction in ("both", "to-server"), selection=selection) log("copy server %s to client %s", server_display, client_display) for _ in range(2): self.copy_and_verify(server_display, client_display, direction in ("both", "to-client"), selection=selection) log("copy client %s to server %s", client_display, server_display) for _ in range(2): self.copy_and_verify(client_display, server_display, direction in ("both", "to-server"), selection=selection) client.terminate() xvfb.terminate() server.terminate()
def test_connect(uri, exit_code, *client_args): cmd = ["info", uri] + list(client_args) client = self.run_xpra(cmd) r = pollwait(client, 5) if client.poll() is None: client.terminate() assert r==exit_code, "expected info client to return %s but got %s" % (exit_code, client.poll())
def check_server(cls, subcommand, display, *args): cmd = [subcommand, display, "--no-daemon"]+list(args) server_proc = cls.run_xpra(cmd) assert pollwait(server_proc, SERVER_TIMEOUT) is None, "server failed to start with '%s', returned %s" % (cmd, server_proc.poll()) live = cls.dotxpra.displays() assert display in live, "server display '%s' not found in live displays %s" % (display, live) #query it: info = cls.run_xpra(["version", display]) for _ in range(5): r = pollwait(info) log("version for %s returned %s", display, r) if r is not None: assert r==0, "version failed for %s, returned %s" % (display, info.poll()) break time.sleep(1) return server_proc
def set_clipboard_value(self, display, value, selection="clipboard"): cmd = "echo -n '%s' | xclip -d %s -selection %s -i" % (value, display, selection) xclip = self.run_command(cmd, shell=True) assert pollwait( xclip, 5) == 0, "xclip command %s returned %s" % (cmd, xclip.poll())
def stop_shadow_server(self, xvfb, server): self.check_stop_server(server, "stop", xvfb.display) time.sleep(1) assert pollwait( xvfb, 2 ) is None, "the Xvfb should not have been killed by xpra shutting down!" xvfb.terminate()
def test_proxy_start_stop(self): display = self.find_free_display() log("using free display=%s" % display) proxy = self.run_xpra(["proxy", display, "--no-daemon"]) assert pollwait(proxy, 5) is None, "proxy failed to start" assert display in self.dotxpra.displays(), "proxy display not found" self.check_stop_server(proxy, "stop", display)
def start_Xvfb(cls, display=None, screens=[(1024, 768)]): assert os.name == "posix" if display is None: display = cls.find_free_display() with OSEnvContext(): os.environ["DISPLAY"] = display XAUTHORITY = os.environ.get("XAUTHORITY", os.path.expanduser("~/.Xauthority")) if len(screens) > 1: cmd = [ "Xvfb", "+extension", "Composite", "-nolisten", "tcp", "-noreset", "-auth", XAUTHORITY ] for i, screen in enumerate(screens): (w, h) = screen cmd += ["-screen", "%i" % i, "%ix%ix24+32" % (w, h)] else: xvfb_cmd = cls.default_config.get("xvfb") assert xvfb_cmd, "no 'xvfb' command in default config" import shlex cmd = shlex.split(osexpand(xvfb_cmd)) if "/etc/xpra/xorg.conf" in cmd: cmd[cmd.index( "/etc/xpra/xorg.conf")] = "./etc/xpra/xorg.conf" cmd.append(display) xvfb = cls.run_command(cmd) assert pollwait( xvfb, XVFB_TIMEOUT ) is None, "xvfb command %s failed and returned %s" % (cmd, xvfb.poll()) return xvfb
def test_existing_Xvfb(self): display, xvfb, server = self.start_test_xvfb_and_server() self.check_stop_server(server, "stop", display) time.sleep(1) assert pollwait( xvfb, 2 ) is None, "the Xvfb should not have been killed by xpra shutting down!" xvfb.terminate()
def stop_server(cls, server_proc, subcommand="stop", *connect_args): log("stop_server%s", (server_proc, subcommand, connect_args)) if server_proc.poll(): return server_proc.terminate() assert pollwait( server_proc ) is not None, "server process %s failed to exit" % server_proc
def setUp(self): os.environ.clear() os.environ.update(self.default_env) self.temp_files = [] xpra_list = self.run_xpra(["list"]) assert pollwait( xpra_list, 15) is not None, "xpra list returned %s" % xpra_list.poll()
def start_server(self, *args): server_proc = self.run_xpra(["start", "--no-daemon"] + list(args)) if pollwait(server_proc, 10) is not None: r = server_proc.poll() raise Exception( "server failed to start with args=%s, returned %s" % (args, estr(r))) return server_proc
def check_stop_server(cls, server_proc, subcommand="stop", display=":99999"): stopit = cls.run_xpra([subcommand, display]) assert pollwait(stopit) is not None, "server failed to exit" assert display not in cls.dotxpra.displays( ), "server socket for display %s should have been removed" % display
def check_server(self, subcommand, display, *args): cmd = [subcommand] if display: cmd.append(display) if not WIN32: cmd += ["--no-daemon"] cmd += list(args) server_proc = self.run_xpra(cmd) if pollwait(server_proc, SERVER_TIMEOUT) is not None: self.show_proc_error(server_proc, "server failed to start") if display: #wait until the socket shows up: for _ in range(20): live = self.dotxpra.displays() if display in live: break time.sleep(1) if server_proc.poll() is not None: self.show_proc_error(server_proc, "server terminated") assert display in live, "server display '%s' not found in live displays %s" % ( display, live) #then wait a little before using it: time.sleep(1) #query it: version = None for _ in range(20): if version is None: args = ["version"] if display: args.append(display) version = self.run_xpra(args) r = pollwait(version, 1) log("version for %s returned %s", display, r) if r is not None: if r == 1: #re-run it version = None continue break time.sleep(1) if r != 0: self.show_proc_error( version, "version check failed for %s, returned %s" % (display, r)) return server_proc
def do_test_connect(self, sharing, *client_args): display = self.find_free_display() log("starting test server on %s", display) server = self.check_start_server(display, "--start=xterm", "--sharing=%s" % sharing) xvfb1, client1 = self.run_client(display, "--sharing=%s" % sharing, *client_args) r = pollwait(client1, CLIENT_TIMEOUT) assert r is None, "client1 exited with code %s" % EXIT_STR.get(r, r) xvfb2, client2 = self.run_client(display, "--sharing=%s" % sharing, *client_args) r = pollwait(client2, CLIENT_TIMEOUT) assert r is None, "client2 exited with code %s" % EXIT_STR.get(r, r) if not sharing: #starting a second client should disconnect the first when not sharing assert pollwait( client1, 2 ) is not None, "the first client should have been disconnected (sharing off)" #killing the Xvfb should kill the client xvfb1.terminate() xvfb2.terminate() assert pollwait(xvfb1, CLIENT_TIMEOUT) is not None assert pollwait(xvfb2, CLIENT_TIMEOUT) is not None assert pollwait(client1, CLIENT_TIMEOUT) is not None assert pollwait(client2, CLIENT_TIMEOUT) is not None server.terminate()
def cleanup_pulseaudio(self): self.audio_init_done.wait(5) proc = self.pulseaudio_proc if not proc: return soundlog("cleanup_pa() process.poll()=%s, pid=%s", proc.poll(), proc.pid) if self.is_child_alive(proc): self.pulseaudio_proc = None soundlog.info("stopping pulseaudio with pid %s", proc.pid) try: #first we try pactl (required on Ubuntu): cmd = ["pactl", "exit"] proc = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) self.add_process(proc, "pactl exit", cmd, True) r = pollwait(proc) #warning: pactl will return 0 whether it succeeds or not... #but we can't kill the process because Ubuntu starts a new one if r != 0 and self.is_child_alive(proc): #fallback to using SIGINT: proc.terminate() except Exception as e: soundlog.warn("cleanup_pulseaudio() error stopping %s", proc, exc_info=True) #only log the full stacktrace if the process failed to terminate: if self.is_child_alive(proc): soundlog.error("Error: stopping pulseaudio: %s", e, exc_info=True) if self.pulseaudio_private_socket and self.is_child_alive(proc): #wait for the pulseaudio process to exit, #it will delete the socket: soundlog("pollwait()=%s", pollwait(proc)) if self.pulseaudio_private_socket and not self.is_child_alive(proc): #wait for the socket to get cleaned up #(it should be removed by the pulseaudio server as it exits) import time now = monotonic() while (monotonic() - now) < 1 and os.path.exists( self.pulseaudio_private_socket): time.sleep(0.1) self.clean_pulseaudio_private_dir() if not self.is_child_alive(proc): self.do_clean_session_files("pulseaudio.pid")
def do_feed_splash(self, proc, lines=None, delay=1): while lines and proc.poll() is None: line = lines.pop(0) log("sending '%s'", line) proc.stdin.write(line.encode() + b"\n\r") proc.stdin.flush() if pollwait(proc, delay) is not None: break return proc
def test_full(self): self._feed_splash([ "10:10", "100:100", ]) r = pollwait(self.splash, 5) assert r is not None, "splash screen should have terminated" assert r == 0, "exit code should be zero, but got %s" % r self.stop_splash()
def test_existing_Xvfb(self): display = self.find_free_display() xvfb = self.start_Xvfb(display) time.sleep(1) assert display in self.find_X11_displays() #start server using this display: server = self.check_start_server(display, "--use-display") self.check_stop_server(server, "stop", display) time.sleep(1) assert pollwait(xvfb, 2) is None, "the Xvfb should not have been killed by xpra shutting down!" xvfb.terminate()
def _test_auth(self, auth="fail", uri_prefix="", exit_code=0, password=None): display = self.find_free_display() log("starting test server on %s", display) server = self.check_start_server(display, "--auth=%s" % auth, "--printing=no") #we should always be able to get the version: client = self.run_xpra(["version", uri_prefix+display]) assert pollwait(client, 5)==0, "version client failed to connect" if client.poll() is None: client.terminate() #try to connect cmd = ["info", uri_prefix+display] f = None if password: f = self._temp_file(password) cmd += ["--password-file=%s" % f.name] client = self.run_xpra(cmd) r = pollwait(client, 5) if f: f.close() assert r==exit_code, "expected info client to return %s but got %s" % (exit_code, client.poll()) if client.poll() is None: client.terminate() server.terminate()
def do_test_control_send_file(self, data): f = self._temp_file(data) try: display = self.find_free_display() server = self.check_start_server(display) xvfb, client = self.run_client(display) assert pollwait(client, CLIENT_TIMEOUT) is None #send a file to this client: send_file_command = ["control", display, "send-file", f.name, "1", "*"] send_file = self.run_xpra(send_file_command) assert pollwait(send_file, CLIENT_TIMEOUT)==0, "send-file command returncode is %s" % send_file.poll() #now verify the file can be found in the download directory from xpra.platform.paths import get_download_dir filename = os.path.join(os.path.expanduser(get_download_dir()), os.path.basename(f.name)) assert os.path.exists(filename), "cannot find %s" % filename readback = load_binary_file(filename) assert readback==data os.unlink(filename) #cleanup: client.terminate() xvfb.terminate() server.terminate() finally: f.close()
def do_test_connect(self, sharing=False, *client_args): display = self.find_free_display() log("starting test server on %s", display) server = self.check_start_server(display, "--start=xterm", "--sharing=%s" % sharing) xvfb1, client1 = self.run_client(display, "--sharing=%s" % sharing, *client_args) assert pollwait(client1, CLIENT_TIMEOUT) is None xvfb2, client2 = self.run_client(display, "--sharing=%s" % sharing, *client_args) assert pollwait(client2, CLIENT_TIMEOUT) is None if not sharing: #starting a second client should disconnect the first when not sharing assert pollwait(client1, 2) is not None, "the first client should have been disconnected (sharing off)" #killing the Xvfb should kill the client xvfb1.terminate() xvfb2.terminate() assert pollwait(xvfb1, CLIENT_TIMEOUT) is not None assert pollwait(xvfb2, CLIENT_TIMEOUT) is not None assert pollwait(client1, CLIENT_TIMEOUT) is not None assert pollwait(client2, CLIENT_TIMEOUT) is not None server.terminate()
def set_clipboard_value(self, display, value, selection="clipboard"): xclip = self.run_command("echo -n '%s' | xclip -d %s -selection %s -i" % (value, display, selection), shell=True) assert pollwait(xclip, 5)==0, "xclip returned %s" % xclip.poll()
def start_server(cls, *args): server_proc = cls.run_xpra(["start", "--no-daemon"]+list(args)) assert pollwait(server_proc, 5) is None, "server failed to start, returned %s" % server_proc.poll() return server_proc