Lines Matching +full:xvfb +full:- +full:run

3 # Use of this source code is governed by a BSD-style license that can be
6 """Runs tests with Xvfb or Xorg and Openbox or Weston on Linux and normally on
30 # pylint: disable=useless-object-inheritance
34 """Exception raised when Xvfb or Xorg cannot start."""
66 def launch_dbus(env): # pylint: disable=inconsistent-return-statements
70 async-signal-safe (in particular, memory allocations) between fork and exec
84 Returns the pid of the dbus-daemon if started, or None otherwise.
90 ['dbus-launch'], env=env).decode('utf-8').split('\n')
104 """Runs an executable within Weston, Xvfb or Xorg on Linux or normally on
107 The method sets SIGUSR1 handler for Xvfb to return SIGUSR1
113 env: A copy of environment variables. "DISPLAY" and will be set if Xvfb is
121 xvfb_whd: WxHxD to pass to xvfb or DEFAULT_XVFB_WHD if None
128 # It might seem counterintuitive to support a --no-xvfb flag in a script
129 # whose only job is to start xvfb, but doing so allows us to consolidate
131 # xvfb by default and don't have to worry about the distinction, it
134 if '--no-xvfb' in cmd:
136 cmd.remove('--no-xvfb')
138 # Xorg is mostly a drop in replacement to Xvfb but has better support for
139 # dummy drivers and multi-screen testing (See: crbug.com/40257169 and
141 # (package: xserver-xorg-core)
143 if '--use-xorg' in cmd:
146 cmd.remove('--use-xorg')
148 # Tests that run on Linux platforms with Ozone/Wayland backend require
149 # a Weston instance. However, it is also required to disable xvfb so
150 # that Weston can run in a pure headless environment.
152 if '--use-weston' in cmd:
154 print('Unable to use Weston with xvfb or Xorg.\n', file=sys.stderr)
157 cmd.remove('--use-weston')
183 # Dummy driver requires package `xserver-xorg-video-dummy`.
205 """Runs with an X11 server. Uses Xvfb by default and Xorg when use_xorg is
219 x11_binary = 'Xorg' if use_xorg else 'Xvfb'
232 # required. Xvfb does not have a '-version' option, so checking the
233 # '-help' output is required.
239 ['Xvfb', '-help'], stderr=subprocess.STDOUT).decode('utf8')
241 # Due to race condition for display number, Xvfb/Xorg might fail to run.
242 # If it does fail, try again up to 10 times, similarly to xvfb-run.
249 x11_cmd = ['Xorg', display, '-config', xorg_config_file]
251 x11_cmd = ['Xvfb', display, '-screen', '0', xvfb_whd, '-ac',
252 '-nolisten', 'tcp', '-dpi', '96', '+extension', 'RANDR']
253 if '-maxclients' in xvfb_help:
254 x11_cmd += ['-maxclients', '512']
256 # Sets SIGUSR1 to ignore for Xvfb/Xorg to signal current process
264 time.sleep(.1) # gives Xvfb/Xorg time to start or fail.
266 break # xvfb/xorg sent ready signal, or already failed and stopped.
270 break # xvfb/xorg is ready
287 # The CMD that is passed via the --startup flag.
288 openbox_startup_cmd = 'kill --signal SIGUSR1 %s' % str(current_proc_id)
293 ['openbox', '--sm-disable', '--startup',
323 # dbus-daemon is not a subprocess, so we can't SIGTERM+waitpid() on it.
344 # //ui/ozone at all, but still have --use-weston flag set by the
346 # in failures and those tests cannot be run because of the exception that
349 # run tests without Wayland compositor if the weston binary is not found.
359 # 1) panel-position=none - disables the panel, which might interfere with
362 weston_config_file.write('[shell]\npanel-position=none')
365 # fetched as data deps. Thus, run it from the current directory.
368 # 1) --backend=headless-backend.so - runs Weston in a headless mode
370 # 2) --idle-time=0 - disables idle timeout, which prevents Weston
372 # and tests start to time out (this typically happens after 300 seconds -
374 # 3) --modules=ui-controls.so,systemd-notify.so - enables support for the
375 # ui-controls Wayland protocol extension and the systemd-notify protocol.
376 # 4) --width && --height set size of a virtual display: we need to set
379 # 5) --config=... - tells Weston to use our custom config.
380 weston_cmd = ['./weston', '--backend=headless-backend.so', '--idle-time=0',
381 '--modules=ui-controls.so,systemd-notify.so', '--width=1280',
382 '--height=800', '--config=' + _weston_config_file_path()]
384 if '--weston-use-gl' in cmd:
386 weston_cmd.append('--use-gl')
387 cmd.remove('--weston-use-gl')
389 if '--weston-debug-logging' in cmd:
390 cmd.remove('--weston-debug-logging')
394 # We use the systemd-notify protocol to detect whether weston has launched
397 # systemd-notify module, weston will send a 'READY=1' message to the socket
399 # See the sd_notify(3) man page and weston's compositor/systemd-notify.c for
422 # systemd-notify module. This happens shortly before spawning its
423 # subprocesses (e.g. desktop-shell). Wait some more to ensure they
446 if '--chrome-wayland-debugging' in cmd:
447 cmd.remove('--chrome-wayland-debugging')
468 # dbus-daemon is not a subprocess, so we can't SIGTERM+waitpid() on it.
475 return os.path.join(tempfile.gettempdir(), '.xvfb.py-weston-notify.sock')
478 return os.path.join(tempfile.gettempdir(), '.xvfb.py-weston.ini')
538 """Iterates through X-lock files to find an available display number.
540 The lower bound follows xvfb-run standard at 99, and the upper bound
544 A string of a random available display number for Xvfb ':{99-119}'.
552 if not os.path.isfile('/tmp/.X{}-lock'.format(d))
563 runtime_dir = '/tmp/xdg-tmp-dir/'
570 usage = ('Usage: xvfb.py '
571 '[command [--no-xvfb or --use_xorg or --use-weston] args...]')
572 # TODO(crbug.com/326283384): Argparse-ify this.