Created
November 13, 2015 19:00
-
-
Save tullmann/2d8d38444c5e81a41b6d to your computer and use it in GitHub Desktop.
Wrapper for XVFB with chrome testing work-arounds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# bb-xvfb <command> <and> <its> <arguments...> | |
# | |
# Wrapper for XVFB. Capture XVFB logs where we can see them. Dump | |
# XVFB framebuffer where can we can see it. Use a standard display size | |
# and dpi for all of our XVFB-wrapped tests. | |
# | |
# Note: "32" is not a valid depth for xvfb: https://bugs.freedesktop.org/show_bug.cgi?id=17453 (from 2008) | |
SCREEN_SIZE="1280x1024x24+32" | |
BINDIR="$(dirname $0)" | |
TMPDIR=/tmp | |
if [ ! -d "$TMPDIR" ]; then | |
echo "Invalid tmp directory: ${TMPDIR}" | |
exit 1 | |
fi | |
# Avoid race conditions in google-chrome startup by making sure there is a | |
# dbus message bus up and running. | |
# See https://code.google.com/p/chromium/issues/detail?id=309093 | |
DBUS="dbus-launch --exit-with-session" | |
WAITFORX="${BINDIR}/waitForX" | |
XVFBDIR="${TMPDIR}/xvfb.$$" | |
mkdir -p "${XVFBDIR}" | |
ERRFILE="${XVFBDIR}/xvfb.log" | |
# Pass the "-fbdir" to force xvfb to use a memory-mapped file. This makes screenshots and debugging easier. | |
# To display said framebuffer contents: xwud -in ${XVFBDIR}/Xvfb_screen0 | |
exec xvfb-run \ | |
--error-file="${ERRFILE}" \ | |
--auto-servernum \ | |
--server-args="-fbdir ${XVFBDIR} -screen 0 ${SCREEN_SIZE} -dpi 96 -ac" \ | |
${WAITFORX} ${RECORD} ${DBUS} "$@" | |
#eof |
What is ${RECORD}
supposed to be?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Doing the following gives me an error:
./bb-xvfb.sh
xvfb-run: usage error: need a command to run
Usage: xvfb-run [OPTION ...] COMMAND
Run COMMAND (usually an X client) in a virtual X server environment.
Options:
-a --auto-servernum try to get a free server number, starting at
--server-num (deprecated, use --auto-display
instead)
-d --auto-display use the X server to find a display number
automatically
-e FILE --error-file=FILE file used to store xauth errors and Xvfb
output (default: /dev/null)
-f FILE --auth-file=FILE file used to store auth cookie
(default: ./.Xauthority)
-h --help display this usage message and exit
-n NUM --server-num=NUM server number to use (default: 99)
-l --listen-tcp enable TCP port listening in the X server
-p PROTO --xauth-protocol=PROTO X authority protocol name to use
(default: xauth command's default)
-s ARGS --server-args=ARGS arguments (other than server number and
"-nolisten tcp") to pass to the Xvfb server
(default: "-screen 0 640x480x8")
-w DELAY --wait=DELAY delay in seconds to wait for Xvfb to start
before running COMMAND (default: 3)
can you tell what i am doing wrong. :)