Merge lp:~lool/ubuntu-test-cases/powerd-lock into lp:ubuntu-test-cases

Proposed by Loïc Minier
Status: Merged
Merge reported by: Andy Doan
Merged at revision: not available
Proposed branch: lp:~lool/ubuntu-test-cases/powerd-lock
Merge into: lp:ubuntu-test-cases
Diff against target: 4786 lines (+3793/-0) (has conflicts)
186 files modified
jenkins/setup_jenkins.py (+216/-0)
jenkins/templates/touch-address-book-app-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-autopilot-base.xml.jinja2 (+23/-0)
jenkins/templates/touch-base.xml.jinja2 (+98/-0)
jenkins/templates/touch-calendar-app-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-camera-app-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-click_image_tests.xml.jinja2 (+6/-0)
jenkins/templates/touch-default.xml.jinja2 (+6/-0)
jenkins/templates/touch-dialer-app-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-dropping-letters-app-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-eventstat.xml.jinja2 (+20/-0)
jenkins/templates/touch-friends-app-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-gallery-app-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-install-and-boot.xml.jinja2 (+28/-0)
jenkins/templates/touch-master.xml.jinja2 (+54/-0)
jenkins/templates/touch-mediaplayer-app-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-memevent.xml.jinja2 (+9/-0)
jenkins/templates/touch-messaging-app-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-music-app-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-notes-app-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-sdk.xml.jinja2 (+7/-0)
jenkins/templates/touch-security.xml.jinja2 (+7/-0)
jenkins/templates/touch-setup.xml.jinja2 (+6/-0)
jenkins/templates/touch-share-app-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-smem.xml.jinja2 (+20/-0)
jenkins/templates/touch-ubuntu-calculator-app-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-ubuntu-clock-app-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-ubuntu-clock-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-ubuntu-docviewer-app-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-ubuntu-filemanager-app-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-ubuntu-rssreader-app-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-ubuntu-terminal-app-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-ubuntu-ui-toolkit-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-ubuntu-weather-app-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-unity8-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-upgrade.xml.jinja2 (+28/-0)
jenkins/templates/touch-webbrowser-app-autopilot.xml.jinja2 (+6/-0)
scripts/get-adb-id (+33/-0)
scripts/jenkins.sh (+198/-0)
scripts/provision.sh (+94/-0)
scripts/run-touch-upgrade.sh (+46/-0)
scripts/run-touch-utah-runlist.sh (+65/-0)
tests/address-book-app-autopilot/master.run (+15/-0)
tests/address-book-app-autopilot/ts_control (+1/-0)
tests/address-book-app-autopilot/tslist.auto (+4/-0)
tests/calendar-app-autopilot/master.run (+15/-0)
tests/calendar-app-autopilot/ts_control (+1/-0)
tests/calendar-app-autopilot/tslist.auto (+4/-0)
tests/camera-app-autopilot/master.run (+15/-0)
tests/camera-app-autopilot/ts_control (+1/-0)
tests/camera-app-autopilot/tslist.auto (+4/-0)
tests/click_image_tests/check_preinstalled_list/check_preinstalled_list.py (+61/-0)
tests/click_image_tests/check_preinstalled_list/tc_control (+10/-0)
tests/click_image_tests/master.run (+5/-0)
tests/click_image_tests/tslist.run (+1/-0)
tests/default/ifconfig/tc_control (+13/-0)
tests/default/install/tc_control (+12/-0)
tests/default/master.run (+5/-0)
tests/default/netstat/tc_control (+12/-0)
tests/default/ping/pingtest.sh (+12/-0)
tests/default/ping/tc_control (+12/-0)
tests/default/pwd/tc_control (+9/-0)
tests/default/pwd/test.sh (+18/-0)
tests/default/route/tc_control (+12/-0)
tests/default/systemsettle/systemsettle.sh (+120/-0)
tests/default/systemsettle/tc_control (+9/-0)
tests/default/ts_control (+3/-0)
tests/default/tslist.run (+10/-0)
tests/default/uname/tc_control (+12/-0)
tests/default/unity8/tc_control (+9/-0)
tests/default/vmstat/tc_control (+12/-0)
tests/dialer-app-autopilot/master.run (+15/-0)
tests/dialer-app-autopilot/ts_control (+1/-0)
tests/dialer-app-autopilot/tslist.auto (+4/-0)
tests/dropping-letters-app-autopilot/master.run (+15/-0)
tests/dropping-letters-app-autopilot/ts_control (+1/-0)
tests/dropping-letters-app-autopilot/tslist.auto (+4/-0)
tests/eventstat/eventstat/eventstat.sh (+5/-0)
tests/eventstat/eventstat/setup.sh (+7/-0)
tests/eventstat/eventstat/tc_control (+12/-0)
tests/eventstat/master.run (+5/-0)
tests/eventstat/tslist.run (+1/-0)
tests/friends-app-autopilot/master.run (+15/-0)
tests/friends-app-autopilot/ts_control (+1/-0)
tests/friends-app-autopilot/tslist.auto (+4/-0)
tests/gallery-app-autopilot/master.run (+15/-0)
tests/gallery-app-autopilot/ts_control (+1/-0)
tests/gallery-app-autopilot/tslist.auto (+4/-0)
tests/install-and-boot/boot/tc_control (+9/-0)
tests/install-and-boot/master.run (+5/-0)
tests/install-and-boot/tslist.run (+1/-0)
tests/mediaplayer-app-autopilot/master.run (+15/-0)
tests/mediaplayer-app-autopilot/ts_control (+1/-0)
tests/mediaplayer-app-autopilot/tslist.auto (+4/-0)
tests/memevent/master.run (+5/-0)
tests/memevent/setup.sh (+8/-0)
tests/memevent/ts_control (+1/-0)
tests/memevent/tslist.auto (+7/-0)
tests/memevent/ubuntu_test_cases/__init__.py (+6/-0)
tests/memevent/ubuntu_test_cases/memory_usage_measurement/__init__.py (+1/-0)
tests/memevent/ubuntu_test_cases/memory_usage_measurement/apps/__init__.py (+21/-0)
tests/memevent/ubuntu_test_cases/memory_usage_measurement/apps/browser.py (+103/-0)
tests/memevent/ubuntu_test_cases/memory_usage_measurement/apps/camera.py (+58/-0)
tests/memevent/ubuntu_test_cases/memory_usage_measurement/apps/gallery.py (+41/-0)
tests/memevent/ubuntu_test_cases/memory_usage_measurement/apps/media_player.py (+53/-0)
tests/memevent/ubuntu_test_cases/memory_usage_measurement/matchers.py (+37/-0)
tests/memevent/ubuntu_test_cases/memory_usage_measurement/probes.py (+170/-0)
tests/memevent/ubuntu_test_cases/memory_usage_measurement/smem-tabs (+687/-0)
tests/memevent/ubuntu_test_cases/memory_usage_measurement/tests/__init__.py (+1/-0)
tests/memevent/ubuntu_test_cases/memory_usage_measurement/tests/test_memory_usage.py (+81/-0)
tests/messaging-app-autopilot/master.run (+15/-0)
tests/messaging-app-autopilot/ts_control (+1/-0)
tests/messaging-app-autopilot/tslist.auto (+4/-0)
tests/music-app-autopilot/master.run (+15/-0)
tests/music-app-autopilot/ts_control (+1/-0)
tests/music-app-autopilot/tslist.auto (+4/-0)
tests/notes-app-autopilot/master.run (+15/-0)
tests/notes-app-autopilot/ts_control (+1/-0)
tests/notes-app-autopilot/tslist.auto (+4/-0)
tests/sdk/check-packages/check-packages.sh (+14/-0)
tests/sdk/check-packages/tc_control (+9/-0)
tests/sdk/master.run (+5/-0)
tests/sdk/tslist.run (+1/-0)
tests/security/check-apparmor/check-apparmor.sh (+12/-0)
tests/security/check-apparmor/tc_control (+9/-0)
tests/security/check-packages/check-packages.sh (+12/-0)
tests/security/check-packages/tc_control (+9/-0)
tests/security/check-ufw/check-ufw.sh (+12/-0)
tests/security/check-ufw/tc_control (+9/-0)
tests/security/master.run (+5/-0)
tests/security/ts_control (+1/-0)
tests/security/tslist.run (+3/-0)
tests/share-app-autopilot/master.run (+15/-0)
tests/share-app-autopilot/ts_control (+1/-0)
tests/share-app-autopilot/tslist.auto (+4/-0)
tests/systemsettle/systemsettle-after/tc_control (+9/-0)
tests/systemsettle/systemsettle-before/tc_control (+9/-0)
tests/systemsettle/systemsettle.sh (+119/-0)
tests/systemsettle/tslist.run (+2/-0)
tests/ubuntu-calculator-app-autopilot/master.run (+15/-0)
tests/ubuntu-calculator-app-autopilot/ts_control (+1/-0)
tests/ubuntu-calculator-app-autopilot/tslist.auto (+4/-0)
tests/ubuntu-clock-app-autopilot/master.run (+15/-0)
tests/ubuntu-clock-app-autopilot/ts_control (+1/-0)
tests/ubuntu-clock-app-autopilot/tslist.auto (+4/-0)
tests/ubuntu-docviewer-app-autopilot/master.run (+15/-0)
tests/ubuntu-docviewer-app-autopilot/ts_control (+1/-0)
tests/ubuntu-docviewer-app-autopilot/tslist.auto (+4/-0)
tests/ubuntu-filemanager-app-autopilot/master.run (+15/-0)
tests/ubuntu-filemanager-app-autopilot/ts_control (+1/-0)
tests/ubuntu-filemanager-app-autopilot/tslist.auto (+4/-0)
tests/ubuntu-rssreader-app-autopilot/master.run (+15/-0)
tests/ubuntu-rssreader-app-autopilot/ts_control (+1/-0)
tests/ubuntu-rssreader-app-autopilot/tslist.auto (+4/-0)
tests/ubuntu-terminal-app-autopilot/master.run (+15/-0)
tests/ubuntu-terminal-app-autopilot/ts_control (+1/-0)
tests/ubuntu-terminal-app-autopilot/tslist.auto (+4/-0)
tests/ubuntu-ui-toolkit-autopilot/master.run (+15/-0)
tests/ubuntu-ui-toolkit-autopilot/ts_control (+1/-0)
tests/ubuntu-ui-toolkit-autopilot/tslist.auto (+4/-0)
tests/ubuntu-weather-app-autopilot/master.run (+15/-0)
tests/ubuntu-weather-app-autopilot/ts_control (+1/-0)
tests/ubuntu-weather-app-autopilot/tslist.auto (+4/-0)
tests/unity8-autopilot/master.run (+15/-0)
tests/unity8-autopilot/setup.sh (+6/-0)
tests/unity8-autopilot/ts_control (+2/-0)
tests/unity8-autopilot/tslist.auto (+4/-0)
tests/upgrade/README (+3/-0)
tests/upgrade/install_old/run.sh (+27/-0)
tests/upgrade/install_old/tc_control (+9/-0)
tests/upgrade/master.run (+5/-0)
tests/upgrade/tslist.run (+2/-0)
tests/upgrade/upgrade/tc_control (+9/-0)
tests/upgrade/upgrade/upgrade.sh (+79/-0)
tests/webbrowser-app-autopilot/master.run (+15/-0)
tests/webbrowser-app-autopilot/ts_control (+1/-0)
tests/webbrowser-app-autopilot/tslist.auto (+4/-0)
utils/host/adb-shell (+20/-0)
utils/host/autopilot-list (+18/-0)
utils/host/autopilot-run (+6/-0)
utils/host/prepare-autopilot-test.sh (+5/-0)
utils/target/autopilot-list (+13/-0)
utils/target/autopilot-run (+6/-0)
utils/target/prepare-autopilot-test.sh (+17/-0)
utils/target/unlock_screen.py (+96/-0)
utils/target/unlock_screen.sh (+7/-0)
Conflict adding file scripts.  Moved existing file to scripts.moved.
To merge this branch: bzr merge lp:~lool/ubuntu-test-cases/powerd-lock
Reviewer Review Type Date Requested Status
Andy Doan (community) Approve
Review via email: mp+189191@code.launchpad.net

Commit message

Workaround #1235000 by taking a powerd-cli lock while starting unity8.

Description of the change

This should allow running unity8 tests on Mir, working around #1235000.

To post a comment you must log in.
Revision history for this message
Chris Johnston (cjohnston) wrote :

This is proposed against the wrong branch. Please propose against
lp:ubuntu-test-cases/touch

Revision history for this message
Andy Doan (doanac) wrote :

I merged it to the proper branch. It was a trivial change

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'jenkins'
2=== added file 'jenkins/setup_jenkins.py'
3--- jenkins/setup_jenkins.py 1970-01-01 00:00:00 +0000
4+++ jenkins/setup_jenkins.py 2013-10-03 23:14:25 +0000
5@@ -0,0 +1,216 @@
6+#!/usr/bin/env python
7+
8+# Ubuntu Testing Automation Harness
9+# Copyright 2013 Canonical Ltd.
10+
11+# This program is free software: you can redistribute it and/or modify it
12+# under the terms of the GNU General Public License version 3, as published
13+# by the Free Software Foundation.
14+
15+# This program is distributed in the hope that it will be useful, but
16+# WITHOUT ANY WARRANTY; without even the implied warranties of
17+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
18+# PURPOSE. See the GNU General Public License for more details.
19+
20+# You should have received a copy of the GNU General Public License along
21+# with this program. If not, see <http://www.gnu.org/licenses/>.
22+
23+import argparse
24+import collections
25+import jenkins
26+import jinja2
27+import logging
28+import os
29+
30+from distro_info import UbuntuDistroInfo
31+DEV_SERIES = UbuntuDistroInfo().devel()
32+
33+Test = collections.namedtuple('Test', ['name', 'fmt', 'restrict_to'])
34+
35+
36+def _test(name, fmt='{prefix}{series}-touch_ro-{type}-smoke-{testname}',
37+ restrict_to=None):
38+ return Test(name, fmt, restrict_to)
39+
40+
41+DEVICES = ['mako-05', 'maguro-02']
42+
43+TESTS = [
44+ _test('install-and-boot'),
45+ _test('default'),
46+ _test('mediaplayer-app-autopilot'),
47+ _test('gallery-app-autopilot'),
48+ _test('webbrowser-app-autopilot'),
49+ _test('unity8-autopilot'),
50+ _test('friends-app-autopilot'),
51+ _test('notes-app-autopilot'),
52+ _test('camera-app-autopilot'),
53+ _test('dialer-app-autopilot'),
54+ _test('messaging-app-autopilot'),
55+ _test('address-book-app-autopilot'),
56+ _test('share-app-autopilot'),
57+ _test('calendar-app-autopilot'),
58+ _test('music-app-autopilot'),
59+ _test('ubuntu-calculator-app-autopilot'),
60+ _test('ubuntu-clock-app-autopilot'),
61+ _test('ubuntu-filemanager-app-autopilot'),
62+ _test('ubuntu-rssreader-app-autopilot'),
63+ _test('ubuntu-terminal-app-autopilot'),
64+ _test('ubuntu-weather-app-autopilot'),
65+ _test('ubuntu-ui-toolkit-autopilot'),
66+ _test('click_image_tests'),
67+ _test('dropping-letters-app-autopilot'),
68+ _test('sdk'),
69+ _test('security'),
70+ _test('eventstat',
71+ '{prefix}{testname}-{series}-touch-armhf-install-idle-{type}'),
72+ _test('smem',
73+ '{prefix}{testname}-{series}-touch_ro-armhf-install-idle-{type}'),
74+ _test('memevent',
75+ '{prefix}{testname}-{series}-touch_ro-armhf-default-{type}'),
76+]
77+
78+
79+def _get_parser():
80+ """Create and return command line parser.
81+
82+ :returns: command line parser
83+ :rtype: argparse.ArgumentParser
84+
85+ """
86+ parser = argparse.ArgumentParser(
87+ description='Create/Update upgrade testing jenkins jobs.')
88+ parser.add_argument("-d", "--dryrun", action="store_true",
89+ help="Dry run mode. Don't execute jenkins commands.")
90+ parser.add_argument("-u", "--username",
91+ help="username to use when logging into Jenkins.")
92+ parser.add_argument("-p", "--password",
93+ help="username to use when logging into Jenkins")
94+ parser.add_argument("-b", "--branch", default="lp:ubuntu-test-cases/touch",
95+ help="The branch this is located. default=%(default)s")
96+ parser.add_argument("-P", "--publish", action="store_true",
97+ help="Publish at the end of the job")
98+ parser.add_argument("--prefix",
99+ help="Prefix to add to the beginning of the job name")
100+ parser.add_argument("-j", "--jenkins", default="http://10.98.0.1:8080/",
101+ help="URL of jenkins instance to configure jobs in.")
102+ parser.add_argument("-n", "--name", action='append',
103+ help=("Device names where the job should be executed."
104+ " Can be used more than once."))
105+ parser.add_argument("--host", default='phoenix',
106+ help=("Host name where the jobs should be executed."))
107+ parser.add_argument("-s", "--series", default=DEV_SERIES,
108+ help=("series of Ubuntu to download "
109+ "(default=%(default)s)"))
110+ parser.add_argument("-w", "--wait", type=int, default=300,
111+ help=("How long to wait after jenkins triggers the"
112+ "install-and-boot job (default=%(default)d)"))
113+ return parser
114+
115+
116+def _get_jenkins(url, username, password):
117+ logging.info('Attempting to login to jenkins at %s', url)
118+ if username is not None:
119+ logging.info('...with authentication as user: %s', username)
120+ instance = jenkins.Jenkins(url, username=username, password=password)
121+ else:
122+ logging.info('...without authentication')
123+ instance = jenkins.Jenkins(url)
124+
125+ return instance
126+
127+
128+def _get_environment():
129+ base = os.path.join(os.path.dirname(__file__), 'templates')
130+ return jinja2.Environment(
131+ loader=jinja2.FileSystemLoader(base),
132+ undefined=jinja2.StrictUndefined,
133+ trim_blocks=True)
134+
135+
136+def _get_job_name(args, device, test):
137+ prefix = ""
138+ if(args.prefix):
139+ prefix = args.prefix + "-"
140+ return test.fmt.format(prefix=prefix,
141+ series=args.series,
142+ testname=test.name,
143+ type=device[:device.index("-")])
144+
145+
146+def _publish(instance, env, args, template, jobname, **params):
147+ tmpl = env.get_template(template)
148+ cfg = tmpl.render(**params)
149+ if args.dryrun:
150+ _dryrun_func(jobname, cfg)
151+ return
152+ if instance.job_exists(jobname):
153+ logging.info('reconfiguring job %s', jobname)
154+ instance.reconfig_job(jobname, cfg)
155+ else:
156+ logging.info('creating job %s', jobname)
157+ instance.create_job(jobname, cfg)
158+
159+
160+def _configure_job(instance, env, args, device, test):
161+ tmpl_name = 'touch-{}.xml.jinja2'.format(test.name)
162+ params = {
163+ 'host': args.host,
164+ 'name': device,
165+ 'publish': args.publish,
166+ 'branch': args.branch,
167+ 'wait': args.wait,
168+ }
169+ jobname = _get_job_name(args, device, test)
170+ _publish(instance, env, args, tmpl_name, jobname, **params)
171+
172+
173+def _configure_master(instance, env, args, device, projects):
174+ device_type = device[:device.index("-")]
175+ fmt = 'http://system-image.ubuntu.com/devel-proposed/{}/index.json'
176+ trigger_url = fmt.format(device_type)
177+
178+ params = {
179+ 'host': args.host,
180+ 'name': device,
181+ 'publish': args.publish,
182+ 'branch': args.branch,
183+ 'projects': projects,
184+ 'trigger_url': trigger_url
185+ }
186+ jobname = _get_job_name(args, device, _test('master'))
187+ _publish(instance, env, args, 'touch-master.xml.jinja2', jobname, **params)
188+
189+
190+def _dryrun_func(jobname, config):
191+ logging.debug(jobname)
192+ logging.debug(config)
193+
194+
195+def main():
196+ logging.basicConfig(level=logging.DEBUG)
197+ args = _get_parser().parse_args()
198+
199+ jenkins_inst = _get_jenkins(args.jenkins, args.username, args.password)
200+ if args.dryrun:
201+ jenkins_inst.create_job = _dryrun_func
202+ jenkins_inst.reconfig_job = _dryrun_func
203+
204+ env = _get_environment()
205+
206+ device_list = args.name if args.name else DEVICES
207+
208+ for device in device_list:
209+ projects = []
210+ for test in TESTS:
211+ logging.debug("configuring job for %s", test.name)
212+ if not test.restrict_to or device in test.restrict_to:
213+ _configure_job(jenkins_inst, env, args, device, test)
214+ projects.append(_get_job_name(args, device, test))
215+ else:
216+ logging.info('%s not configured for %s', device, test.name)
217+
218+ _configure_master(jenkins_inst, env, args, device, projects)
219+
220+if __name__ == '__main__':
221+ main()
222
223=== added directory 'jenkins/templates'
224=== added file 'jenkins/templates/touch-address-book-app-autopilot.xml.jinja2'
225--- jenkins/templates/touch-address-book-app-autopilot.xml.jinja2 1970-01-01 00:00:00 +0000
226+++ jenkins/templates/touch-address-book-app-autopilot.xml.jinja2 2013-10-03 23:14:25 +0000
227@@ -0,0 +1,6 @@
228+{% extends "touch-autopilot-base.xml.jinja2" %}
229+<?xml version='1.0' encoding='UTF-8'?>
230+
231+{% block apptest %}
232+export APP=&quot;address-book-app-autopilot&quot;
233+{% endblock %}
234
235=== added file 'jenkins/templates/touch-autopilot-base.xml.jinja2'
236--- jenkins/templates/touch-autopilot-base.xml.jinja2 1970-01-01 00:00:00 +0000
237+++ jenkins/templates/touch-autopilot-base.xml.jinja2 2013-10-03 23:14:25 +0000
238@@ -0,0 +1,23 @@
239+{% extends "touch-base.xml.jinja2" %}
240+<?xml version='1.0' encoding='UTF-8'?>
241+{% block triggers %}
242+ <triggers class="vector"/>
243+{% endblock %}
244+{% block timeout %}
245+ <timeoutMinutes>30</timeoutMinutes>
246+{% endblock timeout %}
247+
248+{% block shellcmds %}
249+ <command>set -e
250+rm -rf *
251+{% include "touch-setup.xml.jinja2" %}
252+
253+{% block apptest %}{% endblock %}
254+
255+${BZRDIR}/scripts/jenkins.sh -s $ANDROID_SERIAL -a $APP
256+ </command>
257+{% endblock %}
258+
259+{% block artifacts %}
260+ <artifacts>clientlogs/*, **/jenkins.sh</artifacts>
261+{% endblock %}
262
263=== added file 'jenkins/templates/touch-base.xml.jinja2'
264--- jenkins/templates/touch-base.xml.jinja2 1970-01-01 00:00:00 +0000
265+++ jenkins/templates/touch-base.xml.jinja2 2013-10-03 23:14:25 +0000
266@@ -0,0 +1,98 @@
267+<?xml version='1.0' encoding='UTF-8'?>
268+<project>
269+ <actions/>
270+ <description>
271+&lt;pre&gt;
272+#NOTE: Automatically created from a script as part of daily smoke testing&#xd;
273+ {{branch}}&#xd;
274+&lt;/pre&gt;
275+ </description>
276+ <keepDependencies>false</keepDependencies>
277+ <properties>
278+ <hudson.plugins.throttleconcurrents.ThrottleJobProperty>
279+ <maxConcurrentPerNode>0</maxConcurrentPerNode>
280+ <maxConcurrentTotal>0</maxConcurrentTotal>
281+ <throttleEnabled>false</throttleEnabled>
282+ <throttleOption>project</throttleOption>
283+ </hudson.plugins.throttleconcurrents.ThrottleJobProperty>
284+ <hudson.plugins.build__publisher.ExternalProjectProperty/>
285+ </properties>
286+ <scm class="hudson.scm.NullSCM"/>
287+ <assignedNode>{{ host }}</assignedNode>
288+ <canRoam>false</canRoam>
289+ <disabled>false</disabled>
290+ <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
291+ <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
292+{% block triggers %}{% endblock %}
293+ <concurrentBuild>false</concurrentBuild>
294+ <builders>
295+{% block shellblock %}
296+ <hudson.tasks.Shell>
297+{% block shellcmds %}{% endblock %}
298+ </hudson.tasks.Shell>
299+{% endblock %}
300+{% block extrasteps %}{% endblock %}
301+ </builders>
302+ <publishers>
303+{% block artifactblock %}
304+ <hudson.tasks.ArtifactArchiver>
305+{% block artifacts %}{% endblock %}
306+ <latestOnly>false</latestOnly>
307+ </hudson.tasks.ArtifactArchiver>
308+{% endblock %}
309+{% block descriptionsetter %}
310+ <hudson.plugins.descriptionsetter.DescriptionSetterPublisher>
311+ <regexp>^= TOUCH IMAGE VERSION:([0-9]+.*)</regexp>
312+ <regexpForFailed>^= TOUCH IMAGE VERSION:([0-9]+.*)</regexpForFailed>
313+ <setForMatrix>false</setForMatrix>
314+ </hudson.plugins.descriptionsetter.DescriptionSetterPublisher>
315+{% endblock %}
316+{% block mailer %}
317+ <hudson.tasks.Mailer>
318+ <recipients>paul.larson@canonical.com para.siva@canonical.com</recipients>
319+ <dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild>
320+ <sendToIndividuals>false</sendToIndividuals>
321+ </hudson.tasks.Mailer>
322+{% endblock %}
323+{% if publish %}
324+{% block buildpublisher %}
325+ <hudson.plugins.build__publisher.BuildPublisher>
326+ <publishUnstableBuilds>true</publishUnstableBuilds>
327+ <publishFailedBuilds>true</publishFailedBuilds>
328+ <postActions class="vector"/>
329+ </hudson.plugins.build__publisher.BuildPublisher>
330+{% endblock %}
331+{% endif %}
332+{% block buildtrigger %}{% endblock %}
333+{% block naginator %}
334+ <com.chikli.hudson.plugin.naginator.NaginatorPublisher>
335+ <regexpForRerun>Network connection failed to become active</regexpForRerun>
336+ <rerunIfUnstable>true</rerunIfUnstable>
337+ <checkRegexp>true</checkRegexp>
338+ <delay class="com.chikli.hudson.plugin.naginator.FixedDelay">
339+ <delay>5</delay>
340+ </delay>
341+ <maxSchedule>5</maxSchedule>
342+ </com.chikli.hudson.plugin.naginator.NaginatorPublisher>
343+{% endblock %}
344+ </publishers>
345+ <buildWrappers>
346+ <hudson.plugins.build__timeout.BuildTimeoutWrapper>
347+ {% block timeout %}{% endblock %}
348+ <failBuild>true</failBuild>
349+ <writingDescription>false</writingDescription>
350+ <timeoutPercentage>0</timeoutPercentage>
351+ <timeoutType>absolute</timeoutType>
352+ <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
353+ </hudson.plugins.build__timeout.BuildTimeoutWrapper>
354+{% block locks %}
355+ <hudson.plugins.locksandlatches.LockWrapper>
356+ <locks>
357+ <hudson.plugins.locksandlatches.LockWrapper_-LockWaitConfig>
358+ <name>{{name}}</name>
359+ </hudson.plugins.locksandlatches.LockWrapper_-LockWaitConfig>
360+ </locks>
361+ </hudson.plugins.locksandlatches.LockWrapper>
362+{% endblock %}
363+ </buildWrappers>
364+</project>
365
366=== added file 'jenkins/templates/touch-calendar-app-autopilot.xml.jinja2'
367--- jenkins/templates/touch-calendar-app-autopilot.xml.jinja2 1970-01-01 00:00:00 +0000
368+++ jenkins/templates/touch-calendar-app-autopilot.xml.jinja2 2013-10-03 23:14:25 +0000
369@@ -0,0 +1,6 @@
370+{% extends "touch-autopilot-base.xml.jinja2" %}
371+<?xml version='1.0' encoding='UTF-8'?>
372+
373+{% block apptest %}
374+export APP=&quot;calendar-app-autopilot&quot;
375+{% endblock %}
376
377=== added file 'jenkins/templates/touch-camera-app-autopilot.xml.jinja2'
378--- jenkins/templates/touch-camera-app-autopilot.xml.jinja2 1970-01-01 00:00:00 +0000
379+++ jenkins/templates/touch-camera-app-autopilot.xml.jinja2 2013-10-03 23:14:25 +0000
380@@ -0,0 +1,6 @@
381+{% extends "touch-autopilot-base.xml.jinja2" %}
382+<?xml version='1.0' encoding='UTF-8'?>
383+
384+{% block apptest %}
385+export APP=&quot;camera-app-autopilot&quot;
386+{% endblock %}
387
388=== added file 'jenkins/templates/touch-click_image_tests.xml.jinja2'
389--- jenkins/templates/touch-click_image_tests.xml.jinja2 1970-01-01 00:00:00 +0000
390+++ jenkins/templates/touch-click_image_tests.xml.jinja2 2013-10-03 23:14:25 +0000
391@@ -0,0 +1,6 @@
392+{% extends "touch-autopilot-base.xml.jinja2" %}
393+<?xml version='1.0' encoding='UTF-8'?>
394+
395+{% block apptest %}
396+export APP=&quot;click_image_tests&quot;
397+{% endblock %}
398
399=== added file 'jenkins/templates/touch-default.xml.jinja2'
400--- jenkins/templates/touch-default.xml.jinja2 1970-01-01 00:00:00 +0000
401+++ jenkins/templates/touch-default.xml.jinja2 2013-10-03 23:14:25 +0000
402@@ -0,0 +1,6 @@
403+{% extends "touch-autopilot-base.xml.jinja2" %}
404+<?xml version='1.0' encoding='UTF-8'?>
405+
406+{% block apptest %}
407+export APP=&quot;default&quot;
408+{% endblock %}
409
410=== added file 'jenkins/templates/touch-dialer-app-autopilot.xml.jinja2'
411--- jenkins/templates/touch-dialer-app-autopilot.xml.jinja2 1970-01-01 00:00:00 +0000
412+++ jenkins/templates/touch-dialer-app-autopilot.xml.jinja2 2013-10-03 23:14:25 +0000
413@@ -0,0 +1,6 @@
414+{% extends "touch-autopilot-base.xml.jinja2" %}
415+<?xml version='1.0' encoding='UTF-8'?>
416+
417+{% block apptest %}
418+export APP=&quot;dialer-app-autopilot&quot;
419+{% endblock %}
420
421=== added file 'jenkins/templates/touch-dropping-letters-app-autopilot.xml.jinja2'
422--- jenkins/templates/touch-dropping-letters-app-autopilot.xml.jinja2 1970-01-01 00:00:00 +0000
423+++ jenkins/templates/touch-dropping-letters-app-autopilot.xml.jinja2 2013-10-03 23:14:25 +0000
424@@ -0,0 +1,6 @@
425+{% extends "touch-autopilot-base.xml.jinja2" %}
426+<?xml version='1.0' encoding='UTF-8'?>
427+
428+{% block apptest %}
429+export APP=&quot;dropping-letters-app-autopilot&quot;
430+{% endblock %}
431
432=== added file 'jenkins/templates/touch-eventstat.xml.jinja2'
433--- jenkins/templates/touch-eventstat.xml.jinja2 1970-01-01 00:00:00 +0000
434+++ jenkins/templates/touch-eventstat.xml.jinja2 2013-10-03 23:14:25 +0000
435@@ -0,0 +1,20 @@
436+{% extends "touch-base.xml.jinja2" %}
437+
438+{% block timeout %}
439+ <timeoutMinutes>45</timeoutMinutes>
440+{% endblock timeout %}
441+
442+{% block shellcmds %}
443+ <command>set -e
444+rm -rf *
445+{% include "touch-setup.xml.jinja2" %}
446+
447+export APP=eventstat
448+
449+${BZRDIR}/scripts/jenkins.sh -s $ANDROID_SERIAL -a $APP -p /tmp/results
450+ </command>
451+{% endblock %}
452+
453+{% block artifacts %}
454+ <artifacts>clientlogs/*, **/jenkins.sh</artifacts>
455+{% endblock %}
456
457=== added file 'jenkins/templates/touch-friends-app-autopilot.xml.jinja2'
458--- jenkins/templates/touch-friends-app-autopilot.xml.jinja2 1970-01-01 00:00:00 +0000
459+++ jenkins/templates/touch-friends-app-autopilot.xml.jinja2 2013-10-03 23:14:25 +0000
460@@ -0,0 +1,6 @@
461+{% extends "touch-autopilot-base.xml.jinja2" %}
462+<?xml version='1.0' encoding='UTF-8'?>
463+
464+{% block apptest %}
465+export APP=&quot;friends-app-autopilot&quot;
466+{% endblock %}
467
468=== added file 'jenkins/templates/touch-gallery-app-autopilot.xml.jinja2'
469--- jenkins/templates/touch-gallery-app-autopilot.xml.jinja2 1970-01-01 00:00:00 +0000
470+++ jenkins/templates/touch-gallery-app-autopilot.xml.jinja2 2013-10-03 23:14:25 +0000
471@@ -0,0 +1,6 @@
472+{% extends "touch-autopilot-base.xml.jinja2" %}
473+<?xml version='1.0' encoding='UTF-8'?>
474+
475+{% block apptest %}
476+export APP=&quot;gallery-app-autopilot&quot;
477+{% endblock %}
478
479=== added file 'jenkins/templates/touch-install-and-boot.xml.jinja2'
480--- jenkins/templates/touch-install-and-boot.xml.jinja2 1970-01-01 00:00:00 +0000
481+++ jenkins/templates/touch-install-and-boot.xml.jinja2 2013-10-03 23:14:25 +0000
482@@ -0,0 +1,28 @@
483+{% extends "touch-base.xml.jinja2" %}
484+<?xml version='1.0' encoding='UTF-8'?>
485+{% block triggers %}
486+ <triggers class="vector"/>
487+{% endblock %}
488+{% block timeout %}
489+ <timeoutMinutes>30</timeoutMinutes>
490+{% endblock timeout %}
491+
492+{% block shellcmds %}
493+ <command>set -e
494+apt-cache policy phablet-tools
495+rm -rf *
496+mkdir clientlogs
497+
498+{% include "touch-setup.xml.jinja2" %}
499+
500+#Wait for images to actually show up on cdimage
501+sleep {{wait}}
502+${BZRDIR}/scripts/provision.sh -s $ANDROID_SERIAL
503+
504+${BZRDIR}/scripts/jenkins.sh -s $ANDROID_SERIAL -a install-and-boot
505+ </command>
506+{% endblock %}
507+
508+{% block artifacts %}
509+ <artifacts>clientlogs/*</artifacts>
510+{% endblock %}
511
512=== added file 'jenkins/templates/touch-master.xml.jinja2'
513--- jenkins/templates/touch-master.xml.jinja2 1970-01-01 00:00:00 +0000
514+++ jenkins/templates/touch-master.xml.jinja2 2013-10-03 23:14:25 +0000
515@@ -0,0 +1,54 @@
516+{% extends "touch-base.xml.jinja2" %}
517+{% block triggers %}
518+ <triggers class="vector">
519+ <com.redfin.hudson.UrlChangeTrigger>
520+ <spec></spec>
521+ <url>{{trigger_url}}</url>
522+ </com.redfin.hudson.UrlChangeTrigger>
523+ </triggers>
524+{% endblock %}
525+{% block shellblock %}{% endblock %}
526+{% block extrasteps %}
527+{% for project in projects %}
528+ <hudson.plugins.parameterizedtrigger.TriggerBuilder>
529+ <configs>
530+ <hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig>
531+ <configs class="java.util.Collections$EmptyList"/>
532+ <projects>{{project}}</projects>
533+ <condition>ALWAYS</condition>
534+ <triggerWithNoParameters>false</triggerWithNoParameters>
535+ <block>
536+{% if "install-and-boot" in project %}
537+ <buildStepFailureThreshold>
538+ <name>FAILURE</name>
539+ <ordinal>2</ordinal>
540+ <color>RED</color>
541+ </buildStepFailureThreshold>
542+{% endif %}
543+ <unstableThreshold>
544+ <name>UNSTABLE</name>
545+ <ordinal>1</ordinal>
546+ <color>YELLOW</color>
547+ </unstableThreshold>
548+{% if "install-and-boot" in project or "default" in project %}
549+ <failureThreshold>
550+ <name>FAILURE</name>
551+ <ordinal>2</ordinal>
552+ <color>RED</color>
553+ </failureThreshold>
554+{% endif %}
555+ </block>
556+ <buildAllNodesWithLabel>false</buildAllNodesWithLabel>
557+ </hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig>
558+ </configs>
559+ </hudson.plugins.parameterizedtrigger.TriggerBuilder>
560+{% endfor %}
561+{% endblock %}
562+{% block timeout %}
563+ <timeoutMinutes>300</timeoutMinutes>
564+{% endblock timeout %}
565+{% block artifactblock %}{% endblock %}
566+{% block descriptionsetter %}{% endblock %}
567+{% block buildpublisher %}{% endblock %}
568+{% block mailer %}{% endblock %}
569+{% block locks %}{% endblock %}
570
571=== added file 'jenkins/templates/touch-mediaplayer-app-autopilot.xml.jinja2'
572--- jenkins/templates/touch-mediaplayer-app-autopilot.xml.jinja2 1970-01-01 00:00:00 +0000
573+++ jenkins/templates/touch-mediaplayer-app-autopilot.xml.jinja2 2013-10-03 23:14:25 +0000
574@@ -0,0 +1,6 @@
575+{% extends "touch-autopilot-base.xml.jinja2" %}
576+<?xml version='1.0' encoding='UTF-8'?>
577+
578+{% block apptest %}
579+export APP=&quot;mediaplayer-app-autopilot&quot;
580+{% endblock %}
581
582=== added file 'jenkins/templates/touch-memevent.xml.jinja2'
583--- jenkins/templates/touch-memevent.xml.jinja2 1970-01-01 00:00:00 +0000
584+++ jenkins/templates/touch-memevent.xml.jinja2 2013-10-03 23:14:25 +0000
585@@ -0,0 +1,9 @@
586+{% extends "touch-autopilot-base.xml.jinja2" %}
587+<?xml version='1.0' encoding='UTF-8'?>
588+{% block timeout %}
589+ <timeoutMinutes>30</timeoutMinutes>
590+{% endblock timeout %}
591+
592+{% block apptest %}
593+export APP=&quot;memevent&quot;
594+{% endblock %}
595
596=== added file 'jenkins/templates/touch-messaging-app-autopilot.xml.jinja2'
597--- jenkins/templates/touch-messaging-app-autopilot.xml.jinja2 1970-01-01 00:00:00 +0000
598+++ jenkins/templates/touch-messaging-app-autopilot.xml.jinja2 2013-10-03 23:14:25 +0000
599@@ -0,0 +1,6 @@
600+{% extends "touch-autopilot-base.xml.jinja2" %}
601+<?xml version='1.0' encoding='UTF-8'?>
602+
603+{% block apptest %}
604+export APP=&quot;messaging-app-autopilot&quot;
605+{% endblock %}
606
607=== added file 'jenkins/templates/touch-music-app-autopilot.xml.jinja2'
608--- jenkins/templates/touch-music-app-autopilot.xml.jinja2 1970-01-01 00:00:00 +0000
609+++ jenkins/templates/touch-music-app-autopilot.xml.jinja2 2013-10-03 23:14:25 +0000
610@@ -0,0 +1,6 @@
611+{% extends "touch-autopilot-base.xml.jinja2" %}
612+<?xml version='1.0' encoding='UTF-8'?>
613+
614+{% block apptest %}
615+export APP=&quot;music-app-autopilot&quot;
616+{% endblock %}
617
618=== added file 'jenkins/templates/touch-notes-app-autopilot.xml.jinja2'
619--- jenkins/templates/touch-notes-app-autopilot.xml.jinja2 1970-01-01 00:00:00 +0000
620+++ jenkins/templates/touch-notes-app-autopilot.xml.jinja2 2013-10-03 23:14:25 +0000
621@@ -0,0 +1,6 @@
622+{% extends "touch-autopilot-base.xml.jinja2" %}
623+<?xml version='1.0' encoding='UTF-8'?>
624+
625+{% block apptest %}
626+export APP=&quot;notes-app-autopilot&quot;
627+{% endblock %}
628
629=== added file 'jenkins/templates/touch-sdk.xml.jinja2'
630--- jenkins/templates/touch-sdk.xml.jinja2 1970-01-01 00:00:00 +0000
631+++ jenkins/templates/touch-sdk.xml.jinja2 2013-10-03 23:14:25 +0000
632@@ -0,0 +1,7 @@
633+{% extends "touch-autopilot-base.xml.jinja2" %}
634+<?xml version='1.0' encoding='UTF-8'?>
635+
636+{% block apptest %}
637+export APP=&quot;sdk&quot;
638+{% endblock %}
639+
640
641=== added file 'jenkins/templates/touch-security.xml.jinja2'
642--- jenkins/templates/touch-security.xml.jinja2 1970-01-01 00:00:00 +0000
643+++ jenkins/templates/touch-security.xml.jinja2 2013-10-03 23:14:25 +0000
644@@ -0,0 +1,7 @@
645+{% extends "touch-autopilot-base.xml.jinja2" %}
646+<?xml version='1.0' encoding='UTF-8'?>
647+
648+{% block apptest %}
649+export APP=&quot;security&quot;
650+{% endblock %}
651+
652
653=== added file 'jenkins/templates/touch-setup.xml.jinja2'
654--- jenkins/templates/touch-setup.xml.jinja2 1970-01-01 00:00:00 +0000
655+++ jenkins/templates/touch-setup.xml.jinja2 2013-10-03 23:14:25 +0000
656@@ -0,0 +1,6 @@
657+BRANCH=&quot;{{branch}}&quot;
658+BZRDIR=`echo &quot;$BRANCH&quot; | awk -F/ &apos;{ print $(NF) }&apos;`
659+BZRDIR=$(readlink -f $BZRDIR)
660+bzr branch ${BRANCH} ${BZRDIR}
661+
662+export ANDROID_SERIAL=$(${BZRDIR}/scripts/get-adb-id {{name}})
663
664=== added file 'jenkins/templates/touch-share-app-autopilot.xml.jinja2'
665--- jenkins/templates/touch-share-app-autopilot.xml.jinja2 1970-01-01 00:00:00 +0000
666+++ jenkins/templates/touch-share-app-autopilot.xml.jinja2 2013-10-03 23:14:25 +0000
667@@ -0,0 +1,6 @@
668+{% extends "touch-autopilot-base.xml.jinja2" %}
669+<?xml version='1.0' encoding='UTF-8'?>
670+
671+{% block apptest %}
672+export APP=&quot;share-app-autopilot&quot;
673+{% endblock %}
674
675=== added file 'jenkins/templates/touch-smem.xml.jinja2'
676--- jenkins/templates/touch-smem.xml.jinja2 1970-01-01 00:00:00 +0000
677+++ jenkins/templates/touch-smem.xml.jinja2 2013-10-03 23:14:25 +0000
678@@ -0,0 +1,20 @@
679+{% extends "touch-base.xml.jinja2" %}
680+
681+{% block triggers %}
682+ <triggers class="vector"/>
683+{% endblock %}
684+{% block timeout %}
685+ <timeoutMinutes>60</timeoutMinutes>
686+{% endblock timeout %}
687+
688+{% block shellcmds %}
689+ <command>rm -rf *
690+{% include "touch-setup.xml.jinja2" %}
691+
692+${BZRDIR}/scripts/run-touch-utah-runlist.sh -s $ANDROID_SERIAL -p /tmp/results -r lp:~ubuntu-test-case-dev/ubuntu-test-cases/qa-baseline-testing/runlists/smem.run
693+</command>
694+{% endblock %}
695+
696+{% block artifacts %}
697+ <artifacts>clientlogs/*,results/**/*</artifacts>
698+{% endblock %}
699
700=== added file 'jenkins/templates/touch-ubuntu-calculator-app-autopilot.xml.jinja2'
701--- jenkins/templates/touch-ubuntu-calculator-app-autopilot.xml.jinja2 1970-01-01 00:00:00 +0000
702+++ jenkins/templates/touch-ubuntu-calculator-app-autopilot.xml.jinja2 2013-10-03 23:14:25 +0000
703@@ -0,0 +1,6 @@
704+{% extends "touch-autopilot-base.xml.jinja2" %}
705+<?xml version='1.0' encoding='UTF-8'?>
706+
707+{% block apptest %}
708+export APP=&quot;ubuntu-calculator-app-autopilot&quot;
709+{% endblock %}
710
711=== added file 'jenkins/templates/touch-ubuntu-clock-app-autopilot.xml.jinja2'
712--- jenkins/templates/touch-ubuntu-clock-app-autopilot.xml.jinja2 1970-01-01 00:00:00 +0000
713+++ jenkins/templates/touch-ubuntu-clock-app-autopilot.xml.jinja2 2013-10-03 23:14:25 +0000
714@@ -0,0 +1,6 @@
715+{% extends "touch-autopilot-base.xml.jinja2" %}
716+<?xml version='1.0' encoding='UTF-8'?>
717+
718+{% block apptest %}
719+export APP=&quot;ubuntu-clock-app-autopilot&quot;
720+{% endblock %}
721
722=== added file 'jenkins/templates/touch-ubuntu-clock-autopilot.xml.jinja2'
723--- jenkins/templates/touch-ubuntu-clock-autopilot.xml.jinja2 1970-01-01 00:00:00 +0000
724+++ jenkins/templates/touch-ubuntu-clock-autopilot.xml.jinja2 2013-10-03 23:14:25 +0000
725@@ -0,0 +1,6 @@
726+{% extends "touch-autopilot-base.xml.jinja2" %}
727+<?xml version='1.0' encoding='UTF-8'?>
728+
729+{% block apptest %}
730+export APP=&quot;ubuntu-clock-autopilot&quot;
731+{% endblock %}
732
733=== added file 'jenkins/templates/touch-ubuntu-docviewer-app-autopilot.xml.jinja2'
734--- jenkins/templates/touch-ubuntu-docviewer-app-autopilot.xml.jinja2 1970-01-01 00:00:00 +0000
735+++ jenkins/templates/touch-ubuntu-docviewer-app-autopilot.xml.jinja2 2013-10-03 23:14:25 +0000
736@@ -0,0 +1,6 @@
737+{% extends "touch-autopilot-base.xml.jinja2" %}
738+<?xml version='1.0' encoding='UTF-8'?>
739+
740+{% block apptest %}
741+export APP=&quot;ubuntu-docviewer-app-autopilot&quot;
742+{% endblock %}
743
744=== added file 'jenkins/templates/touch-ubuntu-filemanager-app-autopilot.xml.jinja2'
745--- jenkins/templates/touch-ubuntu-filemanager-app-autopilot.xml.jinja2 1970-01-01 00:00:00 +0000
746+++ jenkins/templates/touch-ubuntu-filemanager-app-autopilot.xml.jinja2 2013-10-03 23:14:25 +0000
747@@ -0,0 +1,6 @@
748+{% extends "touch-autopilot-base.xml.jinja2" %}
749+<?xml version='1.0' encoding='UTF-8'?>
750+
751+{% block apptest %}
752+export APP=&quot;ubuntu-filemanager-app-autopilot&quot;
753+{% endblock %}
754
755=== added file 'jenkins/templates/touch-ubuntu-rssreader-app-autopilot.xml.jinja2'
756--- jenkins/templates/touch-ubuntu-rssreader-app-autopilot.xml.jinja2 1970-01-01 00:00:00 +0000
757+++ jenkins/templates/touch-ubuntu-rssreader-app-autopilot.xml.jinja2 2013-10-03 23:14:25 +0000
758@@ -0,0 +1,6 @@
759+{% extends "touch-autopilot-base.xml.jinja2" %}
760+<?xml version='1.0' encoding='UTF-8'?>
761+
762+{% block apptest %}
763+export APP=&quot;ubuntu-rssreader-app-autopilot&quot;
764+{% endblock %}
765
766=== added file 'jenkins/templates/touch-ubuntu-terminal-app-autopilot.xml.jinja2'
767--- jenkins/templates/touch-ubuntu-terminal-app-autopilot.xml.jinja2 1970-01-01 00:00:00 +0000
768+++ jenkins/templates/touch-ubuntu-terminal-app-autopilot.xml.jinja2 2013-10-03 23:14:25 +0000
769@@ -0,0 +1,6 @@
770+{% extends "touch-autopilot-base.xml.jinja2" %}
771+<?xml version='1.0' encoding='UTF-8'?>
772+
773+{% block apptest %}
774+export APP=&quot;ubuntu-terminal-app-autopilot&quot;
775+{% endblock %}
776
777=== added file 'jenkins/templates/touch-ubuntu-ui-toolkit-autopilot.xml.jinja2'
778--- jenkins/templates/touch-ubuntu-ui-toolkit-autopilot.xml.jinja2 1970-01-01 00:00:00 +0000
779+++ jenkins/templates/touch-ubuntu-ui-toolkit-autopilot.xml.jinja2 2013-10-03 23:14:25 +0000
780@@ -0,0 +1,6 @@
781+{% extends "touch-autopilot-base.xml.jinja2" %}
782+<?xml version='1.0' encoding='UTF-8'?>
783+
784+{% block apptest %}
785+export APP=&quot;ubuntu-ui-toolkit-autopilot&quot;
786+{% endblock %}
787
788=== added file 'jenkins/templates/touch-ubuntu-weather-app-autopilot.xml.jinja2'
789--- jenkins/templates/touch-ubuntu-weather-app-autopilot.xml.jinja2 1970-01-01 00:00:00 +0000
790+++ jenkins/templates/touch-ubuntu-weather-app-autopilot.xml.jinja2 2013-10-03 23:14:25 +0000
791@@ -0,0 +1,6 @@
792+{% extends "touch-autopilot-base.xml.jinja2" %}
793+<?xml version='1.0' encoding='UTF-8'?>
794+
795+{% block apptest %}
796+export APP=&quot;ubuntu-weather-app-autopilot&quot;
797+{% endblock %}
798
799=== added file 'jenkins/templates/touch-unity8-autopilot.xml.jinja2'
800--- jenkins/templates/touch-unity8-autopilot.xml.jinja2 1970-01-01 00:00:00 +0000
801+++ jenkins/templates/touch-unity8-autopilot.xml.jinja2 2013-10-03 23:14:25 +0000
802@@ -0,0 +1,6 @@
803+{% extends "touch-autopilot-base.xml.jinja2" %}
804+<?xml version='1.0' encoding='UTF-8'?>
805+
806+{% block apptest %}
807+export APP=&quot;unity8-autopilot&quot;
808+{% endblock %}
809
810=== added file 'jenkins/templates/touch-upgrade.xml.jinja2'
811--- jenkins/templates/touch-upgrade.xml.jinja2 1970-01-01 00:00:00 +0000
812+++ jenkins/templates/touch-upgrade.xml.jinja2 2013-10-03 23:14:25 +0000
813@@ -0,0 +1,28 @@
814+{% extends "touch-base.xml.jinja2" %}
815+<?xml version='1.0' encoding='UTF-8'?>
816+{% block triggers %}
817+ <triggers class="vector"/>
818+{% endblock %}
819+{% block timeout %}
820+ <timeoutMinutes>30</timeoutMinutes>
821+{% endblock timeout %}
822+
823+{% block shellcmds %}
824+ <command>rm -rf *
825+{% include "touch-setup.xml.jinja2" %}
826+
827+${BZRDIR}/scrips/run-touch-upgrade.sh
828+</command>
829+{% endblock %}
830+
831+{% block artifacts %}
832+ <artifacts>clientlogs/*, **/jenkins.sh</artifacts>
833+{% endblock %}
834+
835+{% block descriptionsetter %}
836+ <hudson.plugins.descriptionsetter.DescriptionSetterPublisher>
837+ <regexp>^UPGRADED TO VERSION: (.*)</regexp>
838+ <regexpForFailed>^UPGRADED TO VERSION: (.*)</regexpForFailed>
839+ <setForMatrix>false</setForMatrix>
840+ </hudson.plugins.descriptionsetter.DescriptionSetterPublisher>
841+{% endblock %}
842
843=== added file 'jenkins/templates/touch-webbrowser-app-autopilot.xml.jinja2'
844--- jenkins/templates/touch-webbrowser-app-autopilot.xml.jinja2 1970-01-01 00:00:00 +0000
845+++ jenkins/templates/touch-webbrowser-app-autopilot.xml.jinja2 2013-10-03 23:14:25 +0000
846@@ -0,0 +1,6 @@
847+{% extends "touch-autopilot-base.xml.jinja2" %}
848+<?xml version='1.0' encoding='UTF-8'?>
849+
850+{% block apptest %}
851+export APP=&quot;webbrowser-app-autopilot&quot;
852+{% endblock %}
853
854=== added directory 'scripts'
855=== renamed directory 'scripts' => 'scripts.moved'
856=== added file 'scripts/get-adb-id'
857--- scripts/get-adb-id 1970-01-01 00:00:00 +0000
858+++ scripts/get-adb-id 2013-10-03 23:14:25 +0000
859@@ -0,0 +1,33 @@
860+#!/usr/bin/python
861+
862+import sys
863+
864+DEVICES = {
865+"maguro-01":"0149BD7E0A019003",
866+"maguro-02":"0149BD7E0200E00F",
867+"maguro-04":"0149BDCC0500701B",
868+"maguro-05":"0149BD3418014013",
869+"mako-01":"01aa3d7a5dcba4a2",
870+"mako-02":"01ade38b552014d4",
871+"mako-05":"01b22f82dc5cec63",
872+"mako-06":"04ed70928fdc13ba",
873+"mako-07":"01e2f64788556934",
874+"grouper-02":"015d1884951c020e",
875+"grouper-03":"015d18ad5c27f80d",
876+"grouper-04":"015d188445242611",
877+"grouper-05":"015d21d9151c0019",
878+"manta-01":"R32D102RPZL",
879+"manta-02":"R32D102RPPK",
880+"manta-04":"R32D203DDZR",
881+"manta-05":"R32D203DMBY",
882+"mako-doanac": "00963b879612414a",
883+}
884+
885+name = sys.argv[1]
886+
887+try:
888+ print DEVICES[name]
889+except KeyError:
890+ print "Unknown device name: '%s'" % name
891+ sys.exit(-1)
892+
893
894=== added file 'scripts/jenkins.sh'
895--- scripts/jenkins.sh 1970-01-01 00:00:00 +0000
896+++ scripts/jenkins.sh 2013-10-03 23:14:25 +0000
897@@ -0,0 +1,198 @@
898+#!/bin/bash
899+
900+## This is the script jenkins should run to execute various touch applications
901+
902+set -e
903+
904+BASEDIR=$(dirname $(readlink -f $0))/..
905+
906+RESDIR=`pwd`/clientlogs
907+UTAHFILE=${RESDIR}/utah.yaml
908+UTAH_PHABLET_CMD="${UTAH_PHABLET_CMD-/usr/share/utah/examples/run_utah_phablet.py}"
909+
910+
911+usage() {
912+ cat <<EOF
913+usage: $0 -a APP [-s ANDROID_SERIAL] [-p FILE -p FILE ...] [-T] [-Q]
914+
915+Provisions the given device with the latest build
916+
917+OPTIONS:
918+ -h Show this message
919+ -s Specify the serial of the device to install
920+ -a The application under the "tests" directory to test
921+ -p Extra file to pull from target (absolute path or relative to /home/phablet)
922+ -T Run the utah test from the target instead of the host
923+ -Q "Quick" don't do a reboot of the device before running the test
924+
925+EOF
926+}
927+
928+cleanup() {
929+ set +e
930+}
931+
932+test_from_target() {
933+ # push the runlist over to the test
934+ adb push ${BASEDIR}/tests ${TESTSUITE_TARGET_BASE} &> /dev/null
935+
936+ # provisioning puts scripts under /home/phablet/bin which is writeable
937+ # all types of images. that's not in the PATH and we are running tests
938+ # here in a way that requires a writeable system so:
939+ adb shell cp /home/phablet/bin/* /usr/local/bin/
940+
941+ ${UTAH_PHABLET_CMD} \
942+ --results-dir ${RESDIR} \
943+ --skip-install --skip-network --skip-utah \
944+ --pull /var/crash \
945+ --pull /home/phablet/.cache/upstart \
946+ $EXTRA_PULL \
947+ -l ${TESTSUITE_TARGET}/master.run
948+}
949+
950+test_from_host() {
951+ export PATH=${BASEDIR}/utils/host:${PATH}
952+
953+ # allow for certain commands to run from host/target
954+ # see unity8-autopilot/ts_control for example
955+ export TARGET_PREFIX=adb-shell
956+
957+ [ -z $ANDROID_SERIAL ] || ADBOPTS="-s $ANDROID_SERIAL"
958+
959+ sudo TARGET_PREFIX=$TARGET_PREFIX PATH="${PATH}" ${UTAH_PHABLET_CMD} \
960+ ${ADBOPTS} \
961+ --from-host \
962+ --results-dir ${RESDIR} \
963+ --skip-install --skip-network --skip-utah \
964+ --pull /var/crash \
965+ --pull /home/phablet/.cache/upstart \
966+ $EXTRA_PULL \
967+ -l ${TESTSUITE_HOST}/master.run
968+}
969+
970+assert_image() {
971+ [ -z $INSTALL_URL ] && return
972+ echo "Ensuring target has proper image..."
973+ REQUIRED_UUID=$(curl ${INSTALL_URL}/artifact/clientlogs/.ci-uuid)
974+ ACTUAL_UUID=$(adb shell "cat /home/phablet/.ci-uuid | tr -d '\r\n'")
975+ if [ "$REQUIRED_UUID" != "$ACTUAL_UUID" ] ; then
976+ echo "UUIDs $REQUIRED_UUID != $ACTUAL_UUID, reprovisioning device..."
977+ ARGS=$(curl ${INSTALL_URL}/artifact/clientlogs/.ci-utah-args | tr -d '\r\n')
978+ UUID=$REQUIRED_UUID IMAGE_OPT=$ARGS ${BASEDIR}/scripts/provision.sh
979+ else
980+ echo "UUIDS match"
981+ fi
982+}
983+
984+main() {
985+ rm -rf clientlogs
986+ mkdir clientlogs
987+
988+ assert_image
989+
990+ # print the build date so the jenkins job can use it as the
991+ # build description
992+ adb pull /var/log/installer/media-info ${RESDIR}
993+ BUILDID=$(adb shell cat /home/phablet/.ci-version)
994+ echo "= TOUCH IMAGE VERSION:$BUILDID"
995+
996+ adb shell "top -n1 -b" > ${RESDIR}/top.log
997+
998+ set -x
999+ adb shell 'rm -f /var/crash/*'
1000+ if [ -z $QUICK ] ; then
1001+ # get the phone in sane place
1002+ adb reboot
1003+ # sometimes reboot doesn't happen fast enough, so add a little
1004+ # delay to help ensure its actually rebooted and we didn't just
1005+ # connect back to the device before it rebooted
1006+ adb wait-for-device
1007+ sleep 5
1008+ adb wait-for-device
1009+ phablet-network --skip-setup -t 90s
1010+ else
1011+ echo "SKIPPING phone reboot..."
1012+ fi
1013+
1014+ ${BASEDIR}/utils/host/adb-shell "aa-clickhook -f --include=/usr/share/autopilot-touch/apparmor/click.rules"
1015+
1016+ if [ ! -z $FROM_TARGET ] ; then
1017+ echo "launching test on the target...."
1018+ test_from_target
1019+ else
1020+ echo "launching test from the host...."
1021+ test_from_host
1022+ fi
1023+ adb shell 'rm -f /var/crash/*'
1024+
1025+ if ! `grep "^errors: [!0]" < $UTAHFILE >/dev/null` ; then
1026+ echo "errors found"
1027+ EXITCODE=1
1028+ fi
1029+ if ! `grep "^failures: [!0]" < $UTAHFILE >/dev/null` ; then
1030+ echo "failures found"
1031+ EXITCODE=2
1032+ fi
1033+ echo "Results Summary"
1034+ echo "---------------"
1035+ egrep '^(errors|failures|passes|fetch_errors):' $UTAHFILE
1036+ exit $EXITCODE
1037+}
1038+
1039+while getopts p:s:a:TQh opt; do
1040+ case $opt in
1041+ h)
1042+ usage
1043+ exit 0
1044+ ;;
1045+ s)
1046+ export ANDROID_SERIAL=$OPTARG
1047+ ;;
1048+ a)
1049+ APP=$OPTARG
1050+ ;;
1051+ p)
1052+ EXTRA_PULL_FILE=$OPTARG
1053+
1054+ if [ ! -z $EXTRA_PULL_FILE ]; then
1055+ # relative paths are assumed to be relative to /home/phablet
1056+ E_P_START=`echo $EXTRA_PULL_FILE | cut -c1`
1057+
1058+ if [ $E_P_START = '/' ]; then
1059+ EXTRA_PULL="$EXTRA_PULL --pull $EXTRA_PULL_FILE"
1060+ else
1061+ EXTRA_PULL="$EXTRA_PULL --pull /home/phablet/$EXTRA_PULL_FILE"
1062+ fi
1063+ fi
1064+ ;;
1065+ Q)
1066+ QUICK=1
1067+ ;;
1068+ T)
1069+ FROM_TARGET=1
1070+ ;;
1071+ esac
1072+done
1073+
1074+if [ -z $ANDROID_SERIAL ] ; then
1075+ # ensure we only have one device attached
1076+ lines=$(adb devices | wc -l)
1077+ if [ $lines -gt 3 ] ; then
1078+ echo "ERROR: More than one device attached, please use -s option"
1079+ echo
1080+ usage
1081+ exit 1
1082+ fi
1083+fi
1084+if [ -z $APP ] ; then
1085+ echo "ERROR: No app specified"
1086+ usage
1087+ exit 1
1088+fi
1089+
1090+TESTSUITE_HOST=$(readlink -f ${BASEDIR}/tests/${APP})
1091+TESTSUITE_TARGET_BASE=/tmp/tests
1092+TESTSUITE_TARGET=${TESTSUITE_TARGET_BASE}/$(basename ${TESTSUITE_HOST})
1093+
1094+trap cleanup TERM INT EXIT
1095+main
1096
1097=== added file 'scripts/provision.sh'
1098--- scripts/provision.sh 1970-01-01 00:00:00 +0000
1099+++ scripts/provision.sh 2013-10-03 23:14:25 +0000
1100@@ -0,0 +1,94 @@
1101+#!/bin/bash
1102+
1103+## This is the script jenkins should run to provision a device in the lab
1104+
1105+set -e
1106+
1107+BASEDIR=$(dirname $(readlink -f $0))
1108+
1109+RESDIR=`pwd`/clientlogs
1110+
1111+UTAH_PHABLET_CMD="${UTAH_PHABLET_CMD-/usr/share/utah/examples/run_utah_phablet.py}"
1112+NETWORK_FILE="${NETWORK_FILE-/home/ubuntu/magners-wifi}"
1113+
1114+IMAGE_OPT="${IMAGE_OPT---ubuntu-bootstrap --skip-utah --developer-mode}"
1115+UUID="${UUID-$(uuidgen -r)}"
1116+
1117+usage() {
1118+cat <<EOF
1119+usage: $0 [-s ANDROID_SERIAL] [-n NETWORK_FILE] [-D]
1120+
1121+Provisions the given device with the latest build
1122+
1123+OPTIONS:
1124+ -h Show this message
1125+ -s Specify the serial of the device to install
1126+ -n Select network file
1127+ -D Use a "cdimage-touch" ie developer image rather than an ubuntu-system
1128+
1129+EOF
1130+}
1131+
1132+while getopts s:n:Dh opt; do
1133+ case $opt in
1134+ h)
1135+ usage
1136+ exit 0
1137+ ;;
1138+ n)
1139+ NETWORK_FILE=$OPTARG
1140+ ;;
1141+ s)
1142+ export ANDROID_SERIAL=$OPTARG
1143+ ;;
1144+ D)
1145+ IMAGE_OPT=""
1146+ ;;
1147+ esac
1148+done
1149+
1150+if [ -z $ANDROID_SERIAL ] ; then
1151+ # ensure we only have one device attached
1152+ lines=$(adb devices | wc -l)
1153+ if [ $lines -gt 3 ] ; then
1154+ echo "ERROR: More than one device attached, please use -s option"
1155+ echo
1156+ usage
1157+ exit 1
1158+ fi
1159+fi
1160+
1161+set -x
1162+rm -rf clientlogs
1163+mkdir clientlogs
1164+
1165+${UTAH_PHABLET_CMD} --results-dir ${RESDIR} --network-file=${NETWORK_FILE} ${IMAGE_OPT}
1166+
1167+# mark the version we installed in /home/phablet/.ci-version
1168+if [ -n "$IMAGE_OPT" ] ; then
1169+ DEVICE_TYPE=$(adb shell "getprop ro.cm.device" |tr -d '\r')
1170+ # adb shell messes up \n's with \r\n's so do the whole of the regex on the target
1171+ IMAGEVER=$(adb shell "system-image-cli -i | sed -n -e 's/version version: \([0-9]*\)/\1/p' -e 's/version ubuntu: \([0-9]*\)/\1/p' -e 's/version device: \([0-9]*\)/\1/p' | paste -s -d:")
1172+ CHAN=$(adb shell "system-image-cli -i | sed -n -e 's/channel: \(.*\)/\1/p' | paste -s -d:")
1173+ REV=$(echo $IMAGEVER | cut -d: -f1)
1174+ IMAGE_OPT="${IMAGE_OPT} --revision $REV"
1175+ IMAGE_OPT="${IMAGE_OPT} --channel $CHAN"
1176+else
1177+ IMAGEVER=$(adb shell "cat /var/log/installer/media-info |sed 's/.*(\([0-9\.]*\))/\1/'")
1178+fi
1179+adb shell "echo '${IMAGEVER}' > /home/phablet/.ci-version"
1180+echo $UUID > clientlogs/.ci-uuid
1181+adb push clientlogs/.ci-uuid /home/phablet/
1182+cat >clientlogs/.ci-utah-args <<EOF
1183+$IMAGE_OPT
1184+EOF
1185+adb push clientlogs/.ci-utah-args /home/phablet/.ci-utah-args
1186+
1187+# get our target-based utilities into our PATH
1188+adb push ${BASEDIR}/../utils/target /home/phablet/bin
1189+
1190+phablet-click-test-setup
1191+
1192+# ensure the "edges intro" is disabled so that it doesn't cause noise
1193+# in the system
1194+adb shell dbus-send --system --print-reply --dest=org.freedesktop.Accounts /org/freedesktop/Accounts/User32011 org.freedesktop.DBus.Properties.Set string:com.canonical.unity.AccountsService string:demo-edges variant:boolean:false
1195
1196=== added file 'scripts/run-touch-upgrade.sh'
1197--- scripts/run-touch-upgrade.sh 1970-01-01 00:00:00 +0000
1198+++ scripts/run-touch-upgrade.sh 2013-10-03 23:14:25 +0000
1199@@ -0,0 +1,46 @@
1200+#!/bin/bash
1201+
1202+## This is the script jenkins should run to test upgrading a system image
1203+## in the lab.
1204+## Intersting environment variables that must be set:
1205+## ANDROID_SERIAL - specify another android device
1206+## RUNLIST - the path the runlist
1207+## NETWORK_FILE - specify an alternative network file (passed to runlist)
1208+## UPGRADE_FROM - the revision to upgrade from, eg -1 (passed to runlist)
1209+
1210+set -eux
1211+
1212+BASEDIR=$(dirname $(readlink -f $0))
1213+
1214+RESDIR=`pwd`/clientlogs
1215+
1216+UTAH_PHABLET_CMD="${UTAH_PHABLET_CMD-/usr/share/utah/examples/run_utah_phablet.py}"
1217+RUNLIST=${RUNLIST-"`pwd`/smoke-touch-apps/upgrade/master.run"}
1218+ANDROID_SERIAL="${ANDROID_SERIAL-015d1884b20c1c0f}" #doanac's nexus7 at home
1219+NETWORK_FILE="${NETWORK_FILE-/home/ubuntu/magners-wifi}"
1220+
1221+rm -rf clientlogs
1222+mkdir clientlogs
1223+
1224+export ANDROID_SERIAL=$ANDROID_SERIAL
1225+
1226+set +e
1227+sudo NETWORK_FILE=$NETWORK_FILE \
1228+ $UTAH_PHABLET_CMD -s $ANDROID_SERIAL \
1229+ --from-host --skip-install --skip-utah --skip-network -l $RUNLIST \
1230+ --results-dir=$RESDIR
1231+EXITCODE=$?
1232+
1233+UTAHFILE=$RESDIR/utah.yaml
1234+if ! `grep "^errors: [!0]" < $UTAHFILE >/dev/null` ; then
1235+ echo "errors found"
1236+ EXITCODE=1
1237+fi
1238+if ! `grep "^failures: [!0]" < $UTAHFILE >/dev/null` ; then
1239+ echo "failures found"
1240+ EXITCODE=2
1241+fi
1242+echo "Results Summary"
1243+echo "---------------"
1244+egrep '^(errors|failures|passes|fetch_errors):' $UTAHFILE
1245+exit $EXITCODE
1246
1247=== added file 'scripts/run-touch-utah-runlist.sh'
1248--- scripts/run-touch-utah-runlist.sh 1970-01-01 00:00:00 +0000
1249+++ scripts/run-touch-utah-runlist.sh 2013-10-03 23:14:25 +0000
1250@@ -0,0 +1,65 @@
1251+#!/bin/bash
1252+# Run tests on ubuntu-touch devices and gather the results
1253+# Set $RUNLIST to the runlist you wish to run
1254+set -x
1255+
1256+WORKSPACE=/home/phablet/workspace
1257+RESDIR=`pwd`/clientlogs
1258+UTAHFILE=${RESDIR}/utah.yaml
1259+UTAH_PHABLET_CMD="${UTAH_PHABLET_CMD-/usr/share/utah/examples/run_utah_phablet.py}"
1260+
1261+function show_usage() {
1262+ echo "USAGE: $0 -s ANDROID_SERIAL -r RUNLIST"
1263+ echo " -p - List of additional files/dirs to pull from target"
1264+ exit 0
1265+}
1266+
1267+while getopts "h?p:r:s:" opt; do
1268+ case "$opt" in
1269+ h|\?)
1270+ show_usage
1271+ ;;
1272+ p) PULL_LIST=$OPTARG
1273+ ;;
1274+ r) RUNLIST=$OPTARG
1275+ ;;
1276+ s) ANDROID_SERIAL=$OPTARG
1277+ ;;
1278+ esac
1279+done
1280+if [ -z $ANDROID_SERIAL ]; then show_usage; fi
1281+
1282+if [ -n "$PULL_LIST" ]; then
1283+ PULL="--pull $PULL_LIST"
1284+fi
1285+
1286+if [ -z $QUICK ]; then
1287+ adb -s $ANDROID_SERIAL reboot
1288+ adb -s $ANDROID_SERIAL wait-for-device
1289+ sleep 5
1290+ adb -s $ANDROID_SERIAL wait-for-device
1291+ phablet-network -s ${ANDROID_SERIAL} --skip-setup
1292+else
1293+ echo "SKIPPING phone reboot..."
1294+fi
1295+rm -rf ${RESDIR}
1296+mkdir -p ${RESDIR}
1297+adb -s ${ANDROID_SERIAL} pull /var/log/installer/media-info ${RESDIR}
1298+BUILDID=$(adb -s ${ANDROID_SERIAL} shell cat /home/phablet/.ci-version)
1299+echo "= TOUCH IMAGE VERSION:$BUILDID"
1300+
1301+${UTAH_PHABLET_CMD} \
1302+ -s ${ANDROID_SERIAL} \
1303+ --results-dir ${RESDIR} \
1304+ --skip-install --skip-network --skip-utah \
1305+ ${PULL} \
1306+ -l ${RUNLIST}
1307+
1308+if ! `grep "^errors: [!0]" < $UTAHFILE >/dev/null` ; then
1309+ echo "errors found"
1310+ exit 1
1311+fi
1312+if ! `grep "^failures: [!0]" < $UTAHFILE >/dev/null` ; then
1313+ echo "failures found"
1314+ exit 2
1315+fi
1316
1317=== added directory 'tests'
1318=== added directory 'tests/address-book-app-autopilot'
1319=== added file 'tests/address-book-app-autopilot/master.run'
1320--- tests/address-book-app-autopilot/master.run 1970-01-01 00:00:00 +0000
1321+++ tests/address-book-app-autopilot/master.run 2013-10-03 23:14:25 +0000
1322@@ -0,0 +1,15 @@
1323+---
1324+testsuites:
1325+ - name: settle-before
1326+ fetch_method: dev
1327+ fetch_location: ../systemsettle
1328+ include_tests:
1329+ - systemsettle-before
1330+ - name: address-book-app-autopilot
1331+ fetch_method: dev
1332+ fetch_location: ./
1333+ - name: settle-after
1334+ fetch_method: dev
1335+ fetch_location: ../systemsettle
1336+ include_tests:
1337+ - systemsettle-after
1338
1339=== added file 'tests/address-book-app-autopilot/ts_control'
1340--- tests/address-book-app-autopilot/ts_control 1970-01-01 00:00:00 +0000
1341+++ tests/address-book-app-autopilot/ts_control 2013-10-03 23:14:25 +0000
1342@@ -0,0 +1,1 @@
1343+ts_setup: PKGS=address-book-app-autopilot prepare-autopilot-test.sh
1344
1345=== added file 'tests/address-book-app-autopilot/tslist.auto'
1346--- tests/address-book-app-autopilot/tslist.auto 1970-01-01 00:00:00 +0000
1347+++ tests/address-book-app-autopilot/tslist.auto 2013-10-03 23:14:25 +0000
1348@@ -0,0 +1,4 @@
1349+-
1350+ discovery_cmd: autopilot-list address_book_app
1351+ test_cmd: autopilot-run address_book_app.tests.{}
1352+
1353
1354=== added directory 'tests/calendar-app-autopilot'
1355=== added file 'tests/calendar-app-autopilot/master.run'
1356--- tests/calendar-app-autopilot/master.run 1970-01-01 00:00:00 +0000
1357+++ tests/calendar-app-autopilot/master.run 2013-10-03 23:14:25 +0000
1358@@ -0,0 +1,15 @@
1359+---
1360+testsuites:
1361+ - name: settle-before
1362+ fetch_method: dev
1363+ fetch_location: ../systemsettle
1364+ include_tests:
1365+ - systemsettle-before
1366+ - name: calendar-app-autopilot
1367+ fetch_method: dev
1368+ fetch_location: ./
1369+ - name: settle-after
1370+ fetch_method: dev
1371+ fetch_location: ../systemsettle
1372+ include_tests:
1373+ - systemsettle-after
1374
1375=== added file 'tests/calendar-app-autopilot/ts_control'
1376--- tests/calendar-app-autopilot/ts_control 1970-01-01 00:00:00 +0000
1377+++ tests/calendar-app-autopilot/ts_control 2013-10-03 23:14:25 +0000
1378@@ -0,0 +1,1 @@
1379+ts_setup: PKGS=calendar-app-autopilot prepare-autopilot-test.sh
1380
1381=== added file 'tests/calendar-app-autopilot/tslist.auto'
1382--- tests/calendar-app-autopilot/tslist.auto 1970-01-01 00:00:00 +0000
1383+++ tests/calendar-app-autopilot/tslist.auto 2013-10-03 23:14:25 +0000
1384@@ -0,0 +1,4 @@
1385+-
1386+ discovery_cmd: autopilot-list calendar_app
1387+ test_cmd: autopilot-run calendar_app.tests.{}
1388+
1389
1390=== added directory 'tests/camera-app-autopilot'
1391=== added file 'tests/camera-app-autopilot/master.run'
1392--- tests/camera-app-autopilot/master.run 1970-01-01 00:00:00 +0000
1393+++ tests/camera-app-autopilot/master.run 2013-10-03 23:14:25 +0000
1394@@ -0,0 +1,15 @@
1395+---
1396+testsuites:
1397+ - name: settle-before
1398+ fetch_method: dev
1399+ fetch_location: ../systemsettle
1400+ include_tests:
1401+ - systemsettle-before
1402+ - name: camera-app-autopilot
1403+ fetch_method: dev
1404+ fetch_location: ./
1405+ - name: settle-after
1406+ fetch_method: dev
1407+ fetch_location: ../systemsettle
1408+ include_tests:
1409+ - systemsettle-after
1410
1411=== added file 'tests/camera-app-autopilot/ts_control'
1412--- tests/camera-app-autopilot/ts_control 1970-01-01 00:00:00 +0000
1413+++ tests/camera-app-autopilot/ts_control 2013-10-03 23:14:25 +0000
1414@@ -0,0 +1,1 @@
1415+ts_setup: PKGS=camera-app-autopilot prepare-autopilot-test.sh
1416
1417=== added file 'tests/camera-app-autopilot/tslist.auto'
1418--- tests/camera-app-autopilot/tslist.auto 1970-01-01 00:00:00 +0000
1419+++ tests/camera-app-autopilot/tslist.auto 2013-10-03 23:14:25 +0000
1420@@ -0,0 +1,4 @@
1421+-
1422+ discovery_cmd: autopilot-list camera_app
1423+ test_cmd: autopilot-run camera_app.tests.{}
1424+
1425
1426=== added directory 'tests/click_image_tests'
1427=== added directory 'tests/click_image_tests/check_preinstalled_list'
1428=== added file 'tests/click_image_tests/check_preinstalled_list/check_preinstalled_list.py'
1429--- tests/click_image_tests/check_preinstalled_list/check_preinstalled_list.py 1970-01-01 00:00:00 +0000
1430+++ tests/click_image_tests/check_preinstalled_list/check_preinstalled_list.py 2013-10-03 23:14:25 +0000
1431@@ -0,0 +1,61 @@
1432+#!/usr/bin/python3
1433+# Copyright (C) 2013 Canonical Ltd.
1434+# Author: Sergio Schvezov <sergio.schvezov@canonical.com>
1435+
1436+# This program is free software: you can redistribute it and/or modify
1437+# it under the terms of the GNU General Public License as published by
1438+# the Free Software Foundation; version 3 of the License.
1439+#
1440+# This program is distributed in the hope that it will be useful,
1441+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1442+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1443+# GNU General Public License for more details.
1444+#
1445+# You should have received a copy of the GNU General Public License
1446+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1447+
1448+import subprocess
1449+import unittest
1450+import urllib.request
1451+
1452+
1453+click_list_url = \
1454+ 'http://people.canonical.com/~ubuntu-archive/click_packages/click_list'
1455+
1456+
1457+def get_install_list():
1458+ request = urllib.request.urlopen(click_list_url).read().decode('utf-8')
1459+ click_files = [x for x in request.split('\n') if x]
1460+ click_apps = {}
1461+ for entry in click_files:
1462+ entry_parts = entry.split('_')
1463+ click_apps[entry_parts[0]] = entry_parts[1]
1464+ return click_apps
1465+
1466+
1467+def get_image_list():
1468+ click_list = subprocess.check_output(
1469+ ['adb', 'shell', 'sudo', '-u', 'phablet',
1470+ 'bash', '-ic', 'click list']).decode('utf-8').split('\n')
1471+ click_entries = [x for x in click_list if x]
1472+ click_apps = {}
1473+ for entry in click_entries:
1474+ entry_parts = entry.split('\t')
1475+ click_apps[entry_parts[0]] = entry_parts[1].strip()
1476+ return click_apps
1477+
1478+
1479+class ClickPreinstalled(unittest.TestCase):
1480+
1481+ def setUp(self):
1482+ self.image_list = get_image_list()
1483+ self.install_list = get_install_list()
1484+ print('Search for %s on image' % self.install_list.keys())
1485+
1486+ def testPreinstalled(self):
1487+ for entry in self.install_list:
1488+ self.assertIn(entry, self.image_list.keys())
1489+
1490+
1491+if __name__ == '__main__':
1492+ unittest.main()
1493
1494=== added file 'tests/click_image_tests/check_preinstalled_list/tc_control'
1495--- tests/click_image_tests/check_preinstalled_list/tc_control 1970-01-01 00:00:00 +0000
1496+++ tests/click_image_tests/check_preinstalled_list/tc_control 2013-10-03 23:14:25 +0000
1497@@ -0,0 +1,10 @@
1498+description: check that all the expected click packages are installed
1499+dependencies: a touch read-only image
1500+action: |
1501+ 1. download the list of click packages
1502+ 2. list the current click packages installed on the device
1503+expected_results: |
1504+ 1. the current list of click packages from the archive should match
1505+type: userland
1506+timeout: 120
1507+command: ./check_preinstalled_list.py
1508
1509=== added file 'tests/click_image_tests/master.run'
1510--- tests/click_image_tests/master.run 1970-01-01 00:00:00 +0000
1511+++ tests/click_image_tests/master.run 2013-10-03 23:14:25 +0000
1512@@ -0,0 +1,5 @@
1513+---
1514+testsuites:
1515+ - name: click_image_tests
1516+ fetch_method: dev
1517+ fetch_location: ./
1518
1519=== added file 'tests/click_image_tests/tslist.run'
1520--- tests/click_image_tests/tslist.run 1970-01-01 00:00:00 +0000
1521+++ tests/click_image_tests/tslist.run 2013-10-03 23:14:25 +0000
1522@@ -0,0 +1,1 @@
1523+- test: check_preinstalled_list
1524
1525=== added directory 'tests/default'
1526=== added directory 'tests/default/ifconfig'
1527=== added file 'tests/default/ifconfig/tc_control'
1528--- tests/default/ifconfig/tc_control 1970-01-01 00:00:00 +0000
1529+++ tests/default/ifconfig/tc_control 2013-10-03 23:14:25 +0000
1530@@ -0,0 +1,13 @@
1531+description: make sure wlan0 exists
1532+dependencies: none
1533+action: |
1534+ 1. ifconfig
1535+ 2. Make sure there is a wlan0
1536+expected_results: |
1537+ 1. there is a wlan0 on the system
1538+type: userland
1539+timeout: 60
1540+command: $TARGET_PREFIX ifconfig | grep wlan0
1541+#build_cmd:
1542+#tc_setup:
1543+#tc_cleanup:
1544
1545=== added directory 'tests/default/install'
1546=== added file 'tests/default/install/tc_control'
1547--- tests/default/install/tc_control 1970-01-01 00:00:00 +0000
1548+++ tests/default/install/tc_control 2013-10-03 23:14:25 +0000
1549@@ -0,0 +1,12 @@
1550+description: apt-get install works
1551+dependencies: openssh-server
1552+action: |
1553+ 1. apt-get install -y curl
1554+expected_results: |
1555+ 1. apt-get install can install a package and ends with exit code 0
1556+type: userland
1557+timeout: 120
1558+command: $TARGET_PREFIX apt-get install -y curl
1559+#build_cmd:
1560+#tc_setup:
1561+tc_cleanup: $TARGET_PREFIX apt-get remove -y curl
1562
1563=== added file 'tests/default/master.run'
1564--- tests/default/master.run 1970-01-01 00:00:00 +0000
1565+++ tests/default/master.run 2013-10-03 23:14:25 +0000
1566@@ -0,0 +1,5 @@
1567+---
1568+testsuites:
1569+ - name: smoke_touch
1570+ fetch_method: dev
1571+ fetch_location: ./
1572
1573=== added directory 'tests/default/netstat'
1574=== added file 'tests/default/netstat/tc_control'
1575--- tests/default/netstat/tc_control 1970-01-01 00:00:00 +0000
1576+++ tests/default/netstat/tc_control 2013-10-03 23:14:25 +0000
1577@@ -0,0 +1,12 @@
1578+description: netstat -l lists all the services
1579+dependencies: none
1580+action: |
1581+ 1. netstat -l
1582+expected_results: |
1583+ 1. netstat shows output and exists cleanly
1584+type: userland
1585+timeout: 60
1586+command: $TARGET_PREFIX netstat -l
1587+#build_cmd:
1588+#tc_setup:
1589+#tc_cleanup:
1590
1591=== added directory 'tests/default/ping'
1592=== added file 'tests/default/ping/pingtest.sh'
1593--- tests/default/ping/pingtest.sh 1970-01-01 00:00:00 +0000
1594+++ tests/default/ping/pingtest.sh 2013-10-03 23:14:25 +0000
1595@@ -0,0 +1,12 @@
1596+#!/bin/sh
1597+
1598+set -e
1599+
1600+if [ -z $TARGET_PREFIX ] ; then
1601+ echo "RUNNING ON TARGET"
1602+ ping -c 5 $(ip route show | head -n1 |cut -d" " -f3)
1603+else
1604+ echo "RUNNING FROM HOST"
1605+ ${TARGET_PREFIX} ping -c 5 '$(ip route show | head -n1 |cut -d" " -f3)'
1606+fi
1607+
1608
1609=== added file 'tests/default/ping/tc_control'
1610--- tests/default/ping/tc_control 1970-01-01 00:00:00 +0000
1611+++ tests/default/ping/tc_control 2013-10-03 23:14:25 +0000
1612@@ -0,0 +1,12 @@
1613+description: ping -c 5 $gateway
1614+dependencies: None
1615+action: |
1616+ 1. ping -c 5 $gateway
1617+expected_results: |
1618+ 1. ping ends without an error
1619+type: userland
1620+timeout: 60
1621+command: ./pingtest.sh
1622+#build_cmd:
1623+#tc_setup:
1624+#tc_cleanup:
1625
1626=== added directory 'tests/default/pwd'
1627=== added file 'tests/default/pwd/tc_control'
1628--- tests/default/pwd/tc_control 1970-01-01 00:00:00 +0000
1629+++ tests/default/pwd/tc_control 2013-10-03 23:14:25 +0000
1630@@ -0,0 +1,9 @@
1631+description: pwd works
1632+dependencies: none
1633+action: |
1634+ 1. cd to /tmp and verify which is the current directory
1635+expected_results: |
1636+ 1. Current directory is /tmp
1637+type: userland
1638+timeout: 60
1639+command: ./test.sh
1640
1641=== added file 'tests/default/pwd/test.sh'
1642--- tests/default/pwd/test.sh 1970-01-01 00:00:00 +0000
1643+++ tests/default/pwd/test.sh 2013-10-03 23:14:25 +0000
1644@@ -0,0 +1,18 @@
1645+#!/bin/sh
1646+
1647+set -e
1648+
1649+if [ -n "$TARGET_PREFIX" ] ; then
1650+ echo "RUNNING FROM HOST"
1651+else
1652+ echo "RUNNING ON TARGET"
1653+ TARGET_PREFIX="/bin/sh -c"
1654+fi
1655+
1656+#when it comes from adb we get a \r\n that should be removed
1657+dir=$($TARGET_PREFIX "cd /tmp; pwd" | head -n1 | tr -d '\r\n')
1658+if [ $dir != "/tmp" ] ; then
1659+ echo "failed to change directory"
1660+ exit 1
1661+fi
1662+exit 0
1663
1664=== added directory 'tests/default/route'
1665=== added file 'tests/default/route/tc_control'
1666--- tests/default/route/tc_control 1970-01-01 00:00:00 +0000
1667+++ tests/default/route/tc_control 2013-10-03 23:14:25 +0000
1668@@ -0,0 +1,12 @@
1669+description: route shows wlan0 routes
1670+dependencies: none
1671+action: |
1672+ 1. route -n | grep wlan0
1673+expected_results: |
1674+ 1. route shows wlan0 routes
1675+type: userland
1676+timeout: 60
1677+command: $TARGET_PREFIX route -n | grep wlan0
1678+#build_cmd:
1679+#tc_setup:
1680+#tc_cleanup:
1681
1682=== added directory 'tests/default/systemsettle'
1683=== added file 'tests/default/systemsettle/systemsettle.sh'
1684--- tests/default/systemsettle/systemsettle.sh 1970-01-01 00:00:00 +0000
1685+++ tests/default/systemsettle/systemsettle.sh 2013-10-03 23:14:25 +0000
1686@@ -0,0 +1,120 @@
1687+#!/bin/bash
1688+
1689+# Configuration variables:
1690+# TARGET_PREFIX - Allows this to be run from the host, by providings something
1691+# like TARGET_PREFIX="adb shell"
1692+# UTAH_PROBE_DIR - optionally where to save log files so utah will grab them
1693+
1694+set -e
1695+
1696+[ -z $UTAH_PROBE_DIR ] && UTAH_PROBE_DIR="/tmp"
1697+
1698+# default exit code storage
1699+dump_error=1
1700+
1701+calc () { awk "BEGIN{ print $* }" ;}
1702+
1703+function show_usage() {
1704+ echo "Usage:"
1705+ echo " $0 [options]"
1706+ echo "Options:"
1707+ echo " -r run forever without exiting"
1708+ echo " -p minimum idle percent to wait for (Default: 99)"
1709+ echo " -c number of times to run top at each iteration (Default: 10)"
1710+ echo " -d seconds to delay between each top iteration (Default: 6)"
1711+ echo " -i top measurements to ignore from each loop (Default: 1)"
1712+ echo " -m maximum loops of top before giving up if minimum idle"
1713+ echo " percent is not reached (Default: 10)"
1714+ echo " -l label to include for the top_log file"
1715+ exit 129
1716+}
1717+
1718+while getopts "h?rp:c:d:i:m:l:" opt; do
1719+ case "$opt" in
1720+ h|\?) show_usage
1721+ ;;
1722+ r) settle_prefix='-'
1723+ ;;
1724+ p) idle_avg_min=$OPTARG
1725+ ;;
1726+ c) top_repeat=$OPTARG
1727+ ;;
1728+ d) top_wait=$OPTARG
1729+ ;;
1730+ i) top_ignore=$OPTARG
1731+ ;;
1732+ m) settle_max=$OPTARG
1733+ ;;
1734+ l) top_log_label=$OPTARG
1735+ ;;
1736+ esac
1737+done
1738+
1739+# minimum average idle level required to succeed
1740+idle_avg_min=${idle_avg_min:-99}
1741+# measurement details: top $top_wait $top_repeat
1742+top_repeat=${top_repeat:-10}
1743+top_wait=${top_wait:-6}
1744+# how many samples to ignore
1745+top_ignore=${top_ignore:-1}
1746+# how many total attempts to settle the system
1747+settle_max=${settle_max:-10}
1748+
1749+top_log="$UTAH_PROBE_DIR/top$top_log_label.log"
1750+
1751+# set and calc more runtime values
1752+top_tail=`calc $top_repeat - $top_ignore`
1753+settle_count=0
1754+idle_avg=0
1755+
1756+echo "System Settle run - quiesce the system"
1757+echo "--------------------------------------"
1758+echo
1759+echo " idle_avg_min = '$idle_avg_min'"
1760+echo " top_repeat = '$top_repeat'"
1761+echo " top_wait = '$top_wait'"
1762+echo " top_ignore = '$top_ignore'"
1763+echo " settle_max = '$settle_max'"
1764+echo " run_forever = '$settle_prefix' (- = yes)"
1765+echo " log files = $top_log $top_log.reduced"
1766+echo " target prefix = $TARGET_PREFIX"
1767+echo
1768+
1769+while test `calc $idle_avg '<' $idle_avg_min` = 1 -a "$settle_prefix$settle_count" -lt "$settle_max"; do
1770+ echo -n "Starting system idle measurement (run: $settle_count) ... "
1771+
1772+ # get top
1773+ echo "TOP DUMP (after settle run: $settle_count)" >> $top_log
1774+ echo "========================" >> $top_log
1775+ ${TARGET_PREFIX} top -b -d $top_wait -n $top_repeat >> $top_log
1776+ cat $top_log | grep '.Cpu.*' | tail -n $top_tail > $top_log.reduced
1777+ echo >> $top_log
1778+
1779+ # calc average of idle field for this measurement
1780+ sum=0
1781+ count=0
1782+ while read line; do
1783+ idle=`echo $line | sed -e 's/.* \([0-9\.]*\) id.*/\1/'`
1784+ sum=`calc $sum + $idle`
1785+ count=`calc $count + 1`
1786+ done < $top_log.reduced
1787+
1788+ idle_avg=`calc $sum / $count`
1789+ settle_count=`calc $settle_count + 1`
1790+
1791+ echo " DONE."
1792+ echo
1793+ echo "Measurement:"
1794+ echo " + idle level: $idle_avg"
1795+ echo " + idle sum: $sum / count: $count"
1796+ echo
1797+done
1798+
1799+if test `calc $idle_avg '<' $idle_avg_min` = 1; then
1800+ echo "system not settled. FAIL"
1801+ exit 1
1802+else
1803+ echo "system settled. SUCCESS"
1804+ exit 0
1805+fi
1806+
1807
1808=== added file 'tests/default/systemsettle/tc_control'
1809--- tests/default/systemsettle/tc_control 1970-01-01 00:00:00 +0000
1810+++ tests/default/systemsettle/tc_control 2013-10-03 23:14:25 +0000
1811@@ -0,0 +1,9 @@
1812+description: check if system settles to idle average > 99.25%
1813+dependencies: none
1814+action: |
1815+ 1. Take CPU load samples for 10 minutes and fail if average idle never goes above 99.25% percent
1816+expected_results: |
1817+ 1. When doing nothing, system calms down to at least 99.25% idle level
1818+type: userland
1819+timeout: 720
1820+command: ./systemsettle.sh -c5 -d2 -p 97.5
1821
1822=== added file 'tests/default/ts_control'
1823--- tests/default/ts_control 1970-01-01 00:00:00 +0000
1824+++ tests/default/ts_control 2013-10-03 23:14:25 +0000
1825@@ -0,0 +1,3 @@
1826+#build_cmd: echo building
1827+#ts_setup: echo setting up
1828+#ts_cleanup: echo cleaning up
1829
1830=== added file 'tests/default/tslist.run'
1831--- tests/default/tslist.run 1970-01-01 00:00:00 +0000
1832+++ tests/default/tslist.run 2013-10-03 23:14:25 +0000
1833@@ -0,0 +1,10 @@
1834+- test: pwd
1835+- test: uname
1836+- test: vmstat
1837+- test: systemsettle
1838+- test: netstat
1839+- test: ifconfig
1840+- test: route
1841+- test: ping
1842+- test: install
1843+- test: unity8
1844
1845=== added directory 'tests/default/uname'
1846=== added file 'tests/default/uname/tc_control'
1847--- tests/default/uname/tc_control 1970-01-01 00:00:00 +0000
1848+++ tests/default/uname/tc_control 2013-10-03 23:14:25 +0000
1849@@ -0,0 +1,12 @@
1850+description: uname shows an ubuntu-phablet image installed
1851+dependencies: CHANGE_ME
1852+action: |
1853+ 1. uname -a|grep ubuntu-phablet
1854+expected_results: |
1855+ 1. ubuntu-phablet is installed as expected
1856+type: userland
1857+timeout: 60
1858+command: $TARGET_PREFIX uname -a | grep ubuntu-phablet
1859+#build_cmd:
1860+#tc_setup:
1861+#tc_cleanup:
1862
1863=== added directory 'tests/default/unity8'
1864=== added file 'tests/default/unity8/tc_control'
1865--- tests/default/unity8/tc_control 1970-01-01 00:00:00 +0000
1866+++ tests/default/unity8/tc_control 2013-10-03 23:14:25 +0000
1867@@ -0,0 +1,9 @@
1868+description: check for unity8 process
1869+dependencies: None
1870+action: |
1871+ 1. pgrep unity8
1872+expected_results: |
1873+ 1. pgrep exits with 0, indicating it found a matching process
1874+type: userland
1875+timeout: 60
1876+command: $TARGET_PREFIX /usr/bin/pgrep unity8
1877
1878=== added directory 'tests/default/vmstat'
1879=== added file 'tests/default/vmstat/tc_control'
1880--- tests/default/vmstat/tc_control 1970-01-01 00:00:00 +0000
1881+++ tests/default/vmstat/tc_control 2013-10-03 23:14:25 +0000
1882@@ -0,0 +1,12 @@
1883+description: Execute vmstat and capture output
1884+dependencies: none
1885+action: |
1886+ 1. vmstat
1887+expected_results: |
1888+ 1. vmstat finishes without an error
1889+type: userland
1890+timeout: 60
1891+command: $TARGET_PREFIX vmstat
1892+#build_cmd:
1893+#tc_setup:
1894+#tc_cleanup:
1895
1896=== added directory 'tests/dialer-app-autopilot'
1897=== added file 'tests/dialer-app-autopilot/master.run'
1898--- tests/dialer-app-autopilot/master.run 1970-01-01 00:00:00 +0000
1899+++ tests/dialer-app-autopilot/master.run 2013-10-03 23:14:25 +0000
1900@@ -0,0 +1,15 @@
1901+---
1902+testsuites:
1903+ - name: settle-before
1904+ fetch_method: dev
1905+ fetch_location: ../systemsettle
1906+ include_tests:
1907+ - systemsettle-before
1908+ - name: dialer-app-autopilot
1909+ fetch_method: dev
1910+ fetch_location: ./
1911+ - name: settle-after
1912+ fetch_method: dev
1913+ fetch_location: ../systemsettle
1914+ include_tests:
1915+ - systemsettle-after
1916
1917=== added file 'tests/dialer-app-autopilot/ts_control'
1918--- tests/dialer-app-autopilot/ts_control 1970-01-01 00:00:00 +0000
1919+++ tests/dialer-app-autopilot/ts_control 2013-10-03 23:14:25 +0000
1920@@ -0,0 +1,1 @@
1921+ts_setup: PKGS="dialer-app-autopilot ubuntu-ui-toolkit-autopilot" prepare-autopilot-test.sh
1922
1923=== added file 'tests/dialer-app-autopilot/tslist.auto'
1924--- tests/dialer-app-autopilot/tslist.auto 1970-01-01 00:00:00 +0000
1925+++ tests/dialer-app-autopilot/tslist.auto 2013-10-03 23:14:25 +0000
1926@@ -0,0 +1,4 @@
1927+-
1928+ discovery_cmd: autopilot-list dialer_app
1929+ test_cmd: autopilot-run dialer_app.tests.{}
1930+
1931
1932=== added directory 'tests/dropping-letters-app-autopilot'
1933=== added file 'tests/dropping-letters-app-autopilot/master.run'
1934--- tests/dropping-letters-app-autopilot/master.run 1970-01-01 00:00:00 +0000
1935+++ tests/dropping-letters-app-autopilot/master.run 2013-10-03 23:14:25 +0000
1936@@ -0,0 +1,15 @@
1937+---
1938+testsuites:
1939+ - name: settle-before
1940+ fetch_method: dev
1941+ fetch_location: ../systemsettle
1942+ include_tests:
1943+ - systemsettle-before
1944+ - name: dropping-letters-app-autopilot
1945+ fetch_method: dev
1946+ fetch_location: ./
1947+ - name: settle-after
1948+ fetch_method: dev
1949+ fetch_location: ../systemsettle
1950+ include_tests:
1951+ - systemsettle-after
1952
1953=== added file 'tests/dropping-letters-app-autopilot/ts_control'
1954--- tests/dropping-letters-app-autopilot/ts_control 1970-01-01 00:00:00 +0000
1955+++ tests/dropping-letters-app-autopilot/ts_control 2013-10-03 23:14:25 +0000
1956@@ -0,0 +1,1 @@
1957+ts_setup: prepare-autopilot-test.sh
1958
1959=== added file 'tests/dropping-letters-app-autopilot/tslist.auto'
1960--- tests/dropping-letters-app-autopilot/tslist.auto 1970-01-01 00:00:00 +0000
1961+++ tests/dropping-letters-app-autopilot/tslist.auto 2013-10-03 23:14:25 +0000
1962@@ -0,0 +1,4 @@
1963+-
1964+ discovery_cmd: autopilot-list dropping_letters_app
1965+ test_cmd: autopilot-run dropping_letters_app.tests.{}
1966+
1967
1968=== added directory 'tests/eventstat'
1969=== added directory 'tests/eventstat/eventstat'
1970=== added file 'tests/eventstat/eventstat/eventstat.sh'
1971--- tests/eventstat/eventstat/eventstat.sh 1970-01-01 00:00:00 +0000
1972+++ tests/eventstat/eventstat/eventstat.sh 2013-10-03 23:14:25 +0000
1973@@ -0,0 +1,5 @@
1974+#!/bin/bash
1975+: ${DURATION:=60}
1976+: ${COUNT:=10}
1977+${TARGET_PREFIX} "echo \"{\\\"duration\\\": $DURATION, \\\"count\\\": $COUNT}\" > /tmp/results/options.json"
1978+${TARGET_PREFIX} "eventstat -CSl -r /tmp/results/eventstat.csv $DURATION $COUNT > /tmp/results/eventstat.log"
1979
1980=== added file 'tests/eventstat/eventstat/setup.sh'
1981--- tests/eventstat/eventstat/setup.sh 1970-01-01 00:00:00 +0000
1982+++ tests/eventstat/eventstat/setup.sh 2013-10-03 23:14:25 +0000
1983@@ -0,0 +1,7 @@
1984+#!/bin/bash
1985+
1986+${TARGET_PREFIX} mkdir -p /tmp/results
1987+NO_UNLOCK=1 PKGS="eventstat" prepare-autopilot-test.sh
1988+#Let the system quiet down for a little while
1989+sleep 300
1990+
1991
1992=== added file 'tests/eventstat/eventstat/tc_control'
1993--- tests/eventstat/eventstat/tc_control 1970-01-01 00:00:00 +0000
1994+++ tests/eventstat/eventstat/tc_control 2013-10-03 23:14:25 +0000
1995@@ -0,0 +1,12 @@
1996+description: Gather memory usage information
1997+dependencies: none
1998+action: |
1999+ 1. gather eventstat data
2000+expected_results: |
2001+ 1. eventstat.log should be saved to /tmp/results
2002+type: userland
2003+timeout: 800
2004+command: ./eventstat.sh
2005+#build_cmd:
2006+tc_setup: ./setup.sh
2007+#tc_cleanup:
2008
2009=== added file 'tests/eventstat/master.run'
2010--- tests/eventstat/master.run 1970-01-01 00:00:00 +0000
2011+++ tests/eventstat/master.run 2013-10-03 23:14:25 +0000
2012@@ -0,0 +1,5 @@
2013+---
2014+testsuites:
2015+ - name: eventstat
2016+ fetch_method: dev
2017+ fetch_location: ./
2018
2019=== added file 'tests/eventstat/tslist.run'
2020--- tests/eventstat/tslist.run 1970-01-01 00:00:00 +0000
2021+++ tests/eventstat/tslist.run 2013-10-03 23:14:25 +0000
2022@@ -0,0 +1,1 @@
2023+- test: eventstat
2024
2025=== added directory 'tests/friends-app-autopilot'
2026=== added file 'tests/friends-app-autopilot/master.run'
2027--- tests/friends-app-autopilot/master.run 1970-01-01 00:00:00 +0000
2028+++ tests/friends-app-autopilot/master.run 2013-10-03 23:14:25 +0000
2029@@ -0,0 +1,15 @@
2030+---
2031+testsuites:
2032+ - name: settle-before
2033+ fetch_method: dev
2034+ fetch_location: ../systemsettle
2035+ include_tests:
2036+ - systemsettle-before
2037+ - name: friends-app-autopilot
2038+ fetch_method: dev
2039+ fetch_location: ./
2040+ - name: settle-after
2041+ fetch_method: dev
2042+ fetch_location: ../systemsettle
2043+ include_tests:
2044+ - systemsettle-after
2045
2046=== added file 'tests/friends-app-autopilot/ts_control'
2047--- tests/friends-app-autopilot/ts_control 1970-01-01 00:00:00 +0000
2048+++ tests/friends-app-autopilot/ts_control 2013-10-03 23:14:25 +0000
2049@@ -0,0 +1,1 @@
2050+ts_setup: PKGS=friends-app-autopilot prepare-autopilot-test.sh
2051
2052=== added file 'tests/friends-app-autopilot/tslist.auto'
2053--- tests/friends-app-autopilot/tslist.auto 1970-01-01 00:00:00 +0000
2054+++ tests/friends-app-autopilot/tslist.auto 2013-10-03 23:14:25 +0000
2055@@ -0,0 +1,4 @@
2056+-
2057+ discovery_cmd: autopilot-list friends_app
2058+ test_cmd: autopilot-run friends_app.tests.{}
2059+
2060
2061=== added directory 'tests/gallery-app-autopilot'
2062=== added file 'tests/gallery-app-autopilot/master.run'
2063--- tests/gallery-app-autopilot/master.run 1970-01-01 00:00:00 +0000
2064+++ tests/gallery-app-autopilot/master.run 2013-10-03 23:14:25 +0000
2065@@ -0,0 +1,15 @@
2066+---
2067+testsuites:
2068+ - name: settle-before
2069+ fetch_method: dev
2070+ fetch_location: ../systemsettle
2071+ include_tests:
2072+ - systemsettle-before
2073+ - name: gallery-app-autopilot
2074+ fetch_method: dev
2075+ fetch_location: ./
2076+ - name: settle-after
2077+ fetch_method: dev
2078+ fetch_location: ../systemsettle
2079+ include_tests:
2080+ - systemsettle-after
2081
2082=== added file 'tests/gallery-app-autopilot/ts_control'
2083--- tests/gallery-app-autopilot/ts_control 1970-01-01 00:00:00 +0000
2084+++ tests/gallery-app-autopilot/ts_control 2013-10-03 23:14:25 +0000
2085@@ -0,0 +1,1 @@
2086+ts_setup: PKGS=gallery-app-autopilot prepare-autopilot-test.sh
2087
2088=== added file 'tests/gallery-app-autopilot/tslist.auto'
2089--- tests/gallery-app-autopilot/tslist.auto 1970-01-01 00:00:00 +0000
2090+++ tests/gallery-app-autopilot/tslist.auto 2013-10-03 23:14:25 +0000
2091@@ -0,0 +1,4 @@
2092+-
2093+ discovery_cmd: autopilot-list gallery_app
2094+ test_cmd: autopilot-run gallery_app.tests.{}
2095+
2096
2097=== added directory 'tests/install-and-boot'
2098=== added directory 'tests/install-and-boot/boot'
2099=== added file 'tests/install-and-boot/boot/tc_control'
2100--- tests/install-and-boot/boot/tc_control 1970-01-01 00:00:00 +0000
2101+++ tests/install-and-boot/boot/tc_control 2013-10-03 23:14:25 +0000
2102@@ -0,0 +1,9 @@
2103+description: Ensures the target system has booted
2104+dependencies: provision.sh was run
2105+action: |
2106+ 1. checks adb-shell works
2107+expected_results: |
2108+ 1. adb-shell is active to the target
2109+type: userland
2110+timeout: 60
2111+command: adb-shell /bin/true
2112
2113=== added file 'tests/install-and-boot/master.run'
2114--- tests/install-and-boot/master.run 1970-01-01 00:00:00 +0000
2115+++ tests/install-and-boot/master.run 2013-10-03 23:14:25 +0000
2116@@ -0,0 +1,5 @@
2117+---
2118+testsuites:
2119+ - name: install-and-boot
2120+ fetch_method: dev
2121+ fetch_location: ./
2122
2123=== added file 'tests/install-and-boot/tslist.run'
2124--- tests/install-and-boot/tslist.run 1970-01-01 00:00:00 +0000
2125+++ tests/install-and-boot/tslist.run 2013-10-03 23:14:25 +0000
2126@@ -0,0 +1,1 @@
2127+- test: boot
2128
2129=== added directory 'tests/mediaplayer-app-autopilot'
2130=== added file 'tests/mediaplayer-app-autopilot/master.run'
2131--- tests/mediaplayer-app-autopilot/master.run 1970-01-01 00:00:00 +0000
2132+++ tests/mediaplayer-app-autopilot/master.run 2013-10-03 23:14:25 +0000
2133@@ -0,0 +1,15 @@
2134+---
2135+testsuites:
2136+ - name: settle-before
2137+ fetch_method: dev
2138+ fetch_location: ../systemsettle
2139+ include_tests:
2140+ - systemsettle-before
2141+ - name: mediaplayer-app-autopilot
2142+ fetch_method: dev
2143+ fetch_location: ./
2144+ - name: settle-after
2145+ fetch_method: dev
2146+ fetch_location: ../systemsettle
2147+ include_tests:
2148+ - systemsettle-after
2149
2150=== added file 'tests/mediaplayer-app-autopilot/ts_control'
2151--- tests/mediaplayer-app-autopilot/ts_control 1970-01-01 00:00:00 +0000
2152+++ tests/mediaplayer-app-autopilot/ts_control 2013-10-03 23:14:25 +0000
2153@@ -0,0 +1,1 @@
2154+ts_setup: PKGS=mediaplayer-app-autopilot prepare-autopilot-test.sh
2155
2156=== added file 'tests/mediaplayer-app-autopilot/tslist.auto'
2157--- tests/mediaplayer-app-autopilot/tslist.auto 1970-01-01 00:00:00 +0000
2158+++ tests/mediaplayer-app-autopilot/tslist.auto 2013-10-03 23:14:25 +0000
2159@@ -0,0 +1,4 @@
2160+-
2161+ discovery_cmd: autopilot-list mediaplayer_app
2162+ test_cmd: autopilot-run mediaplayer_app.tests.{}
2163+
2164
2165=== added directory 'tests/memevent'
2166=== added file 'tests/memevent/master.run'
2167--- tests/memevent/master.run 1970-01-01 00:00:00 +0000
2168+++ tests/memevent/master.run 2013-10-03 23:14:25 +0000
2169@@ -0,0 +1,5 @@
2170+---
2171+testsuites:
2172+ - name: memevent
2173+ fetch_method: dev
2174+ fetch_location: ./
2175
2176=== added file 'tests/memevent/setup.sh'
2177--- tests/memevent/setup.sh 1970-01-01 00:00:00 +0000
2178+++ tests/memevent/setup.sh 2013-10-03 23:14:25 +0000
2179@@ -0,0 +1,8 @@
2180+#!/bin/sh
2181+
2182+set -e
2183+
2184+# copy the autopilot scripts over if needed
2185+[ -z $ANDROID_SERIAL ] || adb push ./ubuntu_test_cases /home/phablet/autopilot/ubuntu_test_cases
2186+
2187+PKGS="camera-app-autopilot gallery-app-autopilot mediaplayer-app-autopilot webbrowser-app-autopilot" prepare-autopilot-test.sh
2188
2189=== added file 'tests/memevent/ts_control'
2190--- tests/memevent/ts_control 1970-01-01 00:00:00 +0000
2191+++ tests/memevent/ts_control 2013-10-03 23:14:25 +0000
2192@@ -0,0 +1,1 @@
2193+ts_setup: ./setup.sh
2194
2195=== added file 'tests/memevent/tslist.auto'
2196--- tests/memevent/tslist.auto 1970-01-01 00:00:00 +0000
2197+++ tests/memevent/tslist.auto 2013-10-03 23:14:25 +0000
2198@@ -0,0 +1,7 @@
2199+---
2200+# The discovery command is run from a directory containing the whole suite
2201+# The test command is run from a sub directory in that
2202+# We need to run each command in the directory that contains ubuntu_test_cases
2203+# so that autopilot can find our python modules
2204+- discovery_cmd: cd memevent; autopilot-list ubuntu_test_cases.memory_usage_measurement
2205+ test_cmd: cd ..; autopilot-run ubuntu_test_cases.memory_usage_measurement.tests.{}
2206
2207=== added directory 'tests/memevent/ubuntu_test_cases'
2208=== added file 'tests/memevent/ubuntu_test_cases/__init__.py'
2209--- tests/memevent/ubuntu_test_cases/__init__.py 1970-01-01 00:00:00 +0000
2210+++ tests/memevent/ubuntu_test_cases/__init__.py 2013-10-03 23:14:25 +0000
2211@@ -0,0 +1,6 @@
2212+"""ubuntu_test_cases package
2213+
2214+Warning: This python package is installed by a different debian package in a
2215+different branch. It's been been created here only because it's convenient to
2216+run autopilot directly from the branch.
2217+"""
2218
2219=== added directory 'tests/memevent/ubuntu_test_cases/memory_usage_measurement'
2220=== added file 'tests/memevent/ubuntu_test_cases/memory_usage_measurement/__init__.py'
2221--- tests/memevent/ubuntu_test_cases/memory_usage_measurement/__init__.py 1970-01-01 00:00:00 +0000
2222+++ tests/memevent/ubuntu_test_cases/memory_usage_measurement/__init__.py 2013-10-03 23:14:25 +0000
2223@@ -0,0 +1,1 @@
2224+"""Event based memory usage measurements test cases."""
2225
2226=== added directory 'tests/memevent/ubuntu_test_cases/memory_usage_measurement/apps'
2227=== added file 'tests/memevent/ubuntu_test_cases/memory_usage_measurement/apps/__init__.py'
2228--- tests/memevent/ubuntu_test_cases/memory_usage_measurement/apps/__init__.py 1970-01-01 00:00:00 +0000
2229+++ tests/memevent/ubuntu_test_cases/memory_usage_measurement/apps/__init__.py 2013-10-03 23:14:25 +0000
2230@@ -0,0 +1,21 @@
2231+"""Application classes used to drive them easily with autopilot."""
2232+
2233+from autopilot.input import Keyboard, Mouse, Pointer, Touch
2234+from autopilot.platform import model
2235+
2236+
2237+class App(object):
2238+
2239+ """Application class with common code."""
2240+
2241+ def __init__(self, tc):
2242+ self.tc = tc
2243+ self.app = None
2244+ self.window = None
2245+
2246+ self.keyboard = Keyboard.create()
2247+ if model() == 'Desktop':
2248+ input_device = Mouse.create()
2249+ else:
2250+ input_device = Touch.create()
2251+ self.pointer = Pointer(input_device)
2252
2253=== added file 'tests/memevent/ubuntu_test_cases/memory_usage_measurement/apps/browser.py'
2254--- tests/memevent/ubuntu_test_cases/memory_usage_measurement/apps/browser.py 1970-01-01 00:00:00 +0000
2255+++ tests/memevent/ubuntu_test_cases/memory_usage_measurement/apps/browser.py 2013-10-03 23:14:25 +0000
2256@@ -0,0 +1,103 @@
2257+"""Browser application to write autopilot test cases easily."""
2258+
2259+from testtools.matchers import Contains, Equals
2260+
2261+from ubuntuuitoolkit.emulators import UbuntuUIToolkitEmulatorBase
2262+from webbrowser_app.emulators.browser import Browser
2263+
2264+from ubuntu_test_cases.memory_usage_measurement.apps import App
2265+from ubuntu_test_cases.memory_usage_measurement.matchers import (
2266+ DoesNotChange,
2267+ Eventually,
2268+)
2269+
2270+
2271+class BrowserApp(App):
2272+
2273+ """Browser application."""
2274+
2275+ TYPING_DELAY = 0.01
2276+
2277+ def assert_chrome_eventually_hidden(self):
2278+ """Make sure chrome is eventually hidden."""
2279+
2280+ toolbar = self.window.get_toolbar()
2281+ self.tc.assertThat(toolbar.opened, Eventually(Equals(False)))
2282+ self.tc.assertThat(toolbar.animating, Eventually(Equals(False)))
2283+
2284+ def assert_page_eventually_loaded(self, url):
2285+ """Make sure page is eventually loaded."""
2286+ webview = self.window.get_current_webview()
2287+ self.tc.assertThat(webview.url, Eventually(Equals(url)))
2288+ # loadProgress == 100 ensures that a page has actually loaded
2289+ self.tc.assertThat(webview.loadProgress, Eventually(Equals(100)))
2290+ self.tc.assertThat(webview.loading, Eventually(Equals(False)))
2291+
2292+ def clear_address_bar(self):
2293+ """Clear address bar."""
2294+ self.focus_address_bar()
2295+ clear_button = self.window.get_address_bar_clear_button()
2296+ self.tc.assertThat(lambda: (clear_button.x,
2297+ clear_button.y,
2298+ clear_button.y),
2299+ Eventually(DoesNotChange()))
2300+ self.pointer.move_to_object(clear_button)
2301+ self.pointer.click()
2302+ text_field = self.window.get_address_bar_text_field()
2303+ self.tc.assertThat(text_field.text, Eventually(Equals("")))
2304+
2305+ def ensure_chrome_is_hidden(self):
2306+ """Make sure chrome is hidden."""
2307+ webview = self.window.get_current_webview()
2308+ self.pointer.move_to_object(webview)
2309+ self.pointer.click()
2310+ self.assert_chrome_eventually_hidden()
2311+
2312+ def focus_address_bar(self):
2313+ """Make sure address bar is focused."""
2314+ address_bar = self.window.get_address_bar()
2315+ self.pointer.move_to_object(address_bar)
2316+ self.pointer.click()
2317+ self.tc.assertThat(address_bar.activeFocus, Eventually(Equals(True)))
2318+
2319+ def go_to_url(self, url):
2320+ """Go to given url.
2321+
2322+ :param url: URL that should be loaded in the browser
2323+ :type url: str
2324+
2325+ """
2326+ self.ensure_chrome_is_hidden()
2327+ self.window.open_toolbar()
2328+ self.clear_address_bar()
2329+ self.type_in_address_bar(url)
2330+ self.keyboard.press_and_release("Enter")
2331+
2332+ def launch(self):
2333+ """Launch application."""
2334+ args = [
2335+ 'webbrowser-app',
2336+ '--fullscreen',
2337+ ('--desktop_file_hint='
2338+ '/usr/share/applications/webbrowser-app.desktop'),
2339+ ]
2340+ self.app = self.tc.launch_test_application(
2341+ *args,
2342+ app_type='qt',
2343+ emulator_base=UbuntuUIToolkitEmulatorBase
2344+ )
2345+ self.window = self.app.select_single(Browser)
2346+ self.window.visible.wait_for(True)
2347+
2348+ def type_in_address_bar(self, text):
2349+ """Type text in address bar.
2350+
2351+ :param text: Text to be typed in the address bar.
2352+ :type text: str
2353+
2354+ """
2355+ address_bar = self.window.get_address_bar()
2356+ self.tc.assertThat(address_bar.activeFocus, Eventually(Equals(True)))
2357+ self.keyboard.type(text, delay=self.TYPING_DELAY)
2358+ text_field = self.window.get_address_bar_text_field()
2359+ self.tc.assertThat(text_field.text, Eventually(Contains(text)))
2360
2361=== added file 'tests/memevent/ubuntu_test_cases/memory_usage_measurement/apps/camera.py'
2362--- tests/memevent/ubuntu_test_cases/memory_usage_measurement/apps/camera.py 1970-01-01 00:00:00 +0000
2363+++ tests/memevent/ubuntu_test_cases/memory_usage_measurement/apps/camera.py 2013-10-03 23:14:25 +0000
2364@@ -0,0 +1,58 @@
2365+"""Camera application to write autopilot test cases easily."""
2366+
2367+import logging
2368+import os
2369+
2370+from glob import glob
2371+
2372+from camera_app.emulators.main_window import MainWindow as CameraWindow
2373+from testtools.matchers import Equals, HasLength
2374+
2375+from ubuntu_test_cases.memory_usage_measurement.apps import App
2376+from ubuntu_test_cases.memory_usage_measurement.matchers import Eventually
2377+
2378+LOGGER = logging.getLogger(__file__)
2379+
2380+
2381+class CameraApp(App):
2382+
2383+ """Camera application."""
2384+
2385+ IMAGE_FILENAME_PATTERN = os.path.expanduser('~/Pictures/image*')
2386+
2387+ def _remove_image_files(self):
2388+ """Remove all image files.
2389+
2390+ This is useful not only to cleanup, but also to check that just one
2391+ image file has been written to disk.
2392+
2393+ """
2394+ for filename in glob(self.IMAGE_FILENAME_PATTERN):
2395+ LOGGER.debug('Removing image file: {}'.format(filename))
2396+ os.remove(filename)
2397+
2398+ def launch(self):
2399+ """Launch application."""
2400+ args = [
2401+ 'camera-app',
2402+ '--fullscreen',
2403+ ('--desktop_file_hint='
2404+ '/usr/share/applications/camera-app.desktop'),
2405+ ]
2406+ self.app = self.tc.launch_test_application(*args, app_type='qt')
2407+ self.window = CameraWindow(self.app)
2408+
2409+ def take_picture(self):
2410+ """Click on the exposure button to take picture."""
2411+ self._remove_image_files()
2412+
2413+ exposure_button = self.window.get_exposure_button()
2414+ self.tc.assertThat(exposure_button.enabled, Eventually(Equals(True)))
2415+
2416+ LOGGER.debug('Taking picture...')
2417+ self.pointer.move_to_object(exposure_button)
2418+ self.pointer.click()
2419+
2420+ # Wait for image file to be produced before memory usage measurement
2421+ self.tc.assertThat(lambda: glob(self.IMAGE_FILENAME_PATTERN),
2422+ Eventually(HasLength(1)))
2423
2424=== added file 'tests/memevent/ubuntu_test_cases/memory_usage_measurement/apps/gallery.py'
2425--- tests/memevent/ubuntu_test_cases/memory_usage_measurement/apps/gallery.py 1970-01-01 00:00:00 +0000
2426+++ tests/memevent/ubuntu_test_cases/memory_usage_measurement/apps/gallery.py 2013-10-03 23:14:25 +0000
2427@@ -0,0 +1,41 @@
2428+"""Gallery application to write autopilot test cases easily."""
2429+
2430+import os
2431+import shutil
2432+import tempfile
2433+
2434+from ubuntu_test_cases.memory_usage_measurement.apps import App
2435+
2436+
2437+class GalleryApp(App):
2438+
2439+ """Gallery application."""
2440+
2441+ SAMPLE_DIR = '/usr/lib/python2.7/dist-packages/gallery_app/data/default'
2442+
2443+ def __init__(self, tc):
2444+ super(GalleryApp, self).__init__(tc)
2445+ self.temp_sample_dir = None
2446+ self._copy_sample_dir()
2447+
2448+ def _copy_sample_dir(self):
2449+ """Copy sample directory to a temporary location.
2450+
2451+ This is useful to provide some default content.
2452+
2453+ """
2454+ self.temp_sample_dir = tempfile.mkdtemp(prefix='gallery-app-test-')
2455+ self.tc.addCleanup(shutil.rmtree, self.temp_sample_dir)
2456+ self.temp_sample_dir = os.path.join(self.temp_sample_dir, 'data')
2457+ shutil.copytree(self.SAMPLE_DIR, self.temp_sample_dir)
2458+
2459+ def launch(self):
2460+ """Launch the application."""
2461+ args = [
2462+ 'gallery-app',
2463+ ('--desktop_file_hint='
2464+ '/usr/share/applications/gallery-app.desktop'),
2465+ self.temp_sample_dir,
2466+ ]
2467+ self.app = self.tc.launch_test_application(*args,
2468+ app_type='qt')
2469
2470=== added file 'tests/memevent/ubuntu_test_cases/memory_usage_measurement/apps/media_player.py'
2471--- tests/memevent/ubuntu_test_cases/memory_usage_measurement/apps/media_player.py 1970-01-01 00:00:00 +0000
2472+++ tests/memevent/ubuntu_test_cases/memory_usage_measurement/apps/media_player.py 2013-10-03 23:14:25 +0000
2473@@ -0,0 +1,53 @@
2474+"""Media player application to write autopilot test cases easily."""
2475+
2476+import os
2477+
2478+from testtools.matchers import Equals, GreaterThan
2479+
2480+from mediaplayer_app.emulators.main_window import (
2481+ MainWindow as MediaPlayerWindow)
2482+
2483+from ubuntu_test_cases.memory_usage_measurement.apps import App
2484+from ubuntu_test_cases.memory_usage_measurement.matchers import Eventually
2485+
2486+
2487+class MediaPlayerApp(App):
2488+
2489+ """Media player application."""
2490+
2491+ # Default content
2492+ VIDEOS_DIR = 'file:///usr/share/mediaplayer-app/videos/'
2493+
2494+ def assert_playback_finished(self):
2495+ """Media player memory usage after playing a file."""
2496+ time_line = self.window.get_object("Slider", "TimeLine.Slider")
2497+
2498+ # Time line value isn't set to maximum value after playback is finished
2499+ # (LP: #1190555)
2500+ maximum_value = time_line.maximumValue - 2.0
2501+ self.tc.assertThat(time_line.value,
2502+ Eventually(GreaterThan(maximum_value)))
2503+
2504+ def launch(self, movie_file=None):
2505+ """Launch application.
2506+
2507+ :param movie_file:
2508+ Relative path to movie file (uses default content directory as
2509+ root).
2510+ :type movie_file: str
2511+
2512+ """
2513+ binary = 'mediaplayer-app'
2514+ args = [
2515+ binary,
2516+ '--fullscreen',
2517+ ('--desktop_file_hint='
2518+ '/usr/share/applications/mediaplayer-app.desktop'),
2519+ ]
2520+ if movie_file:
2521+ args.insert(1, os.path.join(self.VIDEOS_DIR, movie_file))
2522+
2523+ self.app = self.tc.launch_test_application(*args, app_type='qt')
2524+ self.window = MediaPlayerWindow(self.app)
2525+ self.tc.assertThat(self.window.get_qml_view().visible,
2526+ Eventually(Equals(True)))
2527
2528=== added file 'tests/memevent/ubuntu_test_cases/memory_usage_measurement/matchers.py'
2529--- tests/memevent/ubuntu_test_cases/memory_usage_measurement/matchers.py 1970-01-01 00:00:00 +0000
2530+++ tests/memevent/ubuntu_test_cases/memory_usage_measurement/matchers.py 2013-10-03 23:14:25 +0000
2531@@ -0,0 +1,37 @@
2532+"""Custom matchers used by the tests."""
2533+
2534+from autopilot.matchers import Eventually as EventuallyMatcher
2535+from testtools.matchers import Mismatch
2536+
2537+
2538+def Eventually(matcher):
2539+ """Wrapper around autopilot.matchers.Eventually.
2540+
2541+ The aim of the wrapper is just use a different timeout default
2542+
2543+ :param matcher: A testools-like matcher that tests the desired condition
2544+ :type matcher: object
2545+ :returns: A value depending on the matcher protocol
2546+ :rtype: None | a mismatch object with information about the mismatch
2547+
2548+ """
2549+ return EventuallyMatcher(matcher, timeout=40)
2550+
2551+
2552+class DoesNotChange(object):
2553+ """Match if two consecutive values are equal."""
2554+ def __init__(self):
2555+ self.old_value = None
2556+ self.value = None
2557+
2558+ def __str__(self):
2559+ return 'DoesNotChange()'
2560+
2561+ def match(self, value):
2562+ self.old_value = self.value
2563+ self.value = value
2564+ if self.value != self.old_value:
2565+ return Mismatch('Current value ({}) does not match old value ({})'
2566+ .format(self.value, self.old_value))
2567+
2568+ return None
2569
2570=== added file 'tests/memevent/ubuntu_test_cases/memory_usage_measurement/probes.py'
2571--- tests/memevent/ubuntu_test_cases/memory_usage_measurement/probes.py 1970-01-01 00:00:00 +0000
2572+++ tests/memevent/ubuntu_test_cases/memory_usage_measurement/probes.py 2013-10-03 23:14:25 +0000
2573@@ -0,0 +1,170 @@
2574+"""Probes used to take measurements4 while the tests are executed."""
2575+
2576+import itertools
2577+import logging
2578+import os
2579+import re
2580+import subprocess
2581+
2582+from contextlib import contextmanager
2583+from time import time
2584+
2585+LOGGER = logging.getLogger(__file__)
2586+
2587+
2588+class SmemProbe(object):
2589+
2590+ """Memory usage probe."""
2591+
2592+ BINARY = os.path.join(os.path.dirname(__file__), 'smem-tabs')
2593+ THRESHOLDS = {
2594+ 'foreground': 262144, # 256MB
2595+ 'background': 131072, # 128MB
2596+ }
2597+
2598+ def __init__(self):
2599+ self.pids = [] # List of pids that should be monitored
2600+ self.readings = [] # List of readings
2601+ self.current_reading = None
2602+ self.threshold_exceeded_summary = []
2603+
2604+ @contextmanager
2605+ def probe(self, event):
2606+ """Run start and stop methods in a contex manager."""
2607+ self.start(event)
2608+ yield
2609+ self.stop(event)
2610+
2611+ def start(self, event):
2612+ """Start measurement.
2613+
2614+ This method is not actually used, but defined to be consistent with the
2615+ probes API.
2616+
2617+ :param event: Event name
2618+ :type event: str
2619+ :returns: None
2620+
2621+ """
2622+ LOGGER.debug('smem start: {}'.format(event))
2623+ self.current_reading = {
2624+ 'event': event,
2625+ 'start_time': time(),
2626+ }
2627+
2628+ def stop(self, event):
2629+ """Stop measurement.
2630+
2631+ Run smem and get memory usage for a given set PIDs.
2632+
2633+ :param event: Event name
2634+ :type event: str
2635+ :returns: None
2636+
2637+ """
2638+ LOGGER.debug('smem stop: {}'.format(event))
2639+ LOGGER.debug('Running {!r}...'.format(self.BINARY))
2640+ output = subprocess.check_output(self.BINARY)
2641+ parser = SmemParser()
2642+ pids_info = parser.parse(output)
2643+ threshold_exceeded_pids = self._calculate_threshold_exceeded(pids_info)
2644+ print '{:-^72}'.format(event)
2645+ for pid in self.pids:
2646+ print('PID: {pid}, command: {command}, PSS: {pss}, USS: {uss}'
2647+ .format(**pids_info[pid]))
2648+
2649+ self.current_reading['stop_time'] = time()
2650+ self.current_reading['data'] = pids_info
2651+ self.readings.append(self.current_reading)
2652+ if threshold_exceeded_pids:
2653+ self.threshold_exceeded_summary.append(
2654+ (event, threshold_exceeded_pids))
2655+ self.current_reading = None
2656+
2657+ def _calculate_threshold_exceeded(self, pids_info):
2658+ """Calculate thresholds for the given set of pids.
2659+
2660+ :param pids_info:
2661+ Memory usage data for a give set of pids.
2662+
2663+ ..note::
2664+ This parameter is modified in place to add a delta of the PSS
2665+ and the threshold.
2666+ :type pids_info: list(dict)
2667+
2668+ """
2669+ # It's assumed that the pid for the foreground application is the one
2670+ # that was last added to the probe
2671+ foreground_pid = self.pids[-1]
2672+ foreground_threshold = self.THRESHOLDS['foreground']
2673+ background_pids = self.pids[:-1]
2674+ background_threshold = self.THRESHOLDS['background']
2675+
2676+ pids_and_thresholds = itertools.chain(
2677+ [(foreground_pid, foreground_threshold)],
2678+ itertools.product(background_pids, [background_threshold]))
2679+
2680+ threshold_exceeded_pids = []
2681+ for pid, threshold in pids_and_thresholds:
2682+ if pid in pids_info:
2683+ pid_info = pids_info[pid]
2684+ delta = pid_info['pss'] - threshold
2685+ pid_info['threshold_exceeded'] = delta
2686+ if delta > 0:
2687+ threshold_exceeded_pids.append(pid)
2688+ return threshold_exceeded_pids
2689+
2690+ @property
2691+ def report(self):
2692+ """Return report with all the readings that have been made."""
2693+ return {'pids': self.pids,
2694+ 'thresholds': self.THRESHOLDS,
2695+ 'readings': self.readings}
2696+
2697+
2698+class SmemParser(object):
2699+
2700+ """Parser object to map smem output to data structure."""
2701+
2702+ SMEM_LINE = re.compile(
2703+ r'\s*(?P<pid>\d+)'
2704+ r'\s+(?P<user>\w+)'
2705+ r'\s+(?P<command>.+?)'
2706+ r'\s+(?P<swap>\d+)'
2707+ r'\s+(?P<uss>\d+)'
2708+ r'\s+(?P<pss>\d+)'
2709+ r'\s+(?P<rss>\d+)')
2710+
2711+ def parse(self, output):
2712+ """Parse smem output.
2713+
2714+ :param output: The report printed to stdout by smem
2715+ :type output: str
2716+ :returns: Data structure that can be serialized
2717+ :rtype: dict(dict)
2718+
2719+ """
2720+ pids_info = filter(None,
2721+ [self._parse_line(line)
2722+ for line in output.splitlines()[1:]])
2723+ return {pid_info['pid']: pid_info for pid_info in pids_info}
2724+
2725+ def _parse_line(self, line):
2726+ """Parse a single smem output line.
2727+
2728+ :param line:
2729+ A single line containing all the fields to parse for a process.
2730+ :type line: str
2731+ :returns: Data structure with the parsed fields
2732+ :rtype: dict
2733+
2734+ """
2735+ match = self.SMEM_LINE.match(line)
2736+ if not match:
2737+ LOGGER.warning('Unable to parse smem output: {}'.format(line))
2738+ return None
2739+
2740+ pid_info = match.groupdict()
2741+ for key in ('pid', 'swap', 'uss', 'pss', 'rss'):
2742+ pid_info[key] = int(pid_info[key])
2743+ return pid_info
2744
2745=== added file 'tests/memevent/ubuntu_test_cases/memory_usage_measurement/smem-tabs'
2746--- tests/memevent/ubuntu_test_cases/memory_usage_measurement/smem-tabs 1970-01-01 00:00:00 +0000
2747+++ tests/memevent/ubuntu_test_cases/memory_usage_measurement/smem-tabs 2013-10-03 23:14:25 +0000
2748@@ -0,0 +1,687 @@
2749+#!/usr/bin/env python
2750+#
2751+# smem - a tool for meaningful memory reporting
2752+#
2753+# Copyright 2008-2009 Matt Mackall <mpm@selenic.com>
2754+#
2755+# This software may be used and distributed according to the terms of
2756+# the GNU General Public License version 2 or later, incorporated
2757+# herein by reference.
2758+
2759+import re, os, sys, pwd, optparse, errno, tarfile
2760+
2761+warned = False
2762+
2763+class procdata(object):
2764+ def __init__(self, source):
2765+ self._ucache = {}
2766+ self._gcache = {}
2767+ self.source = source and source or ""
2768+ self._memdata = None
2769+ def _list(self):
2770+ return os.listdir(self.source + "/proc")
2771+ def _read(self, f):
2772+ return file(self.source + '/proc/' + f).read()
2773+ def _readlines(self, f):
2774+ return self._read(f).splitlines(True)
2775+ def _stat(self, f):
2776+ return os.stat(self.source + "/proc/" + f)
2777+
2778+ def pids(self):
2779+ '''get a list of processes'''
2780+ return [int(e) for e in self._list()
2781+ if e.isdigit() and not iskernel(e)]
2782+ def mapdata(self, pid):
2783+ return self._readlines('%s/smaps' % pid)
2784+ def memdata(self):
2785+ if self._memdata is None:
2786+ self._memdata = self._readlines('meminfo')
2787+ return self._memdata
2788+ def version(self):
2789+ return self._readlines('version')[0]
2790+ def pidname(self, pid):
2791+ try:
2792+ l = self.pidcmd(pid).split(' ')[0]
2793+ return os.path.basename(l)
2794+ except:
2795+ return '?'
2796+ def pidcmd(self, pid):
2797+ try:
2798+ c = self._read('%s/cmdline' % pid)[:-1]
2799+ return c.replace('\0', ' ')
2800+ except:
2801+ return '?'
2802+ def piduser(self, pid):
2803+ try:
2804+ return self._stat('%d' % pid).st_uid
2805+ except:
2806+ return -1
2807+ def pidgroup(self, pid):
2808+ try:
2809+ return self._stat('%d' % pid).st_gid
2810+ except:
2811+ return -1
2812+ def username(self, uid):
2813+ if uid == -1:
2814+ return '?'
2815+ if uid not in self._ucache:
2816+ try:
2817+ self._ucache[uid] = pwd.getpwuid(uid)[0]
2818+ except KeyError:
2819+ self._ucache[uid] = str(uid)
2820+ return self._ucache[uid]
2821+ def groupname(self, gid):
2822+ if gid == -1:
2823+ return '?'
2824+ if gid not in self._gcache:
2825+ try:
2826+ self._gcache[gid] = pwd.getgrgid(gid)[0]
2827+ except KeyError:
2828+ self._gcache[gid] = str(gid)
2829+ return self._gcache[gid]
2830+
2831+class tardata(procdata):
2832+ def __init__(self, source):
2833+ procdata.__init__(self, source)
2834+ self.tar = tarfile.open(source)
2835+ def _list(self):
2836+ for ti in self.tar:
2837+ if ti.name.endswith('/smaps'):
2838+ d,f = ti.name.split('/')
2839+ yield d
2840+ def _read(self, f):
2841+ return self.tar.extractfile(f).read()
2842+ def _readlines(self, f):
2843+ return self.tar.extractfile(f).readlines()
2844+ def piduser(self, p):
2845+ t = self.tar.getmember("%d" % p)
2846+ if t.uname:
2847+ self._ucache[t.uid] = t.uname
2848+ return t.uid
2849+ def pidgroup(self, p):
2850+ t = self.tar.getmember("%d" % p)
2851+ if t.gname:
2852+ self._gcache[t.gid] = t.gname
2853+ return t.gid
2854+ def username(self, u):
2855+ return self._ucache.get(u, str(u))
2856+ def groupname(self, g):
2857+ return self._gcache.get(g, str(g))
2858+
2859+_totalmem = 0
2860+def totalmem():
2861+ global _totalmem
2862+ if not _totalmem:
2863+ if options.realmem:
2864+ _totalmem = fromunits(options.realmem) / 1024
2865+ else:
2866+ _totalmem = memory()['memtotal']
2867+ return _totalmem
2868+
2869+_kernelsize = 0
2870+def kernelsize():
2871+ global _kernelsize
2872+ if not _kernelsize and options.kernel:
2873+ try:
2874+ d = os.popen("size %s" % options.kernel).readlines()[1]
2875+ _kernelsize = int(d.split()[3]) / 1024
2876+ except:
2877+ try:
2878+ # try some heuristic to find gzipped part in kernel image
2879+ packedkernel = open(options.kernel).read()
2880+ pos = packedkernel.find('\x1F\x8B')
2881+ if pos >= 0 and pos < 25000:
2882+ sys.stderr.write("Maybe uncompressed kernel can be extracted by the command:\n"
2883+ " dd if=%s bs=1 skip=%d | gzip -d >%s.unpacked\n\n" % (options.kernel, pos, options.kernel))
2884+ except:
2885+ pass
2886+ sys.stderr.write("Parameter '%s' should be an original uncompressed compiled kernel file.\n\n" % options.kernel)
2887+ return _kernelsize
2888+
2889+def pidmaps(pid):
2890+ global warned
2891+ maps = {}
2892+ start = None
2893+ seen = False
2894+ for l in src.mapdata(pid):
2895+ f = l.split()
2896+ if f[-1] == 'kB':
2897+ if f[0].startswith('Pss'):
2898+ seen = True
2899+ maps[start][f[0][:-1].lower()] = int(f[1])
2900+ elif f[0] == 'VmFlags:':
2901+ continue
2902+ else:
2903+ start, end = f[0].split('-')
2904+ start = int(start, 16)
2905+ name = "<anonymous>"
2906+ if len(f) > 5:
2907+ name = f[5]
2908+ maps[start] = dict(end=int(end, 16), mode=f[1],
2909+ offset=int(f[2], 16),
2910+ device=f[3], inode=f[4], name=name)
2911+
2912+ if not seen and not warned:
2913+ sys.stderr.write('warning: kernel does not appear to support PSS measurement\n')
2914+ warned = True
2915+ if not options.sort:
2916+ options.sort = 'rss'
2917+
2918+ if options.mapfilter:
2919+ f = {}
2920+ for m in maps:
2921+ if not filter(options.mapfilter, m, lambda x: maps[x]['name']):
2922+ f[m] = maps[m]
2923+ return f
2924+
2925+ return maps
2926+
2927+def sortmaps(totals, key):
2928+ l = []
2929+ for pid in totals:
2930+ l.append((totals[pid][key], pid))
2931+ l.sort()
2932+ return [pid for pid,key in l]
2933+
2934+def iskernel(pid):
2935+ return src.pidcmd(pid) == ""
2936+
2937+def memory():
2938+ t = {}
2939+ f = re.compile('(\\S+):\\s+(\\d+) kB')
2940+ for l in src.memdata():
2941+ m = f.match(l)
2942+ if m:
2943+ t[m.group(1).lower()] = int(m.group(2))
2944+ return t
2945+
2946+def units(x):
2947+ s = ''
2948+ if x == 0:
2949+ return '0'
2950+ for s in ('', 'K', 'M', 'G', 'T'):
2951+ if x < 1024:
2952+ break
2953+ x /= 1024.0
2954+ return "%.1f%s" % (x, s)
2955+
2956+def fromunits(x):
2957+ s = dict(k=2**10, K=2**10, kB=2**10, KB=2**10,
2958+ M=2**20, MB=2**20, G=2**30, GB=2**30,
2959+ T=2**40, TB=2**40)
2960+ for k,v in s.items():
2961+ if x.endswith(k):
2962+ return int(float(x[:-len(k)])*v)
2963+ sys.stderr.write("Memory size should be written with units, for example 1024M\n")
2964+ sys.exit(-1)
2965+
2966+def pidusername(pid):
2967+ return src.username(src.piduser(pid))
2968+
2969+def showamount(a, total):
2970+ if options.abbreviate:
2971+ return units(a * 1024)
2972+ elif options.percent:
2973+ return "%.2f%%" % (100.0 * a / total)
2974+ return a
2975+
2976+def filter(opt, arg, *sources):
2977+ if not opt:
2978+ return False
2979+
2980+ for f in sources:
2981+ if re.search(opt, f(arg)):
2982+ return False
2983+ return True
2984+
2985+def pidtotals(pid):
2986+ maps = pidmaps(pid)
2987+ t = dict(size=0, rss=0, pss=0, shared_clean=0, shared_dirty=0,
2988+ private_clean=0, private_dirty=0, referenced=0, swap=0)
2989+ for m in maps.iterkeys():
2990+ for k in t:
2991+ t[k] += maps[m].get(k, 0)
2992+
2993+ t['uss'] = t['private_clean'] + t['private_dirty']
2994+ t['maps'] = len(maps)
2995+
2996+ return t
2997+
2998+def processtotals(pids):
2999+ totals = {}
3000+ for pid in pids:
3001+ if (filter(options.processfilter, pid, src.pidname, src.pidcmd) or
3002+ filter(options.userfilter, pid, pidusername)):
3003+ continue
3004+ try:
3005+ p = pidtotals(pid)
3006+ if p['maps'] != 0:
3007+ totals[pid] = p
3008+ except:
3009+ continue
3010+ return totals
3011+
3012+def showpids():
3013+ p = src.pids()
3014+ pt = processtotals(p)
3015+
3016+ def showuser(p):
3017+ if options.numeric:
3018+ return src.piduser(p)
3019+ return pidusername(p)
3020+
3021+ fields = dict(
3022+ pid=('PID', lambda n: n, '% 5s', lambda x: len(pt),
3023+ 'process ID'),
3024+ user=('User', showuser, '%-8s', lambda x: len(dict.fromkeys(x)),
3025+ 'owner of process'),
3026+ name=('Name', src.pidname, '%s', None,
3027+ 'name of process'),
3028+ command=('Command', src.pidcmd, '%s', None,
3029+ 'process command line'),
3030+ maps=('Maps',lambda n: pt[n]['maps'], '% 5s', sum,
3031+ 'total number of mappings'),
3032+ swap=('Swap',lambda n: pt[n]['swap'], '% 8a', sum,
3033+ 'amount of swap space consumed (ignoring sharing)'),
3034+ uss=('USS', lambda n: pt[n]['uss'], '%a', sum,
3035+ 'unique set size'),
3036+ rss=('RSS', lambda n: pt[n]['rss'], '%a', sum,
3037+ 'resident set size (ignoring sharing)'),
3038+ pss=('PSS', lambda n: pt[n]['pss'], '%a', sum,
3039+ 'proportional set size (including sharing)'),
3040+ vss=('VSS', lambda n: pt[n]['size'], '%a', sum,
3041+ 'virtual set size (total virtual memory mapped)'),
3042+ )
3043+ columns = options.columns or 'pid user command swap uss pss rss'
3044+
3045+ showtable(pt.keys(), fields, columns.split(), options.sort or 'pss')
3046+
3047+def maptotals(pids):
3048+ totals = {}
3049+ for pid in pids:
3050+ if (filter(options.processfilter, pid, src.pidname, src.pidcmd) or
3051+ filter(options.userfilter, pid, pidusername)):
3052+ continue
3053+ try:
3054+ maps = pidmaps(pid)
3055+ seen = {}
3056+ for m in maps.iterkeys():
3057+ name = maps[m]['name']
3058+ if name not in totals:
3059+ t = dict(size=0, rss=0, pss=0, shared_clean=0,
3060+ shared_dirty=0, private_clean=0, count=0,
3061+ private_dirty=0, referenced=0, swap=0, pids=0)
3062+ else:
3063+ t = totals[name]
3064+
3065+ for k in t:
3066+ t[k] += maps[m].get(k, 0)
3067+ t['count'] += 1
3068+ if name not in seen:
3069+ t['pids'] += 1
3070+ seen[name] = 1
3071+ totals[name] = t
3072+ except EnvironmentError:
3073+ continue
3074+ return totals
3075+
3076+def showmaps():
3077+ p = src.pids()
3078+ pt = maptotals(p)
3079+
3080+ fields = dict(
3081+ map=('Map', lambda n: n, '%-40.40s', len,
3082+ 'mapping name'),
3083+ count=('Count', lambda n: pt[n]['count'], '% 5s', sum,
3084+ 'number of mappings found'),
3085+ pids=('PIDs', lambda n: pt[n]['pids'], '% 5s', sum,
3086+ 'number of PIDs using mapping'),
3087+ swap=('Swap',lambda n: pt[n]['swap'], '% 8a', sum,
3088+ 'amount of swap space consumed (ignoring sharing)'),
3089+ uss=('USS', lambda n: pt[n]['private_clean']
3090+ + pt[n]['private_dirty'], '% 8a', sum,
3091+ 'unique set size'),
3092+ rss=('RSS', lambda n: pt[n]['rss'], '% 8a', sum,
3093+ 'resident set size (ignoring sharing)'),
3094+ pss=('PSS', lambda n: pt[n]['pss'], '% 8a', sum,
3095+ 'proportional set size (including sharing)'),
3096+ vss=('VSS', lambda n: pt[n]['size'], '% 8a', sum,
3097+ 'virtual set size (total virtual address space mapped)'),
3098+ avgpss=('AVGPSS', lambda n: int(1.0 * pt[n]['pss']/pt[n]['pids']),
3099+ '% 8a', sum,
3100+ 'average PSS per PID'),
3101+ avguss=('AVGUSS', lambda n: int(1.0 * pt[n]['uss']/pt[n]['pids']),
3102+ '% 8a', sum,
3103+ 'average USS per PID'),
3104+ avgrss=('AVGRSS', lambda n: int(1.0 * pt[n]['rss']/pt[n]['pids']),
3105+ '% 8a', sum,
3106+ 'average RSS per PID'),
3107+ )
3108+ columns = options.columns or 'map pids avgpss pss'
3109+
3110+ showtable(pt.keys(), fields, columns.split(), options.sort or 'pss')
3111+
3112+def usertotals(pids):
3113+ totals = {}
3114+ for pid in pids:
3115+ if (filter(options.processfilter, pid, src.pidname, src.pidcmd) or
3116+ filter(options.userfilter, pid, pidusername)):
3117+ continue
3118+ try:
3119+ maps = pidmaps(pid)
3120+ if len(maps) == 0:
3121+ continue
3122+ except EnvironmentError:
3123+ continue
3124+ user = src.piduser(pid)
3125+ if user not in totals:
3126+ t = dict(size=0, rss=0, pss=0, shared_clean=0,
3127+ shared_dirty=0, private_clean=0, count=0,
3128+ private_dirty=0, referenced=0, swap=0)
3129+ else:
3130+ t = totals[user]
3131+
3132+ for m in maps.iterkeys():
3133+ for k in t:
3134+ t[k] += maps[m].get(k, 0)
3135+
3136+ t['count'] += 1
3137+ totals[user] = t
3138+ return totals
3139+
3140+def showusers():
3141+ p = src.pids()
3142+ pt = usertotals(p)
3143+
3144+ def showuser(u):
3145+ if options.numeric:
3146+ return u
3147+ return src.username(u)
3148+
3149+ fields = dict(
3150+ user=('User', showuser, '%-8s', None,
3151+ 'user name or ID'),
3152+ count=('Count', lambda n: pt[n]['count'], '% 5s', sum,
3153+ 'number of processes'),
3154+ swap=('Swap',lambda n: pt[n]['swap'], '% 8a', sum,
3155+ 'amount of swapspace consumed (ignoring sharing)'),
3156+ uss=('USS', lambda n: pt[n]['private_clean']
3157+ + pt[n]['private_dirty'], '% 8a', sum,
3158+ 'unique set size'),
3159+ rss=('RSS', lambda n: pt[n]['rss'], '% 8a', sum,
3160+ 'resident set size (ignoring sharing)'),
3161+ pss=('PSS', lambda n: pt[n]['pss'], '% 8a', sum,
3162+ 'proportional set size (including sharing)'),
3163+ vss=('VSS', lambda n: pt[n]['pss'], '% 8a', sum,
3164+ 'virtual set size (total virtual memory mapped)'),
3165+ )
3166+ columns = options.columns or 'user count swap uss pss rss'
3167+
3168+ showtable(pt.keys(), fields, columns.split(), options.sort or 'pss')
3169+
3170+def showsystem():
3171+ t = totalmem()
3172+ ki = kernelsize()
3173+ m = memory()
3174+
3175+ mt = m['memtotal']
3176+ f = m['memfree']
3177+
3178+ # total amount used by hardware
3179+ fh = max(t - mt - ki, 0)
3180+
3181+ # total amount mapped into userspace (ie mapped an unmapped pages)
3182+ u = m['anonpages'] + m['mapped']
3183+
3184+ # total amount allocated by kernel not for userspace
3185+ kd = mt - f - u
3186+
3187+ # total amount in kernel caches
3188+ kdc = m['buffers'] + m['sreclaimable'] + (m['cached'] - m['mapped'])
3189+
3190+ l = [("firmware/hardware", fh, 0),
3191+ ("kernel image", ki, 0),
3192+ ("kernel dynamic memory", kd, kdc),
3193+ ("userspace memory", u, m['mapped']),
3194+ ("free memory", f, f)]
3195+
3196+ fields = dict(
3197+ order=('Order', lambda n: n, '% 1s', lambda x: '',
3198+ 'hierarchical order'),
3199+ area=('Area', lambda n: l[n][0], '%-24s', lambda x: '',
3200+ 'memory area'),
3201+ used=('Used', lambda n: l[n][1], '%10a', sum,
3202+ 'area in use'),
3203+ cache=('Cache', lambda n: l[n][2], '%10a', sum,
3204+ 'area used as reclaimable cache'),
3205+ noncache=('Noncache', lambda n: l[n][1] - l[n][2], '%10a', sum,
3206+ 'area not reclaimable'))
3207+
3208+ columns = options.columns or 'area used cache noncache'
3209+ showtable(range(len(l)), fields, columns.split(), options.sort or 'order')
3210+
3211+def showfields(fields, f):
3212+ if f != list:
3213+ print "unknown field", f
3214+ print "known fields:"
3215+ for l in sorted(fields.keys()):
3216+ print "%-8s %s" % (l, fields[l][-1])
3217+
3218+def showtable(rows, fields, columns, sort):
3219+ header = ""
3220+ format = ""
3221+ formatter = []
3222+
3223+ if sort not in fields:
3224+ showfields(fields, sort)
3225+ sys.exit(-1)
3226+
3227+ if options.pie:
3228+ columns.append(options.pie)
3229+ if options.bar:
3230+ columns.append(options.bar)
3231+
3232+ mt = totalmem()
3233+ st = memory()['swaptotal']
3234+
3235+ for n in columns:
3236+ if n not in fields:
3237+ showfields(fields, n)
3238+ sys.exit(-1)
3239+
3240+ f = fields[n][2]
3241+ if 'a' in f:
3242+ if n == 'swap':
3243+ formatter.append(lambda x: showamount(x, st))
3244+ else:
3245+ formatter.append(lambda x: showamount(x, mt))
3246+ f = f.replace('a', 's')
3247+ else:
3248+ formatter.append(lambda x: x)
3249+ format += f + "\t"
3250+ header += f % fields[n][0] + "\t"
3251+
3252+ l = []
3253+ for n in rows:
3254+ r = [fields[c][1](n) for c in columns]
3255+ l.append((fields[sort][1](n), r))
3256+
3257+ l.sort(reverse=bool(options.reverse))
3258+
3259+ if options.pie:
3260+ showpie(l, sort)
3261+ return
3262+ elif options.bar:
3263+ showbar(l, columns, sort)
3264+ return
3265+
3266+ if not options.no_header:
3267+ print header
3268+
3269+ for k,r in l:
3270+ print format % tuple([f(v) for f,v in zip(formatter, r)])
3271+
3272+ if options.totals:
3273+ # totals
3274+ t = []
3275+ for c in columns:
3276+ f = fields[c][3]
3277+ if f:
3278+ t.append(f([fields[c][1](n) for n in rows]))
3279+ else:
3280+ t.append("")
3281+
3282+ print "-" * len(header)
3283+ print format % tuple([f(v) for f,v in zip(formatter, t)])
3284+
3285+def showpie(l, sort):
3286+ try:
3287+ import pylab
3288+ except ImportError:
3289+ sys.stderr.write("pie chart requires matplotlib\n")
3290+ sys.exit(-1)
3291+
3292+ if (l[0][0] < l[-1][0]):
3293+ l.reverse()
3294+
3295+ labels = [r[1][-1] for r in l]
3296+ values = [r[0] for r in l] # sort field
3297+
3298+ tm = totalmem()
3299+ s = sum(values)
3300+ unused = tm - s
3301+ t = 0
3302+ while values and (t + values[-1] < (tm * .02) or
3303+ values[-1] < (tm * .005)):
3304+ t += values.pop()
3305+ labels.pop()
3306+
3307+ if t:
3308+ values.append(t)
3309+ labels.append('other')
3310+
3311+ explode = [0] * len(values)
3312+ if unused > 0:
3313+ values.insert(0, unused)
3314+ labels.insert(0, 'unused')
3315+ explode.insert(0, .05)
3316+
3317+ pylab.figure(1, figsize=(6,6))
3318+ ax = pylab.axes([0.1, 0.1, 0.8, 0.8])
3319+ pylab.pie(values, explode = explode, labels=labels,
3320+ autopct="%.2f%%", shadow=True)
3321+ pylab.title('%s by %s' % (options.pie, sort))
3322+ pylab.show()
3323+
3324+def showbar(l, columns, sort):
3325+ try:
3326+ import pylab, numpy
3327+ except ImportError:
3328+ sys.stderr.write("bar chart requires matplotlib\n")
3329+ sys.exit(-1)
3330+
3331+ if (l[0][0] < l[-1][0]):
3332+ l.reverse()
3333+
3334+ rc = []
3335+ key = []
3336+ for n in range(len(columns) - 1):
3337+ try:
3338+ if columns[n] in 'pid user group'.split():
3339+ continue
3340+ float(l[0][1][n])
3341+ rc.append(n)
3342+ key.append(columns[n])
3343+ except:
3344+ pass
3345+
3346+ width = 1.0 / (len(rc) + 1)
3347+ offset = width / 2
3348+
3349+ def gc(n):
3350+ return 'bgrcmyw'[n % 7]
3351+
3352+ pl = []
3353+ ind = numpy.arange(len(l))
3354+ for n in xrange(len(rc)):
3355+ pl.append(pylab.bar(ind + offset + width * n,
3356+ [x[1][rc[n]] for x in l], width, color=gc(n)))
3357+
3358+ #plt.xticks(ind + .5, )
3359+ pylab.gca().set_xticks(ind + .5)
3360+ pylab.gca().set_xticklabels([x[1][-1] for x in l], rotation=45)
3361+ pylab.legend([p[0] for p in pl], key)
3362+ pylab.show()
3363+
3364+
3365+parser = optparse.OptionParser("%prog [options]")
3366+parser.add_option("-H", "--no-header", action="store_true",
3367+ help="disable header line")
3368+parser.add_option("-c", "--columns", type="str",
3369+ help="columns to show")
3370+parser.add_option("-t", "--totals", action="store_true",
3371+ help="show totals")
3372+
3373+parser.add_option("-R", "--realmem", type="str",
3374+ help="amount of physical RAM")
3375+parser.add_option("-K", "--kernel", type="str",
3376+ help="path to kernel image")
3377+
3378+parser.add_option("-m", "--mappings", action="store_true",
3379+ help="show mappings")
3380+parser.add_option("-u", "--users", action="store_true",
3381+ help="show users")
3382+parser.add_option("-w", "--system", action="store_true",
3383+ help="show whole system")
3384+
3385+parser.add_option("-P", "--processfilter", type="str",
3386+ help="process filter regex")
3387+parser.add_option("-M", "--mapfilter", type="str",
3388+ help="map filter regex")
3389+parser.add_option("-U", "--userfilter", type="str",
3390+ help="user filter regex")
3391+
3392+parser.add_option("-n", "--numeric", action="store_true",
3393+ help="numeric output")
3394+parser.add_option("-s", "--sort", type="str",
3395+ help="field to sort on")
3396+parser.add_option("-r", "--reverse", action="store_true",
3397+ help="reverse sort")
3398+
3399+parser.add_option("-p", "--percent", action="store_true",
3400+ help="show percentage")
3401+parser.add_option("-k", "--abbreviate", action="store_true",
3402+ help="show unit suffixes")
3403+
3404+parser.add_option("", "--pie", type='str',
3405+ help="show pie graph")
3406+parser.add_option("", "--bar", type='str',
3407+ help="show bar graph")
3408+
3409+parser.add_option("-S", "--source", type="str",
3410+ help="/proc data source")
3411+
3412+
3413+defaults = {}
3414+parser.set_defaults(**defaults)
3415+(options, args) = parser.parse_args()
3416+
3417+try:
3418+ src = tardata(options.source)
3419+except:
3420+ src = procdata(options.source)
3421+
3422+try:
3423+ if options.mappings:
3424+ showmaps()
3425+ elif options.users:
3426+ showusers()
3427+ elif options.system:
3428+ showsystem()
3429+ else:
3430+ showpids()
3431+except IOError, e:
3432+ if e.errno == errno.EPIPE:
3433+ pass
3434+except KeyboardInterrupt:
3435+ pass
3436
3437=== added directory 'tests/memevent/ubuntu_test_cases/memory_usage_measurement/tests'
3438=== added file 'tests/memevent/ubuntu_test_cases/memory_usage_measurement/tests/__init__.py'
3439--- tests/memevent/ubuntu_test_cases/memory_usage_measurement/tests/__init__.py 1970-01-01 00:00:00 +0000
3440+++ tests/memevent/ubuntu_test_cases/memory_usage_measurement/tests/__init__.py 2013-10-03 23:14:25 +0000
3441@@ -0,0 +1,1 @@
3442+"""Event based memory usage measurements test cases."""
3443
3444=== added file 'tests/memevent/ubuntu_test_cases/memory_usage_measurement/tests/test_memory_usage.py'
3445--- tests/memevent/ubuntu_test_cases/memory_usage_measurement/tests/test_memory_usage.py 1970-01-01 00:00:00 +0000
3446+++ tests/memevent/ubuntu_test_cases/memory_usage_measurement/tests/test_memory_usage.py 2013-10-03 23:14:25 +0000
3447@@ -0,0 +1,81 @@
3448+"""Measure touch applications memory usage."""
3449+
3450+import json
3451+import logging
3452+import os
3453+
3454+from autopilot.testcase import AutopilotTestCase
3455+
3456+from ubuntu_test_cases.memory_usage_measurement.apps.browser import BrowserApp
3457+from ubuntu_test_cases.memory_usage_measurement.apps.camera import CameraApp
3458+from ubuntu_test_cases.memory_usage_measurement.apps.gallery import GalleryApp
3459+from ubuntu_test_cases.memory_usage_measurement.apps.media_player import (
3460+ MediaPlayerApp,
3461+)
3462+from ubuntu_test_cases.memory_usage_measurement.probes import SmemProbe
3463+
3464+LOGGER = logging.getLogger(__file__)
3465+
3466+
3467+class MemoryUsageTests(AutopilotTestCase):
3468+
3469+ """Event based memory usage measurement scenario."""
3470+
3471+ def test_scenario(self):
3472+ """Scenario that takes measurements on some events."""
3473+ self.smem = SmemProbe()
3474+
3475+ # Make sure report is written with the data collected
3476+ # even if the test failed to complete
3477+ self.addCleanup(self._write_report)
3478+
3479+ browser = BrowserApp(self)
3480+ with self.smem.probe('Browser started'):
3481+ browser.launch()
3482+ self.smem.pids.append(browser.app.pid)
3483+
3484+ with self.smem.probe('Browser finished loading'):
3485+ url = 'http://acid3.acidtests.org/'
3486+ browser.go_to_url(url)
3487+ browser.assert_page_eventually_loaded(url)
3488+
3489+ camera = CameraApp(self)
3490+ with self.smem.probe('Camera app started'):
3491+ camera.launch()
3492+ self.smem.pids.append(camera.app.pid)
3493+
3494+ with self.smem.probe('Camera app picture taken'):
3495+ camera.take_picture()
3496+
3497+ with self.smem.probe('Gallery app started'):
3498+ gallery = GalleryApp(self)
3499+ gallery.launch()
3500+ self.smem.pids.append(gallery.app.pid)
3501+
3502+ with self.smem.probe('Media player app started'):
3503+ media_player = MediaPlayerApp(self)
3504+ media_player.launch()
3505+ self.smem.pids.append(media_player.app.pid)
3506+
3507+ with self.smem.probe('Media player app finished playback'):
3508+ media_player = MediaPlayerApp(self)
3509+ media_player.launch('small.mp4')
3510+ self.smem.pids.append(media_player.app.pid)
3511+ media_player.assert_playback_finished()
3512+
3513+ summary_msg = '\n'.join(
3514+ ['- {}: {}'.format(event, pids)
3515+ for event, pids in self.smem.threshold_exceeded_summary])
3516+ self.assertListEqual(
3517+ self.smem.threshold_exceeded_summary,
3518+ [],
3519+ 'Threshold(s) exceded:\n{}'.format(summary_msg))
3520+
3521+ def _write_report(self):
3522+ """Write report to to results directory."""
3523+ probes_dir = os.environ.get('UTAH_PROBE_DIR', '/tmp')
3524+ report_filename = os.path.join(probes_dir, 'memory_usage.json')
3525+ with open(report_filename, 'w') as report_file:
3526+ json.dump(self.smem.report, report_file,
3527+ indent=4, sort_keys=True)
3528+ LOGGER.debug('Report written to {}'.format(report_file.name))
3529
3530=== added directory 'tests/messaging-app-autopilot'
3531=== added file 'tests/messaging-app-autopilot/master.run'
3532--- tests/messaging-app-autopilot/master.run 1970-01-01 00:00:00 +0000
3533+++ tests/messaging-app-autopilot/master.run 2013-10-03 23:14:25 +0000
3534@@ -0,0 +1,15 @@
3535+---
3536+testsuites:
3537+ - name: settle-before
3538+ fetch_method: dev
3539+ fetch_location: ../systemsettle
3540+ include_tests:
3541+ - systemsettle-before
3542+ - name: messaging-app-autopilot
3543+ fetch_method: dev
3544+ fetch_location: ./
3545+ - name: settle-after
3546+ fetch_method: dev
3547+ fetch_location: ../systemsettle
3548+ include_tests:
3549+ - systemsettle-after
3550
3551=== added file 'tests/messaging-app-autopilot/ts_control'
3552--- tests/messaging-app-autopilot/ts_control 1970-01-01 00:00:00 +0000
3553+++ tests/messaging-app-autopilot/ts_control 2013-10-03 23:14:25 +0000
3554@@ -0,0 +1,1 @@
3555+ts_setup: PKGS="messaging-app-autopilot ubuntu-ui-toolkit-autopilot" prepare-autopilot-test.sh
3556
3557=== added file 'tests/messaging-app-autopilot/tslist.auto'
3558--- tests/messaging-app-autopilot/tslist.auto 1970-01-01 00:00:00 +0000
3559+++ tests/messaging-app-autopilot/tslist.auto 2013-10-03 23:14:25 +0000
3560@@ -0,0 +1,4 @@
3561+-
3562+ discovery_cmd: autopilot-list messaging_app
3563+ test_cmd: autopilot-run messaging_app.tests.{}
3564+
3565
3566=== added directory 'tests/music-app-autopilot'
3567=== added file 'tests/music-app-autopilot/master.run'
3568--- tests/music-app-autopilot/master.run 1970-01-01 00:00:00 +0000
3569+++ tests/music-app-autopilot/master.run 2013-10-03 23:14:25 +0000
3570@@ -0,0 +1,15 @@
3571+---
3572+testsuites:
3573+ - name: settle-before
3574+ fetch_method: dev
3575+ fetch_location: ../systemsettle
3576+ include_tests:
3577+ - systemsettle-before
3578+ - name: music-app-autopilot
3579+ fetch_method: dev
3580+ fetch_location: ./
3581+ - name: settle-after
3582+ fetch_method: dev
3583+ fetch_location: ../systemsettle
3584+ include_tests:
3585+ - systemsettle-after
3586
3587=== added file 'tests/music-app-autopilot/ts_control'
3588--- tests/music-app-autopilot/ts_control 1970-01-01 00:00:00 +0000
3589+++ tests/music-app-autopilot/ts_control 2013-10-03 23:14:25 +0000
3590@@ -0,0 +1,1 @@
3591+ts_setup: PKGS=music-app-autopilot prepare-autopilot-test.sh
3592
3593=== added file 'tests/music-app-autopilot/tslist.auto'
3594--- tests/music-app-autopilot/tslist.auto 1970-01-01 00:00:00 +0000
3595+++ tests/music-app-autopilot/tslist.auto 2013-10-03 23:14:25 +0000
3596@@ -0,0 +1,4 @@
3597+-
3598+ discovery_cmd: autopilot-list music_app
3599+ test_cmd: autopilot-run music_app.tests.{}
3600+
3601
3602=== added directory 'tests/notes-app-autopilot'
3603=== added file 'tests/notes-app-autopilot/master.run'
3604--- tests/notes-app-autopilot/master.run 1970-01-01 00:00:00 +0000
3605+++ tests/notes-app-autopilot/master.run 2013-10-03 23:14:25 +0000
3606@@ -0,0 +1,15 @@
3607+---
3608+testsuites:
3609+ - name: settle-before
3610+ fetch_method: dev
3611+ fetch_location: ../systemsettle
3612+ include_tests:
3613+ - systemsettle-before
3614+ - name: notes-app-autopilot
3615+ fetch_method: dev
3616+ fetch_location: ./
3617+ - name: settle-after
3618+ fetch_method: dev
3619+ fetch_location: ../systemsettle
3620+ include_tests:
3621+ - systemsettle-after
3622
3623=== added file 'tests/notes-app-autopilot/ts_control'
3624--- tests/notes-app-autopilot/ts_control 1970-01-01 00:00:00 +0000
3625+++ tests/notes-app-autopilot/ts_control 2013-10-03 23:14:25 +0000
3626@@ -0,0 +1,1 @@
3627+ts_setup: PKGS=notes-app-autopilot prepare-autopilot-test.sh
3628
3629=== added file 'tests/notes-app-autopilot/tslist.auto'
3630--- tests/notes-app-autopilot/tslist.auto 1970-01-01 00:00:00 +0000
3631+++ tests/notes-app-autopilot/tslist.auto 2013-10-03 23:14:25 +0000
3632@@ -0,0 +1,4 @@
3633+-
3634+ discovery_cmd: autopilot-list notes_app
3635+ test_cmd: autopilot-run notes_app.tests.{}
3636+
3637
3638=== added directory 'tests/sdk'
3639=== added directory 'tests/sdk/check-packages'
3640=== added file 'tests/sdk/check-packages/check-packages.sh'
3641--- tests/sdk/check-packages/check-packages.sh 1970-01-01 00:00:00 +0000
3642+++ tests/sdk/check-packages/check-packages.sh 2013-10-03 23:14:25 +0000
3643@@ -0,0 +1,14 @@
3644+#!/bin/sh
3645+
3646+set -e
3647+
3648+BZR_HOME=/dev/null bzr export tests lp:ubuntu-qtcreator-plugins/tests/device
3649+
3650+if [ -z $TARGET_PREFIX ] ; then
3651+ echo "RUNNING ON TARGET"
3652+ ./tests/check-packages
3653+else
3654+ echo "RUNNING FROM HOST"
3655+ adb push ./tests/check-packages /tmp/
3656+ adb-shell "chmod +x /tmp/check-packages; /tmp/check-packages"
3657+fi
3658
3659=== added file 'tests/sdk/check-packages/tc_control'
3660--- tests/sdk/check-packages/tc_control 1970-01-01 00:00:00 +0000
3661+++ tests/sdk/check-packages/tc_control 2013-10-03 23:14:25 +0000
3662@@ -0,0 +1,9 @@
3663+description: run sdk check-packages test
3664+dependencies: none
3665+action: |
3666+ 1. run check-packages
3667+expected_results: |
3668+ 1. test returns 0
3669+type: userland
3670+timeout: 120
3671+command: ./check-packages.sh
3672
3673=== added file 'tests/sdk/master.run'
3674--- tests/sdk/master.run 1970-01-01 00:00:00 +0000
3675+++ tests/sdk/master.run 2013-10-03 23:14:25 +0000
3676@@ -0,0 +1,5 @@
3677+---
3678+testsuites:
3679+ - name: sdk
3680+ fetch_method: dev
3681+ fetch_location: ./
3682
3683=== added file 'tests/sdk/tslist.run'
3684--- tests/sdk/tslist.run 1970-01-01 00:00:00 +0000
3685+++ tests/sdk/tslist.run 2013-10-03 23:14:25 +0000
3686@@ -0,0 +1,1 @@
3687+- test: check-packages
3688
3689=== added directory 'tests/security'
3690=== added directory 'tests/security/check-apparmor'
3691=== added file 'tests/security/check-apparmor/check-apparmor.sh'
3692--- tests/security/check-apparmor/check-apparmor.sh 1970-01-01 00:00:00 +0000
3693+++ tests/security/check-apparmor/check-apparmor.sh 2013-10-03 23:14:25 +0000
3694@@ -0,0 +1,12 @@
3695+#!/bin/sh
3696+
3697+set -e
3698+
3699+if [ -z $TARGET_PREFIX ] ; then
3700+ echo "RUNNING ON TARGET"
3701+ ../image/privileged/check-apparmor
3702+else
3703+ echo "RUNNING FROM HOST"
3704+ adb push ../image/privileged/check-apparmor /tmp/
3705+ adb-shell "chmod +x /tmp/check-apparmor; /tmp/check-apparmor"
3706+fi
3707
3708=== added file 'tests/security/check-apparmor/tc_control'
3709--- tests/security/check-apparmor/tc_control 1970-01-01 00:00:00 +0000
3710+++ tests/security/check-apparmor/tc_control 2013-10-03 23:14:25 +0000
3711@@ -0,0 +1,9 @@
3712+description: run qa-regression-testing check-apparmor test
3713+dependencies: ufw, apparmor, iptables, bzr
3714+action: |
3715+ 1. run check-apparmor
3716+expected_results: |
3717+ 1. test returns 0
3718+type: userland
3719+timeout: 120
3720+command: ./check-apparmor.sh
3721
3722=== added directory 'tests/security/check-packages'
3723=== added file 'tests/security/check-packages/check-packages.sh'
3724--- tests/security/check-packages/check-packages.sh 1970-01-01 00:00:00 +0000
3725+++ tests/security/check-packages/check-packages.sh 2013-10-03 23:14:25 +0000
3726@@ -0,0 +1,12 @@
3727+#!/bin/sh
3728+
3729+set -e
3730+
3731+if [ -z $TARGET_PREFIX ] ; then
3732+ echo "RUNNING ON TARGET"
3733+ ../image/unprivileged/check-packages
3734+else
3735+ echo "RUNNING FROM HOST"
3736+ adb push ../image/unprivileged/check-packages /tmp/
3737+ adb-shell "chmod +x /tmp/check-packages; /tmp/check-packages"
3738+fi
3739
3740=== added file 'tests/security/check-packages/tc_control'
3741--- tests/security/check-packages/tc_control 1970-01-01 00:00:00 +0000
3742+++ tests/security/check-packages/tc_control 2013-10-03 23:14:25 +0000
3743@@ -0,0 +1,9 @@
3744+description: run qa-regression-testing check-packages test
3745+dependencies: ufw, apparmor, iptables, bzr
3746+action: |
3747+ 1. run check-packages
3748+expected_results: |
3749+ 1. test returns 0
3750+type: userland
3751+timeout: 120
3752+command: ./check-packages.sh
3753
3754=== added directory 'tests/security/check-ufw'
3755=== added file 'tests/security/check-ufw/check-ufw.sh'
3756--- tests/security/check-ufw/check-ufw.sh 1970-01-01 00:00:00 +0000
3757+++ tests/security/check-ufw/check-ufw.sh 2013-10-03 23:14:25 +0000
3758@@ -0,0 +1,12 @@
3759+#!/bin/sh
3760+
3761+set -e
3762+
3763+if [ -z $TARGET_PREFIX ] ; then
3764+ echo "RUNNING ON TARGET"
3765+ ../image/privileged/check-ufw
3766+else
3767+ echo "RUNNING FROM HOST"
3768+ adb push ../image/privileged/check-ufw /tmp/
3769+ adb-shell "chmod +x /tmp/check-ufw; /tmp/check-ufw"
3770+fi
3771
3772=== added file 'tests/security/check-ufw/tc_control'
3773--- tests/security/check-ufw/tc_control 1970-01-01 00:00:00 +0000
3774+++ tests/security/check-ufw/tc_control 2013-10-03 23:14:25 +0000
3775@@ -0,0 +1,9 @@
3776+description: run qa-regression-testing check-ufw test
3777+dependencies: ufw, apparmor, iptables, bzr
3778+action: |
3779+ 1. run check-ufw
3780+expected_results: |
3781+ 1. test returns 0
3782+type: userland
3783+timeout: 120
3784+command: ./check-ufw.sh
3785
3786=== added file 'tests/security/master.run'
3787--- tests/security/master.run 1970-01-01 00:00:00 +0000
3788+++ tests/security/master.run 2013-10-03 23:14:25 +0000
3789@@ -0,0 +1,5 @@
3790+---
3791+testsuites:
3792+ - name: security
3793+ fetch_method: dev
3794+ fetch_location: ./
3795
3796=== added file 'tests/security/ts_control'
3797--- tests/security/ts_control 1970-01-01 00:00:00 +0000
3798+++ tests/security/ts_control 2013-10-03 23:14:25 +0000
3799@@ -0,0 +1,1 @@
3800+ts_setup: BZR_HOME=/dev/null bzr export image lp:qa-regression-testing/tests/image
3801
3802=== added file 'tests/security/tslist.run'
3803--- tests/security/tslist.run 1970-01-01 00:00:00 +0000
3804+++ tests/security/tslist.run 2013-10-03 23:14:25 +0000
3805@@ -0,0 +1,3 @@
3806+- test: check-packages
3807+- test: check-apparmor
3808+- test: check-ufw
3809
3810=== added directory 'tests/share-app-autopilot'
3811=== added file 'tests/share-app-autopilot/master.run'
3812--- tests/share-app-autopilot/master.run 1970-01-01 00:00:00 +0000
3813+++ tests/share-app-autopilot/master.run 2013-10-03 23:14:25 +0000
3814@@ -0,0 +1,15 @@
3815+---
3816+testsuites:
3817+ - name: settle-before
3818+ fetch_method: dev
3819+ fetch_location: ../systemsettle
3820+ include_tests:
3821+ - systemsettle-before
3822+ - name: share-app-autopilot
3823+ fetch_method: dev
3824+ fetch_location: ./
3825+ - name: settle-after
3826+ fetch_method: dev
3827+ fetch_location: ../systemsettle
3828+ include_tests:
3829+ - systemsettle-after
3830
3831=== added file 'tests/share-app-autopilot/ts_control'
3832--- tests/share-app-autopilot/ts_control 1970-01-01 00:00:00 +0000
3833+++ tests/share-app-autopilot/ts_control 2013-10-03 23:14:25 +0000
3834@@ -0,0 +1,1 @@
3835+ts_setup: PKGS=share-app-autopilot prepare-autopilot-test.sh
3836
3837=== added file 'tests/share-app-autopilot/tslist.auto'
3838--- tests/share-app-autopilot/tslist.auto 1970-01-01 00:00:00 +0000
3839+++ tests/share-app-autopilot/tslist.auto 2013-10-03 23:14:25 +0000
3840@@ -0,0 +1,4 @@
3841+-
3842+ discovery_cmd: autopilot-list share_app
3843+ test_cmd: autopilot-run share_app.tests.{}
3844+
3845
3846=== added directory 'tests/systemsettle'
3847=== added directory 'tests/systemsettle/systemsettle-after'
3848=== added file 'tests/systemsettle/systemsettle-after/tc_control'
3849--- tests/systemsettle/systemsettle-after/tc_control 1970-01-01 00:00:00 +0000
3850+++ tests/systemsettle/systemsettle-after/tc_control 2013-10-03 23:14:25 +0000
3851@@ -0,0 +1,9 @@
3852+description: check if system settles to idle average > 99.25%
3853+dependencies: none
3854+action: |
3855+ 1. Take CPU load samples for 10s, do this up to 10 times until idle is over 99%
3856+expected_results: |
3857+ 1. When doing nothing, system calms down to at least 99% idle level
3858+type: userland
3859+timeout: 120
3860+command: ../systemsettle.sh -c5 -d2 -p 97.5 -l _after
3861
3862=== added directory 'tests/systemsettle/systemsettle-before'
3863=== added file 'tests/systemsettle/systemsettle-before/tc_control'
3864--- tests/systemsettle/systemsettle-before/tc_control 1970-01-01 00:00:00 +0000
3865+++ tests/systemsettle/systemsettle-before/tc_control 2013-10-03 23:14:25 +0000
3866@@ -0,0 +1,9 @@
3867+description: check if system settles to idle average > 99.25%
3868+dependencies: none
3869+action: |
3870+ 1. Take CPU load samples for 10s, do this up to 10 times until idle is over 99%
3871+expected_results: |
3872+ 1. When doing nothing, system calms down to at least 99% idle level
3873+type: userland
3874+timeout: 120
3875+command: ../systemsettle.sh -c5 -d2 -p 97.5 -l _before
3876
3877=== added file 'tests/systemsettle/systemsettle.sh'
3878--- tests/systemsettle/systemsettle.sh 1970-01-01 00:00:00 +0000
3879+++ tests/systemsettle/systemsettle.sh 2013-10-03 23:14:25 +0000
3880@@ -0,0 +1,119 @@
3881+#!/bin/bash
3882+
3883+# Configuration variables:
3884+# TARGET_PREFIX - Allows this to be run from the host, by providings something
3885+# like TARGET_PREFIX="adb shell"
3886+# UTAH_PROBE_DIR - optionally where to save log files so utah will grab them
3887+
3888+set -e
3889+
3890+[ -z $UTAH_PROBE_DIR ] && UTAH_PROBE_DIR="/tmp"
3891+
3892+# default exit code storage
3893+dump_error=1
3894+
3895+calc () { awk "BEGIN{ print $* }" ;}
3896+
3897+function show_usage() {
3898+ echo "Usage:"
3899+ echo " $0 [options]"
3900+ echo "Options:"
3901+ echo " -r run forever without exiting"
3902+ echo " -p minimum idle percent to wait for (Default: 99)"
3903+ echo " -c number of times to run top at each iteration (Default: 10)"
3904+ echo " -d seconds to delay between each top iteration (Default: 6)"
3905+ echo " -i top measurements to ignore from each loop (Default: 1)"
3906+ echo " -m maximum loops of top before giving up if minimum idle"
3907+ echo " percent is not reached (Default: 10)"
3908+ echo " -l label to include for the top_log file"
3909+ exit 129
3910+}
3911+
3912+while getopts "h?rp:c:d:i:m:l:" opt; do
3913+ case "$opt" in
3914+ h|\?) show_usage
3915+ ;;
3916+ r) settle_prefix='-'
3917+ ;;
3918+ p) idle_avg_min=$OPTARG
3919+ ;;
3920+ c) top_repeat=$OPTARG
3921+ ;;
3922+ d) top_wait=$OPTARG
3923+ ;;
3924+ i) top_ignore=$OPTARG
3925+ ;;
3926+ m) settle_max=$OPTARG
3927+ ;;
3928+ l) top_log_label=$OPTARG
3929+ ;;
3930+ esac
3931+done
3932+
3933+# minimum average idle level required to succeed
3934+idle_avg_min=${idle_avg_min:-99}
3935+# measurement details: top $top_wait $top_repeat
3936+top_repeat=${top_repeat:-10}
3937+top_wait=${top_wait:-6}
3938+# how many samples to ignore
3939+top_ignore=${top_ignore:-1}
3940+# how many total attempts to settle the system
3941+settle_max=${settle_max:-10}
3942+
3943+top_log="$UTAH_PROBE_DIR/top$top_log_label.log"
3944+
3945+# set and calc more runtime values
3946+top_tail=`calc $top_repeat - $top_ignore`
3947+settle_count=0
3948+idle_avg=0
3949+
3950+echo "System Settle run - quiesce the system"
3951+echo "--------------------------------------"
3952+echo
3953+echo " idle_avg_min = '$idle_avg_min'"
3954+echo " top_repeat = '$top_repeat'"
3955+echo " top_wait = '$top_wait'"
3956+echo " top_ignore = '$top_ignore'"
3957+echo " settle_max = '$settle_max'"
3958+echo " run_forever = '$settle_prefix' (- = yes)"
3959+echo " log files = $top_log $top_log.reduced"
3960+echo
3961+
3962+while test `calc $idle_avg '<' $idle_avg_min` = 1 -a "$settle_prefix$settle_count" -lt "$settle_max"; do
3963+ echo -n "Starting system idle measurement (run: $settle_count) ... "
3964+
3965+ # get top
3966+ echo "TOP DUMP (after settle run: $settle_count)" >> $top_log
3967+ echo "========================" >> $top_log
3968+ ${TARGET_PREFIX} top -b -d $top_wait -n $top_repeat >> $top_log
3969+ cat $top_log | grep '.Cpu.*' | tail -n $top_tail > $top_log.reduced
3970+ echo >> $top_log
3971+
3972+ # calc average of idle field for this measurement
3973+ sum=0
3974+ count=0
3975+ while read line; do
3976+ idle=`echo $line | sed -e 's/.* \([0-9\.]*\) id.*/\1/'`
3977+ sum=`calc $sum + $idle`
3978+ count=`calc $count + 1`
3979+ done < $top_log.reduced
3980+
3981+ idle_avg=`calc $sum / $count`
3982+ settle_count=`calc $settle_count + 1`
3983+
3984+ echo " DONE."
3985+ echo
3986+ echo "Measurement:"
3987+ echo " + idle level: $idle_avg"
3988+ echo " + idle sum: $sum / count: $count"
3989+ echo
3990+done
3991+
3992+if test `calc $idle_avg '<' $idle_avg_min` = 1; then
3993+ echo "system not settled. FAIL"
3994+ exit 1
3995+else
3996+ echo "system settled. SUCCESS"
3997+ exit 0
3998+fi
3999+
4000
4001=== added file 'tests/systemsettle/tslist.run'
4002--- tests/systemsettle/tslist.run 1970-01-01 00:00:00 +0000
4003+++ tests/systemsettle/tslist.run 2013-10-03 23:14:25 +0000
4004@@ -0,0 +1,2 @@
4005+- test: systemsettle-before
4006+- test: systemsettle-after
4007
4008=== added directory 'tests/ubuntu-calculator-app-autopilot'
4009=== added file 'tests/ubuntu-calculator-app-autopilot/master.run'
4010--- tests/ubuntu-calculator-app-autopilot/master.run 1970-01-01 00:00:00 +0000
4011+++ tests/ubuntu-calculator-app-autopilot/master.run 2013-10-03 23:14:25 +0000
4012@@ -0,0 +1,15 @@
4013+---
4014+testsuites:
4015+ - name: settle-before
4016+ fetch_method: dev
4017+ fetch_location: ../systemsettle
4018+ include_tests:
4019+ - systemsettle-before
4020+ - name: ubuntu-calculator-app-autopilot
4021+ fetch_method: dev
4022+ fetch_location: ./
4023+ - name: settle-after
4024+ fetch_method: dev
4025+ fetch_location: ../systemsettle
4026+ include_tests:
4027+ - systemsettle-after
4028
4029=== added file 'tests/ubuntu-calculator-app-autopilot/ts_control'
4030--- tests/ubuntu-calculator-app-autopilot/ts_control 1970-01-01 00:00:00 +0000
4031+++ tests/ubuntu-calculator-app-autopilot/ts_control 2013-10-03 23:14:25 +0000
4032@@ -0,0 +1,1 @@
4033+ts_setup: PKGS=ubuntu-calculator-app-autopilot prepare-autopilot-test.sh
4034
4035=== added file 'tests/ubuntu-calculator-app-autopilot/tslist.auto'
4036--- tests/ubuntu-calculator-app-autopilot/tslist.auto 1970-01-01 00:00:00 +0000
4037+++ tests/ubuntu-calculator-app-autopilot/tslist.auto 2013-10-03 23:14:25 +0000
4038@@ -0,0 +1,4 @@
4039+-
4040+ discovery_cmd: autopilot-list ubuntu_calculator_app
4041+ test_cmd: autopilot-run ubuntu_calculator_app.tests.{}
4042+
4043
4044=== added directory 'tests/ubuntu-clock-app-autopilot'
4045=== added file 'tests/ubuntu-clock-app-autopilot/master.run'
4046--- tests/ubuntu-clock-app-autopilot/master.run 1970-01-01 00:00:00 +0000
4047+++ tests/ubuntu-clock-app-autopilot/master.run 2013-10-03 23:14:25 +0000
4048@@ -0,0 +1,15 @@
4049+---
4050+testsuites:
4051+ - name: settle-before
4052+ fetch_method: dev
4053+ fetch_location: ../systemsettle
4054+ include_tests:
4055+ - systemsettle-before
4056+ - name: ubuntu-clock-app-autopilot
4057+ fetch_method: dev
4058+ fetch_location: ./
4059+ - name: settle-after
4060+ fetch_method: dev
4061+ fetch_location: ../systemsettle
4062+ include_tests:
4063+ - systemsettle-after
4064
4065=== added file 'tests/ubuntu-clock-app-autopilot/ts_control'
4066--- tests/ubuntu-clock-app-autopilot/ts_control 1970-01-01 00:00:00 +0000
4067+++ tests/ubuntu-clock-app-autopilot/ts_control 2013-10-03 23:14:25 +0000
4068@@ -0,0 +1,1 @@
4069+ts_setup: PKGS=ubuntu-clock-app-autopilot prepare-autopilot-test.sh
4070
4071=== added file 'tests/ubuntu-clock-app-autopilot/tslist.auto'
4072--- tests/ubuntu-clock-app-autopilot/tslist.auto 1970-01-01 00:00:00 +0000
4073+++ tests/ubuntu-clock-app-autopilot/tslist.auto 2013-10-03 23:14:25 +0000
4074@@ -0,0 +1,4 @@
4075+-
4076+ discovery_cmd: autopilot-list ubuntu_clock_app
4077+ test_cmd: autopilot-run ubuntu_clock_app.tests.{}
4078+
4079
4080=== added directory 'tests/ubuntu-docviewer-app-autopilot'
4081=== added file 'tests/ubuntu-docviewer-app-autopilot/master.run'
4082--- tests/ubuntu-docviewer-app-autopilot/master.run 1970-01-01 00:00:00 +0000
4083+++ tests/ubuntu-docviewer-app-autopilot/master.run 2013-10-03 23:14:25 +0000
4084@@ -0,0 +1,15 @@
4085+---
4086+testsuites:
4087+ - name: settle-before
4088+ fetch_method: dev
4089+ fetch_location: ../systemsettle
4090+ include_tests:
4091+ - systemsettle-before
4092+ - name: ubuntu-docviewer-app-autopilot
4093+ fetch_method: dev
4094+ fetch_location: ./
4095+ - name: settle-after
4096+ fetch_method: dev
4097+ fetch_location: ../systemsettle
4098+ include_tests:
4099+ - systemsettle-after
4100
4101=== added file 'tests/ubuntu-docviewer-app-autopilot/ts_control'
4102--- tests/ubuntu-docviewer-app-autopilot/ts_control 1970-01-01 00:00:00 +0000
4103+++ tests/ubuntu-docviewer-app-autopilot/ts_control 2013-10-03 23:14:25 +0000
4104@@ -0,0 +1,1 @@
4105+ts_setup: PKGS=ubuntu-docviewer-app-autopilot prepare-autopilot-test.sh
4106
4107=== added file 'tests/ubuntu-docviewer-app-autopilot/tslist.auto'
4108--- tests/ubuntu-docviewer-app-autopilot/tslist.auto 1970-01-01 00:00:00 +0000
4109+++ tests/ubuntu-docviewer-app-autopilot/tslist.auto 2013-10-03 23:14:25 +0000
4110@@ -0,0 +1,4 @@
4111+-
4112+ discovery_cmd: autopilot-list ubuntu_docviewer_app
4113+ test_cmd: autopilot-run ubuntu_docviewer_app.tests.{}
4114+
4115
4116=== added directory 'tests/ubuntu-filemanager-app-autopilot'
4117=== added file 'tests/ubuntu-filemanager-app-autopilot/master.run'
4118--- tests/ubuntu-filemanager-app-autopilot/master.run 1970-01-01 00:00:00 +0000
4119+++ tests/ubuntu-filemanager-app-autopilot/master.run 2013-10-03 23:14:25 +0000
4120@@ -0,0 +1,15 @@
4121+---
4122+testsuites:
4123+ - name: settle-before
4124+ fetch_method: dev
4125+ fetch_location: ../systemsettle
4126+ include_tests:
4127+ - systemsettle-before
4128+ - name: ubuntu-filemanager-app-autopilot
4129+ fetch_method: dev
4130+ fetch_location: ./
4131+ - name: settle-after
4132+ fetch_method: dev
4133+ fetch_location: ../systemsettle
4134+ include_tests:
4135+ - systemsettle-after
4136
4137=== added file 'tests/ubuntu-filemanager-app-autopilot/ts_control'
4138--- tests/ubuntu-filemanager-app-autopilot/ts_control 1970-01-01 00:00:00 +0000
4139+++ tests/ubuntu-filemanager-app-autopilot/ts_control 2013-10-03 23:14:25 +0000
4140@@ -0,0 +1,1 @@
4141+ts_setup: PKGS=ubuntu-filemanager-app-autopilot prepare-autopilot-test.sh
4142
4143=== added file 'tests/ubuntu-filemanager-app-autopilot/tslist.auto'
4144--- tests/ubuntu-filemanager-app-autopilot/tslist.auto 1970-01-01 00:00:00 +0000
4145+++ tests/ubuntu-filemanager-app-autopilot/tslist.auto 2013-10-03 23:14:25 +0000
4146@@ -0,0 +1,4 @@
4147+-
4148+ discovery_cmd: autopilot-list ubuntu_filemanager_app
4149+ test_cmd: autopilot-run ubuntu_filemanager_app.tests.{}
4150+
4151
4152=== added directory 'tests/ubuntu-rssreader-app-autopilot'
4153=== added file 'tests/ubuntu-rssreader-app-autopilot/master.run'
4154--- tests/ubuntu-rssreader-app-autopilot/master.run 1970-01-01 00:00:00 +0000
4155+++ tests/ubuntu-rssreader-app-autopilot/master.run 2013-10-03 23:14:25 +0000
4156@@ -0,0 +1,15 @@
4157+---
4158+testsuites:
4159+ - name: settle-before
4160+ fetch_method: dev
4161+ fetch_location: ../systemsettle
4162+ include_tests:
4163+ - systemsettle-before
4164+ - name: ubuntu-rssreader-app-autopilot
4165+ fetch_method: dev
4166+ fetch_location: ./
4167+ - name: settle-after
4168+ fetch_method: dev
4169+ fetch_location: ../systemsettle
4170+ include_tests:
4171+ - systemsettle-after
4172
4173=== added file 'tests/ubuntu-rssreader-app-autopilot/ts_control'
4174--- tests/ubuntu-rssreader-app-autopilot/ts_control 1970-01-01 00:00:00 +0000
4175+++ tests/ubuntu-rssreader-app-autopilot/ts_control 2013-10-03 23:14:25 +0000
4176@@ -0,0 +1,1 @@
4177+ts_setup: PKGS=ubuntu-rssreader-app-autopilot prepare-autopilot-test.sh
4178
4179=== added file 'tests/ubuntu-rssreader-app-autopilot/tslist.auto'
4180--- tests/ubuntu-rssreader-app-autopilot/tslist.auto 1970-01-01 00:00:00 +0000
4181+++ tests/ubuntu-rssreader-app-autopilot/tslist.auto 2013-10-03 23:14:25 +0000
4182@@ -0,0 +1,4 @@
4183+-
4184+ discovery_cmd: autopilot-list ubuntu_rssreader_app
4185+ test_cmd: autopilot-run ubuntu_rssreader_app.tests.{}
4186+
4187
4188=== added directory 'tests/ubuntu-terminal-app-autopilot'
4189=== added file 'tests/ubuntu-terminal-app-autopilot/master.run'
4190--- tests/ubuntu-terminal-app-autopilot/master.run 1970-01-01 00:00:00 +0000
4191+++ tests/ubuntu-terminal-app-autopilot/master.run 2013-10-03 23:14:25 +0000
4192@@ -0,0 +1,15 @@
4193+---
4194+testsuites:
4195+ - name: settle-before
4196+ fetch_method: dev
4197+ fetch_location: ../systemsettle
4198+ include_tests:
4199+ - systemsettle-before
4200+ - name: ubuntu-terminal-app-autopilot
4201+ fetch_method: dev
4202+ fetch_location: ./
4203+ - name: settle-after
4204+ fetch_method: dev
4205+ fetch_location: ../systemsettle
4206+ include_tests:
4207+ - systemsettle-after
4208
4209=== added file 'tests/ubuntu-terminal-app-autopilot/ts_control'
4210--- tests/ubuntu-terminal-app-autopilot/ts_control 1970-01-01 00:00:00 +0000
4211+++ tests/ubuntu-terminal-app-autopilot/ts_control 2013-10-03 23:14:25 +0000
4212@@ -0,0 +1,1 @@
4213+ts_setup: PKGS=ubuntu-terminal-app-autopilot prepare-autopilot-test.sh
4214
4215=== added file 'tests/ubuntu-terminal-app-autopilot/tslist.auto'
4216--- tests/ubuntu-terminal-app-autopilot/tslist.auto 1970-01-01 00:00:00 +0000
4217+++ tests/ubuntu-terminal-app-autopilot/tslist.auto 2013-10-03 23:14:25 +0000
4218@@ -0,0 +1,4 @@
4219+-
4220+ discovery_cmd: autopilot-list ubuntu_terminal_app
4221+ test_cmd: autopilot-run ubuntu_terminal_app.tests.{}
4222+
4223
4224=== added directory 'tests/ubuntu-ui-toolkit-autopilot'
4225=== added file 'tests/ubuntu-ui-toolkit-autopilot/master.run'
4226--- tests/ubuntu-ui-toolkit-autopilot/master.run 1970-01-01 00:00:00 +0000
4227+++ tests/ubuntu-ui-toolkit-autopilot/master.run 2013-10-03 23:14:25 +0000
4228@@ -0,0 +1,15 @@
4229+---
4230+testsuites:
4231+ - name: settle-before
4232+ fetch_method: dev
4233+ fetch_location: ../systemsettle
4234+ include_tests:
4235+ - systemsettle-before
4236+ - name: ubuntu-ui-toolkit-autopilot
4237+ fetch_method: dev
4238+ fetch_location: ./
4239+ - name: settle-after
4240+ fetch_method: dev
4241+ fetch_location: ../systemsettle
4242+ include_tests:
4243+ - systemsettle-after
4244
4245=== added file 'tests/ubuntu-ui-toolkit-autopilot/ts_control'
4246--- tests/ubuntu-ui-toolkit-autopilot/ts_control 1970-01-01 00:00:00 +0000
4247+++ tests/ubuntu-ui-toolkit-autopilot/ts_control 2013-10-03 23:14:25 +0000
4248@@ -0,0 +1,1 @@
4249+ts_setup: PKGS=ubuntu-ui-toolkit-autopilot prepare-autopilot-test.sh
4250
4251=== added file 'tests/ubuntu-ui-toolkit-autopilot/tslist.auto'
4252--- tests/ubuntu-ui-toolkit-autopilot/tslist.auto 1970-01-01 00:00:00 +0000
4253+++ tests/ubuntu-ui-toolkit-autopilot/tslist.auto 2013-10-03 23:14:25 +0000
4254@@ -0,0 +1,4 @@
4255+-
4256+ discovery_cmd: autopilot-list ubuntuuitoolkit
4257+ test_cmd: autopilot-run ubuntuuitoolkit.tests.{}
4258+
4259
4260=== added directory 'tests/ubuntu-weather-app-autopilot'
4261=== added file 'tests/ubuntu-weather-app-autopilot/master.run'
4262--- tests/ubuntu-weather-app-autopilot/master.run 1970-01-01 00:00:00 +0000
4263+++ tests/ubuntu-weather-app-autopilot/master.run 2013-10-03 23:14:25 +0000
4264@@ -0,0 +1,15 @@
4265+---
4266+testsuites:
4267+ - name: settle-before
4268+ fetch_method: dev
4269+ fetch_location: ../systemsettle
4270+ include_tests:
4271+ - systemsettle-before
4272+ - name: ubuntu-weather-app-autopilot
4273+ fetch_method: dev
4274+ fetch_location: ./
4275+ - name: settle-after
4276+ fetch_method: dev
4277+ fetch_location: ../systemsettle
4278+ include_tests:
4279+ - systemsettle-after
4280
4281=== added file 'tests/ubuntu-weather-app-autopilot/ts_control'
4282--- tests/ubuntu-weather-app-autopilot/ts_control 1970-01-01 00:00:00 +0000
4283+++ tests/ubuntu-weather-app-autopilot/ts_control 2013-10-03 23:14:25 +0000
4284@@ -0,0 +1,1 @@
4285+ts_setup: PKGS=ubuntu-weather-app-autopilot prepare-autopilot-test.sh
4286
4287=== added file 'tests/ubuntu-weather-app-autopilot/tslist.auto'
4288--- tests/ubuntu-weather-app-autopilot/tslist.auto 1970-01-01 00:00:00 +0000
4289+++ tests/ubuntu-weather-app-autopilot/tslist.auto 2013-10-03 23:14:25 +0000
4290@@ -0,0 +1,4 @@
4291+-
4292+ discovery_cmd: autopilot-list ubuntu_weather_app
4293+ test_cmd: autopilot-run ubuntu_weather_app.tests.{}
4294+
4295
4296=== added directory 'tests/unity8-autopilot'
4297=== added file 'tests/unity8-autopilot/master.run'
4298--- tests/unity8-autopilot/master.run 1970-01-01 00:00:00 +0000
4299+++ tests/unity8-autopilot/master.run 2013-10-03 23:14:25 +0000
4300@@ -0,0 +1,15 @@
4301+---
4302+testsuites:
4303+ - name: settle-before
4304+ fetch_method: dev
4305+ fetch_location: ../systemsettle
4306+ include_tests:
4307+ - systemsettle-before
4308+ - name: unity8-autopilot
4309+ fetch_method: dev
4310+ fetch_location: ./
4311+ - name: settle-after
4312+ fetch_method: dev
4313+ fetch_location: ../systemsettle
4314+ include_tests:
4315+ - systemsettle-after
4316
4317=== added file 'tests/unity8-autopilot/setup.sh'
4318--- tests/unity8-autopilot/setup.sh 1970-01-01 00:00:00 +0000
4319+++ tests/unity8-autopilot/setup.sh 2013-10-03 23:14:25 +0000
4320@@ -0,0 +1,6 @@
4321+#!/bin/sh
4322+
4323+set -e
4324+
4325+NO_UNLOCK=1 PKGS="unity8-autopilot" prepare-autopilot-test.sh
4326+$TARGET_PREFIX sudo -i -u phablet stop unity8
4327
4328=== added file 'tests/unity8-autopilot/ts_control'
4329--- tests/unity8-autopilot/ts_control 1970-01-01 00:00:00 +0000
4330+++ tests/unity8-autopilot/ts_control 2013-10-03 23:14:25 +0000
4331@@ -0,0 +1,2 @@
4332+ts_setup: TARGET_PREFIX=$TARGET_PREFIX ./setup.sh
4333+ts_cleanup: $TARGET_PREFIX sudo -i -u phablet start unity8
4334
4335=== added file 'tests/unity8-autopilot/tslist.auto'
4336--- tests/unity8-autopilot/tslist.auto 1970-01-01 00:00:00 +0000
4337+++ tests/unity8-autopilot/tslist.auto 2013-10-03 23:14:25 +0000
4338@@ -0,0 +1,4 @@
4339+-
4340+ discovery_cmd: autopilot-list unity8 unity8 unity8.
4341+ test_cmd: autopilot-run unity8.{}
4342+
4343
4344=== added directory 'tests/upgrade'
4345=== added file 'tests/upgrade/README'
4346--- tests/upgrade/README 1970-01-01 00:00:00 +0000
4347+++ tests/upgrade/README 2013-10-03 23:14:25 +0000
4348@@ -0,0 +1,3 @@
4349+NOTE: This test is intended to be run by UTAH using the "--from-host"
4350+method. This is different from other tests in this repository and should
4351+not be run with jenkins.sh
4352
4353=== added directory 'tests/upgrade/install_old'
4354=== added file 'tests/upgrade/install_old/run.sh'
4355--- tests/upgrade/install_old/run.sh 1970-01-01 00:00:00 +0000
4356+++ tests/upgrade/install_old/run.sh 2013-10-03 23:14:25 +0000
4357@@ -0,0 +1,27 @@
4358+#!/bin/bash
4359+
4360+## Puts an older build on the device
4361+## Intersting environment variables that must be set:
4362+## ANDROID_SERIAL - specify another android device
4363+## NETWORK_FILE - specify an alternative network file
4364+## UPGRADE_FROM - the revision to upgrade from, eg -1
4365+
4366+set -eux
4367+
4368+BASEDIR=$(dirname $(readlink -f $0))
4369+
4370+RESDIR=`pwd`/clientlogs
4371+
4372+UTAH_PHABLET_CMD="${UTAH_PHABLET_CMD-/usr/share/utah/examples/run_utah_phablet.py}"
4373+ANDROID_SERIAL="${ANDROID_SERIAL-015d1884b20c1c0f}" #doanac's nexus7 at home
4374+NETWORK_FILE="${NETWORK_FILE-/home/ubuntu/magners-wifi}"
4375+UPGRADE_FROM="${UPGRADE_FROM--1}"
4376+CLIENT_LOGS="${CLIENT_LOGS-/tmp}"
4377+
4378+echo "INSTALLING OLD BUILD..."
4379+$UTAH_PHABLET_CMD -s $ANDROID_SERIAL \
4380+ --ubuntu-bootstrap -r $UPGRADE_FROM \
4381+ --network-file $NETWORK_FILE \
4382+ --skip-utah \
4383+ --pull /var/crash \
4384+ --results-dir=${CLIENT_LOGS}
4385
4386=== added file 'tests/upgrade/install_old/tc_control'
4387--- tests/upgrade/install_old/tc_control 1970-01-01 00:00:00 +0000
4388+++ tests/upgrade/install_old/tc_control 2013-10-03 23:14:25 +0000
4389@@ -0,0 +1,9 @@
4390+description: sets up a previous days build on the target
4391+dependencies: n/a
4392+action: |
4393+ 1. install an older system image
4394+expected_results: |
4395+ 1. an older system image will be installed
4396+type: userland
4397+timeout: 1800
4398+command: ./run.sh
4399
4400=== added file 'tests/upgrade/master.run'
4401--- tests/upgrade/master.run 1970-01-01 00:00:00 +0000
4402+++ tests/upgrade/master.run 2013-10-03 23:14:25 +0000
4403@@ -0,0 +1,5 @@
4404+---
4405+testsuites:
4406+ - name: upgrade
4407+ fetch_method: dev
4408+ fetch_location: ./
4409
4410=== added file 'tests/upgrade/tslist.run'
4411--- tests/upgrade/tslist.run 1970-01-01 00:00:00 +0000
4412+++ tests/upgrade/tslist.run 2013-10-03 23:14:25 +0000
4413@@ -0,0 +1,2 @@
4414+- test: install_old
4415+- test: upgrade
4416
4417=== added directory 'tests/upgrade/upgrade'
4418=== added file 'tests/upgrade/upgrade/tc_control'
4419--- tests/upgrade/upgrade/tc_control 1970-01-01 00:00:00 +0000
4420+++ tests/upgrade/upgrade/tc_control 2013-10-03 23:14:25 +0000
4421@@ -0,0 +1,9 @@
4422+description: performs an upgrade using system-image-cli
4423+dependencies: a touch read-only image
4424+action: |
4425+ 1. execute upgrade
4426+expected_results: |
4427+ 1. it will reboot into recovery, upgrade, and boot up
4428+type: userland
4429+timeout: 1800
4430+command: ./upgrade.sh
4431
4432=== added file 'tests/upgrade/upgrade/upgrade.sh'
4433--- tests/upgrade/upgrade/upgrade.sh 1970-01-01 00:00:00 +0000
4434+++ tests/upgrade/upgrade/upgrade.sh 2013-10-03 23:14:25 +0000
4435@@ -0,0 +1,79 @@
4436+#!/bin/sh
4437+
4438+## upgrades the given target
4439+## Intersting environment variables that must be set:
4440+## ANDROID_SERIAL - specify another android device
4441+ANDROID_SERIAL="${ANDROID_SERIAL-015d1884b20c1c0f}" #doanac's nexus7 at home
4442+
4443+set -eux
4444+
4445+export ANDROID_SERIAL=$ANDROID_SERIAL
4446+
4447+phablet_reboot_wait() {
4448+ # TODO get this into phablet-tools
4449+ adb reboot
4450+ adb shell stop android-tools-adbd 2>/dev/null || true
4451+ adb wait-for-device
4452+ # sometimes wait-for-device comes back too quick, so wait once more
4453+ sleep 4s
4454+ adb wait-for-device
4455+}
4456+
4457+# try and get the system up with an actual wlan0
4458+phablet_get_interface() {
4459+ if ! adb shell ifconfig -a | grep wlan0 >/dev/null ; then
4460+ return 1
4461+ fi
4462+}
4463+
4464+# try and try and try to get an IP
4465+# network is flaky, this seems to help:
4466+phablet_get_ip() {
4467+ adb shell nmcli c list
4468+ uuid=$(adb shell nmcli c list | grep 802-11-wireless | tail -n1 | grep -o -E "[a-f0-9]{8}-([a-f0-9]{4}-){3}[a-f0-9]{12}")
4469+ tmp=$(mktemp)
4470+ adb shell sh -c "nmcli c up uuid $uuid ; echo ANDROID_RC=$?" | tee $tmp
4471+ rc=1
4472+ if grep "ANDROID_RC=0" $tmp >/dev/null; then
4473+ rc=0
4474+ fi
4475+ rm $tmp
4476+ return $rc
4477+}
4478+
4479+retry() {
4480+ cmd=$1
4481+ retries=$2
4482+
4483+ for i in $(seq $retries) ; do
4484+ if $cmd ; then
4485+ return 0
4486+ fi
4487+ times=$(($retries - $i))
4488+ if [ $times -ne 0 ] ; then
4489+ echo "$cmd: failed, retrying $(($retries - $i)) more times"
4490+ [ -z $reboot ] || phablet_reboot_wait
4491+ sleep 60
4492+ else
4493+ echo "$cmd: failed after $retries attempts"
4494+ fi
4495+ done
4496+ return 1
4497+}
4498+
4499+orig_version=$(adb shell system-image-cli -b)
4500+echo $orig_version | sed -e 's/build number/UPGRADING FROM VERSION/'
4501+
4502+reboot=1 retry phablet_get_interface 4
4503+sleep 60
4504+retry phablet_get_ip 4
4505+
4506+adb shell system-image-cli -v
4507+adb wait-for-device
4508+new_version=$(adb shell system-image-cli -b)
4509+echo $new_version | sed -e 's/build number/UPGRADED TO VERSION/'
4510+
4511+if [ "$new_version" = "$orig_version" ] ; then
4512+ echo "UPGRADE FAILED"
4513+ exit 1
4514+fi
4515
4516=== added directory 'tests/webbrowser-app-autopilot'
4517=== added file 'tests/webbrowser-app-autopilot/master.run'
4518--- tests/webbrowser-app-autopilot/master.run 1970-01-01 00:00:00 +0000
4519+++ tests/webbrowser-app-autopilot/master.run 2013-10-03 23:14:25 +0000
4520@@ -0,0 +1,15 @@
4521+---
4522+testsuites:
4523+ - name: settle-before
4524+ fetch_method: dev
4525+ fetch_location: ../systemsettle
4526+ include_tests:
4527+ - systemsettle-before
4528+ - name: webbrowser-app-autopilot
4529+ fetch_method: dev
4530+ fetch_location: ./
4531+ - name: settle-after
4532+ fetch_method: dev
4533+ fetch_location: ../systemsettle
4534+ include_tests:
4535+ - systemsettle-after
4536
4537=== added file 'tests/webbrowser-app-autopilot/ts_control'
4538--- tests/webbrowser-app-autopilot/ts_control 1970-01-01 00:00:00 +0000
4539+++ tests/webbrowser-app-autopilot/ts_control 2013-10-03 23:14:25 +0000
4540@@ -0,0 +1,1 @@
4541+ts_setup: PKGS=webbrowser-app-autopilot prepare-autopilot-test.sh
4542
4543=== added file 'tests/webbrowser-app-autopilot/tslist.auto'
4544--- tests/webbrowser-app-autopilot/tslist.auto 1970-01-01 00:00:00 +0000
4545+++ tests/webbrowser-app-autopilot/tslist.auto 2013-10-03 23:14:25 +0000
4546@@ -0,0 +1,4 @@
4547+-
4548+ discovery_cmd: autopilot-list webbrowser_app
4549+ test_cmd: autopilot-run webbrowser_app.tests.{}
4550+
4551
4552=== added directory 'utils'
4553=== added directory 'utils/host'
4554=== added file 'utils/host/adb-shell'
4555--- utils/host/adb-shell 1970-01-01 00:00:00 +0000
4556+++ utils/host/adb-shell 2013-10-03 23:14:25 +0000
4557@@ -0,0 +1,20 @@
4558+#!/bin/bash
4559+
4560+# The "adb shell" command doesn't return an error if the command you execute
4561+# resulted in an error. This is a wrapper to return the command's true return code.
4562+
4563+# NOTE: This script uses some specific bash'isms to keep things short and simple
4564+
4565+set -eu
4566+
4567+pat='ADB_RC=([[:digit:]]+)'
4568+
4569+{
4570+ adb shell "$* ; echo ADB_RC=\$?"
4571+} | while read line; do
4572+ echo $line
4573+ if [[ $line =~ $pat ]] ; then
4574+ rc=${BASH_REMATCH[1]}
4575+ exit $rc
4576+ fi
4577+done
4578
4579=== added file 'utils/host/autopilot-list'
4580--- utils/host/autopilot-list 1970-01-01 00:00:00 +0000
4581+++ utils/host/autopilot-list 2013-10-03 23:14:25 +0000
4582@@ -0,0 +1,18 @@
4583+#!/bin/sh
4584+
4585+set -e
4586+
4587+app=$1
4588+pat=$app
4589+rep=$app.tests.
4590+
4591+if [ -z "$app" ] ; then
4592+ echo "USAGE: $0 <app> [pattern] [replace]"
4593+ exit 1
4594+fi
4595+[ -z "$2" ] || pat=$2
4596+[ -z "$3" ] || rep=$3
4597+
4598+#NOTE we just use adb shell here, because we don't have to catch errors. the greps
4599+# will work around that
4600+adb shell sudo -i -u phablet bash -ic \"PYTHONPATH=/home/phablet/autopilot autopilot list $app\" | grep $pat | sed -e "s/^.*${rep}//"
4601
4602=== added file 'utils/host/autopilot-run'
4603--- utils/host/autopilot-run 1970-01-01 00:00:00 +0000
4604+++ utils/host/autopilot-run 2013-10-03 23:14:25 +0000
4605@@ -0,0 +1,6 @@
4606+#!/bin/sh
4607+
4608+
4609+UTAH_PROBE_DIR="${UTAH_PROBE_DIR-/var/cache/utah-probes}"
4610+
4611+adb-shell sudo -i -u phablet bash -ic \"UTAH_PROBE_DIR=$UTAH_PROBES_DIR PYTHONPATH=/home/phablet/autopilot autopilot run -v $*\"
4612
4613=== added file 'utils/host/prepare-autopilot-test.sh'
4614--- utils/host/prepare-autopilot-test.sh 1970-01-01 00:00:00 +0000
4615+++ utils/host/prepare-autopilot-test.sh 2013-10-03 23:14:25 +0000
4616@@ -0,0 +1,5 @@
4617+#!/bin/sh
4618+
4619+set -e
4620+
4621+adb-shell NO_UNLOCK=\"$NO_UNLOCK\" PKGS=\"$PKGS\" /home/phablet/bin/prepare-autopilot-test.sh
4622
4623=== added directory 'utils/target'
4624=== added file 'utils/target/autopilot-list'
4625--- utils/target/autopilot-list 1970-01-01 00:00:00 +0000
4626+++ utils/target/autopilot-list 2013-10-03 23:14:25 +0000
4627@@ -0,0 +1,13 @@
4628+#!/bin/sh
4629+
4630+app=$1
4631+pat=${2:-$app}
4632+rep=${3:-$app.tests.}
4633+
4634+if [ -z "$app" ] ; then
4635+ echo "USAGE: $0 <app> [pattern] [replace]"
4636+ exit 1
4637+fi
4638+
4639+curdir=$(pwd)
4640+sudo -i -u phablet bash -ic "PYTHONPATH=$curdir autopilot list $app" | grep $pat | sed -e "s/^.*${rep}//"
4641
4642=== added file 'utils/target/autopilot-run'
4643--- utils/target/autopilot-run 1970-01-01 00:00:00 +0000
4644+++ utils/target/autopilot-run 2013-10-03 23:14:25 +0000
4645@@ -0,0 +1,6 @@
4646+#!/bin/sh
4647+
4648+UTAH_PROBE_DIR="${UTAH_PROBE_DIR-/var/cache/utah-probes}"
4649+
4650+curdir=$(pwd)
4651+sudo -i -u phablet bash -ic "UTAH_PROBE_DIR=$UTAH_PROBE_DIR PYTHONPATH=$curdir autopilot run -v $*"
4652
4653=== added file 'utils/target/prepare-autopilot-test.sh'
4654--- utils/target/prepare-autopilot-test.sh 1970-01-01 00:00:00 +0000
4655+++ utils/target/prepare-autopilot-test.sh 2013-10-03 23:14:25 +0000
4656@@ -0,0 +1,17 @@
4657+#!/bin/sh
4658+
4659+set -e
4660+
4661+#installs dependencies and unlocks screen so an autopilot test case can run
4662+
4663+if [ -n "$PKGS" ] ; then
4664+ MISSING=0
4665+ dpkg -s $PKGS 2>/dev/null >/dev/null || MISSING=1
4666+ if [ $MISSING -eq 1 ] ; then
4667+ apt-get install -yq --force-yes $PKGS
4668+ else
4669+ echo "setup not needed"
4670+ fi
4671+fi
4672+[ -z $NO_UNLOCK ] && /home/phablet/bin/unlock_screen.sh
4673+exit 0
4674
4675=== added file 'utils/target/unlock_screen.py'
4676--- utils/target/unlock_screen.py 1970-01-01 00:00:00 +0000
4677+++ utils/target/unlock_screen.py 2013-10-03 23:14:25 +0000
4678@@ -0,0 +1,96 @@
4679+#!/usr/bin/env python
4680+
4681+from autopilot import introspection
4682+from autopilot.display import Display
4683+from autopilot.input import Pointer, Touch
4684+import dbus
4685+import os
4686+import sys
4687+
4688+
4689+def help():
4690+ print "Usage:"
4691+ print "Run the script without any argument to unlock with assertion"
4692+ print ""
4693+ print "option -q:"
4694+ print "Execute with parameter -q to unlock the screen quickly without introspection"
4695+
4696+
4697+def start_unity_in_testability():
4698+ override_file = "~/.config/upstart/unity8.override"
4699+
4700+ os.system('echo "exec unity8 -testability" > ~/.config/upstart/unity8.override')
4701+
4702+ print "----------------------------------------------------------------------"
4703+ print "Stopping Unity"
4704+ os.system('/sbin/stop unity8')
4705+ print "Unity stopped"
4706+
4707+ print "----------------------------------------------------------------------"
4708+ print "Taking screen lock (#1235000)"
4709+ bus = dbus.SystemBus()
4710+ powerd = bus.get_object('com.canonical.powerd', '/com/canonical/powerd')
4711+ powerd_cookie = powerd.requestSysState("autopilot-lock", 1, dbus_interface='com.canonical.powerd')
4712+ print "----------------------------------------------------------------------"
4713+ print "Starting Unity with testability"
4714+ os.system('/sbin/start unity8')
4715+ print "Unity started"
4716+ print "----------------------------------------------------------------------"
4717+ print "Releasing screen lock (#1235000)"
4718+ powerd.clearSysState(powerd_cookie, dbus_interface='com.canonical.powerd')
4719+
4720+ print "----------------------------------------------------------------------"
4721+ if os.path.exists(override_file):
4722+ os.remove(override_file)
4723+ print "Cleaned up upstart override"
4724+ print "----------------------------------------------------------------------"
4725+
4726+ print "Turning on the screen"
4727+ print ""
4728+
4729+
4730+def unlock_screen():
4731+ input_device = Touch.create()
4732+ pointing_device = Pointer(input_device)
4733+ conn = "com.canonical.Shell.BottomBarVisibilityCommunicator"
4734+ unity8 = introspection.get_proxy_object_for_existing_process(connection_name=conn)
4735+ greeter = unity8.select_single("Greeter")
4736+ x, y, w, h = greeter.globalRect
4737+ tx = x + w
4738+ ty = y + (h / 2)
4739+
4740+ pointing_device.drag(tx, ty, tx / 2, ty)
4741+ try:
4742+ greeter.shown.wait_for(False)
4743+ except AssertionError:
4744+ print "----------------------------------------------------------------------"
4745+ print "THE SCREEN DIDN'T UNLOCK THE FIRST TRY, NOW ATTEMPTING A BLIND SWIPE"
4746+ unlock_screen_blind(greeter)
4747+
4748+
4749+def unlock_screen_blind(greeter=None):
4750+ input_device = Touch.create()
4751+ pointing_device = Pointer(input_device)
4752+ x, y, w, h = Display.create(preferred_backend='UPA').get_screen_geometry(0)
4753+ tx = x + w
4754+ ty = y + (h / 2)
4755+
4756+ pointing_device.drag(tx, ty, tx / 2, ty)
4757+ if greeter is not None:
4758+ try:
4759+ greeter.shown.wait_for(False)
4760+ if greeter.shown is False:
4761+ print ""
4762+ print "THE SCREEN IS NOW UNLOCKED"
4763+ except AssertionError:
4764+ print "----------------------------------------------------------------------"
4765+ "THE SCREEN DIDN'T UNLOCK, RESTART THE DEVICE AND RUN THE SCRIPT AGAIN"
4766+
4767+
4768+if len(sys.argv) >= 2 and sys.argv[1] == '-q':
4769+ unlock_screen_blind()
4770+elif len(sys.argv) >= 2 and sys.argv[1] == '-h':
4771+ help()
4772+else:
4773+ start_unity_in_testability()
4774+ unlock_screen()
4775
4776=== added file 'utils/target/unlock_screen.sh'
4777--- utils/target/unlock_screen.sh 1970-01-01 00:00:00 +0000
4778+++ utils/target/unlock_screen.sh 2013-10-03 23:14:25 +0000
4779@@ -0,0 +1,7 @@
4780+#!/bin/sh
4781+
4782+basedir=$(dirname $(readlink -f $0))
4783+
4784+#temporary workaround for bug #1207386
4785+chmod 666 /dev/uinput
4786+sudo -i -u phablet bash -ic "PYTHONPATH=$(pwd) ${basedir}/unlock_screen.py"

Subscribers

People subscribed via source and target branches