Merge lp:~nskaggs/autopilot/add-wm-sandbox-run into lp:autopilot

Proposed by Nicholas Skaggs on 2014-11-19
Status: Merged
Approved by: Christopher Lee on 2015-07-14
Approved revision: 519
Merged at revision: 562
Proposed branch: lp:~nskaggs/autopilot/add-wm-sandbox-run
Merge into: lp:autopilot
Diff against target: 102 lines (+30/-15)
1 file modified
bin/autopilot3-sandbox-run (+30/-15)
To merge this branch: bzr merge lp:~nskaggs/autopilot/add-wm-sandbox-run
Reviewer Review Type Date Requested Status
Christopher Lee (community) 2014-11-19 Approve on 2015-07-14
PS Jenkins bot continuous-integration Approve on 2015-05-26
Jean-Baptiste Lallement 2014-11-19 Pending
Review via email: mp+242274@code.launchpad.net

Commit Message

Add window manager support for autopilot sandbox run, fixes 1379508

Description of the Change

Add window manager support for autopilot sandbox run, fixes 1379508

To post a comment you must log in.
Nicholas Skaggs (nskaggs) wrote :

this doesn't handle arguments correctly for some reason, but otherwise works. I'd appreciate any cleanup help.

518. By Nicholas Skaggs on 2014-12-01

remove debugging echo

Nicholas Skaggs (nskaggs) wrote :

getopts, you are mine. Thanks robotfuel for the pointer about how : works.

519. By Nicholas Skaggs on 2015-05-21

turn off usewm by default

Christopher Lee (veebers) wrote :

One inline question.

review: Needs Information
Nicholas Skaggs (nskaggs) wrote :

Replied.

Christopher Lee (veebers) wrote :

LGTM, only bottom approving it for me as there is a landing/release happening.

review: Approve
Nicholas Skaggs (nskaggs) wrote :

Tested by running

autopilot3-sandbox-run qml2/
autopilot3-sandbox-run -s 400x600x24 qml2/
autopilot3-sandbox-run -w tinywm qml2/
autopilot3-sandbox-run -w tinywm -s 400x600x24 qml2/
autopilot3-sandbox-run -X qml2/
autopilot3-sandbox-run -X -w tinywm qml2/
autopilot3-sandbox-run -X -w tinywm -s 400x600x24 qml2/

Each scenario should work as expected. Specifically, running with -w should only launch a wm

Nicholas Skaggs (nskaggs) wrote :

Veebers is this going to make it in the next release?

Christopher Lee (veebers) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/autopilot3-sandbox-run'
2--- bin/autopilot3-sandbox-run 2014-05-15 06:18:19 +0000
3+++ bin/autopilot3-sandbox-run 2015-05-21 20:20:26 +0000
4@@ -3,11 +3,11 @@
5 #
6 # Runner to execute autopilot locally
7 #
8-# This scripts run autopilot in a "fake" X server, either headless with xvfb
9-# or nested with Xephyr
10+# This scripts run autopilot in a "fake" X server, and optionally a
11+# window manager with either headless with xvfb or nested with Xephyr
12 #
13
14-# Copyright (C) 2013 Canonical
15+# Copyright (C) 2013-2015 Canonical
16 #
17 # Authors: Jean-Baptiste Lallement <jean-baptiste.lallement@canonical.com>
18 #
19@@ -38,7 +38,9 @@
20
21 SERVERNUM=5
22 SCREEN="1024x768x24"
23-
24+USEWM=0
25+WINDOWMANAGER="ratpoison"
26+WINDOWMANAGER_CMD="$(which $WINDOWMANAGER||true)"
27 DBUS_SESSION_BUS_PID=""
28 X_PID=""
29
30@@ -48,17 +50,18 @@
31 Usage: $(basename $0) [OPTIONS...] TEST [TEST...]
32 Runs autopilot tests in a 'fake' Xserver with Xvfb or Xephyr. autopilot runs
33 in Xvfb by default.
34-
35+
36 TEST: autopilot tests to run
37
38 Options:
39- -h, --help This help
40- -d, --debug Enable debug mode
41- -a, --autopilot ARG Pass arguments ARG to 'autopilot run'
42- -X, --xephyr Run in nested mode with Xephyr
43- -s, --screen WxHxD Sets screen width, height, and depth to W, H, and D
44- respectively (default: $SCREEN)
45-
46+ -h, --help This help
47+ -d, --debug Enable debug mode
48+ -a, --autopilot ARG Pass arguments ARG to 'autopilot run'
49+ -X, --xephyr Run in nested mode with Xephyr
50+ -s, --screen WxHxD Sets screen width, height, and depth to W, H, and D
51+ respectively (default: $SCREEN)
52+ -w, --windowmanager WM Start a window manager WM before executing tests
53+ (suggested: $WINDOWMANAGER)
54 EOF
55 RC=1
56 exit
57@@ -117,8 +120,8 @@
58
59 trap on_exit EXIT INT QUIT ABRT PIPE TERM
60
61-SHORTOPTS="hda:s:X"
62-LONGOPTS="help,debug,autopilot:,screen:,xephyr"
63+SHORTOPTS="hda:s:Xw:"
64+LONGOPTS="help,debug,autopilot:,screen:,xephyr,windowmanager:"
65
66 TEMP=$(getopt -o $SHORTOPTS --long $LONGOPTS -- "$@")
67 eval set -- "$TEMP"
68@@ -138,6 +141,14 @@
69 -s|-screen)
70 SCREEN=$2
71 shift 2;;
72+ -w|--windowmanager)
73+ USEWM=1
74+ WINDOWMANAGER=$2
75+ WINDOWMANAGER_CMD="$(which $WINDOWMANAGER||true)"
76+ [ ! -x "$WINDOWMANAGER_CMD" ] && \
77+ echo "E: $WINDOWMANAGER Executable not found." &&\
78+ RC=1 && exit 1
79+ shift 2;;
80 -X|--xephyr)
81 XEPHYR=1
82 [ ! -x "$XEPHYR_CMD" ] && \
83@@ -154,7 +165,7 @@
84 if [ $XEPHYR -eq 0 -a ! -x "$XVFB_CMD" ]; then
85 echo "E: Xvfb executable not found. Please install xvfb"
86 RC=1
87- exit
88+ exit
89 fi
90
91 TESTLIST="$@"
92@@ -171,6 +182,10 @@
93
94 export XAUTHORITY=/dev/null
95 wait_for_x $SERVERNUM
96+if [ "$USEWM" -eq 1 ]; then
97+ echo "I: Starting window manager: $WINDOWMANAGER_CMD"
98+ dbus-launch --exit-with-session $WINDOWMANAGER_CMD &
99+fi
100 echo "I: Starting autopilot"
101 dbus-launch --exit-with-session python3 -m autopilot.run run $AP_OPT $TESTLIST || RC=$?
102 echo "I: autopilot tests done"

Subscribers

People subscribed via source and target branches