summaryrefslogtreecommitdiffstats
path: root/run_test_suite
diff options
context:
space:
mode:
authorTails developers <amnesia@boum.org>2012-11-13 13:19:41 +0100
committerTails developers <amnesia@boum.org>2013-01-25 09:40:46 +0100
commit9c8951c8c7f896ef3be5c30b8f8e67ea30e240c2 (patch)
treec50279bf6f3a16d883c39cd2cca9129ffa924afc /run_test_suite
parent9db7cc43101a54abba38135fadac68df6d9fa039 (diff)
Add option to capture a video of the test display.
Also getopt:ify the script while were at it.
Diffstat (limited to 'run_test_suite')
-rwxr-xr-xrun_test_suite53
1 files changed, 42 insertions, 11 deletions
diff --git a/run_test_suite b/run_test_suite
index ce59fab..6348027 100755
--- a/run_test_suite
+++ b/run_test_suite
@@ -4,6 +4,7 @@
set -e
+NAME="$0"
TARGET_DISPLAY=:8
start_xvfb() {
@@ -15,7 +16,7 @@ start_xvfb() {
start_vnc_server() {
VNC_SERVER_PORT="$(x11vnc -listen localhost -display ${TARGET_DISPLAY} \
-bg -nopw 2>&1 | \
- grep -m 1 "^PORT=[0-9]\+" | sed 's/^PORT=//')"
+ grep -m 1 "^PORT=[0-9]\+" | sed 's/^PORT=//')"
echo "VNC server running on: localhost:${VNC_SERVER_PORT}"
}
@@ -25,18 +26,48 @@ start_vnc_viewer() {
# main script
-start_xvfb
-
-if [ "${1}" = "--view" ]; then
- VNC_VIEWER=yes
- VNC_SERVER=yes
- shift
-elif [ "${1}" = "--vnc-server-only" ]; then
- VNC_VIEWER=
- VNC_SERVER="yes"
+unset CAPTURE_FILE VNC_VIEWER VNC_SERVER
+SHORTOPTS="a:c"
+LONGOPTS="view,vnc-server-only,capture:"
+OPTS=$(getopt -o $SHORTOPTS --longoptions $LONGOPTS -n "${NAME}" -- "$@")
+eval set -- "$OPTS"
+while [ $# -gt 0 ]; do
+ case $1 in
+ --view)
+ VNC_VIEWER=yes
+ VNC_SERVER=yes
+ ;;
+ --vnc-server-only)
+ VNC_VIEWER=
+ VNC_SERVER=yes
+ ;;
+ --capture)
+ shift
+ CAPTURE_FILE="$1"
+ ;;
+ --)
+ shift
+ if [ -n "$1" ]; then
+ ISO="$(readlink -f $1)"
+ fi
+ break
+ ;;
+ esac
shift
+done
+
+if [ -z "${ISO}" ]; then
+ echo "No ISO provided. Aborting..." >&2
+ exit 1
fi
+start_xvfb
+
+if [ -n "${CAPTURE_FILE}" ]; then
+ echo "Capturing guest display into ${CAPTURE_FILE}"
+ ffmpeg -f x11grab -s 1024x768 -r 15 -i ${TARGET_DISPLAY}.0 -an \
+ -vcodec libvpx -y "${CAPTURE_FILE}" >/dev/null 2>&1 &
+fi
if [ -n "${VNC_SERVER}" ]; then
start_vnc_server
fi
@@ -46,7 +77,7 @@ fi
export SIKULI_HOME="/usr/share/java"
export DISPLAY=${TARGET_DISPLAY}
-export ISO="$(readlink -f $1)"
+export ISO="${ISO}"
cd features
. ./.rvmrc
cucumber cucumber/