[Spice-devel] [PATCH xspice 2/2] xspice: add tests for audio remoting
Uri Lublin
uril at redhat.com
Mon Oct 21 10:20:35 CEST 2013
Hi Alon,
On 10/20/2013 04:34 PM, Alon Levy wrote:
> Signed-off-by: Alon Levy <alevy at redhat.com>
>
> diff --git a/tests/xspice_audio_test.py b/tests/xspice_audio_test.py
> +def main():
> + port = 8000
> + xspice = launch_xspice(port)
> + sleep(2)
> + client = launch_client(port)
> + sleep(1)
> + produce_audio(xspice.audio_fifo_dir)
> + sleep(2)
> + client.kill()
> + xspice.kill()
> +
> +if __name__ == '__main__':
> + main()
> diff --git a/tests/xspice_util.py b/tests/xspice_util.py
> +
> +
> +def which(prog):
> + for path_element in os.environ['PATH'].split(':'):
> + candidate = os.path.join(path_element, prog)
> + if os.path.exists(candidate):
> + return candidate
> + return None
> +
> +client_executable = which('remote-viewer')
> +if not client_executable:
> + raise SystemExit('missing remote-viewer in path')
> +
> +def launch_xspice(port):
> + basedir = '/tmp/xspice_test_audio'
> + if not os.path.exists(basedir):
> + os.mkdir(basedir)
> + assert(os.path.exists(basedir))
> + xspice = Process.new(['../scripts/Xspice', '--port', '8000', '--auto', '--audio-fifo-dir', basedir, '--disable-ticketing', ':15.0'])
To make it work for ports other than 8000:
s,'8000','%s' % port,
Regards,
Uri.
> + xspice.audio_fifo_dir = basedir
> + return xspice
> +
> +def launch_client(port):
> + client = Process.new([client_executable, 'spice://localhost:%s' % port])
> + return client
> +
> +if __name__ == '__main__':
> + launch_xspice(port=8000)
More information about the Spice-devel
mailing list