Merge lp:~cjohnston/ubuntu-test-cases/convergence into lp:ubuntu-test-cases

Proposed by Chris Johnston
Status: Superseded
Proposed branch: lp:~cjohnston/ubuntu-test-cases/convergence
Merge into: lp:ubuntu-test-cases
Diff against target: 4406 lines (+3540/-0) (has conflicts)
163 files modified
jenkins/setup_jenkins.py (+237/-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 (+87/-0)
jenkins/templates/touch-calendar-app-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-camera-app-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-default.xml.jinja2 (+21/-0)
jenkins/templates/touch-dialer-app-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-eventstat.xml.jinja2 (+21/-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 (+37/-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-phone-app-connected-autopilot.xml.jinja2 (+6/-0)
jenkins/templates/touch-sdk.xml.jinja2 (+20/-0)
jenkins/templates/touch-security.xml.jinja2 (+20/-0)
jenkins/templates/touch-setup.xml.jinja2 (+5/-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-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 (+32/-0)
scripts/jenkins.sh (+111/-0)
scripts/provision.sh (+26/-0)
scripts/run-touch-utah-runlist.sh (+66/-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/default/ifconfig/tc_control (+14/-0)
tests/default/install/tc_control (+13/-0)
tests/default/master.run (+5/-0)
tests/default/netstat/tc_control (+13/-0)
tests/default/ping/tc_control (+13/-0)
tests/default/pwd/tc_control (+10/-0)
tests/default/pwd/test.sh (+7/-0)
tests/default/route/tc_control (+13/-0)
tests/default/systemsettle/systemsettle.sh (+124/-0)
tests/default/systemsettle/tc_control (+10/-0)
tests/default/ts_control (+3/-0)
tests/default/tslist.run (+11/-0)
tests/default/uname/tc_control (+13/-0)
tests/default/unity8/tc_control (+10/-0)
tests/default/update/tc_control (+13/-0)
tests/default/vmstat/tc_control (+13/-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/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/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 (+110/-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 (+79/-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/phone-app-connected-autopilot/master.run (+5/-0)
tests/phone-app-connected-autopilot/setup.sh (+36/-0)
tests/phone-app-connected-autopilot/sms_self.py (+34/-0)
tests/phone-app-connected-autopilot/testnumbers.cfg (+23/-0)
tests/phone-app-connected-autopilot/ts_control (+1/-0)
tests/phone-app-connected-autopilot/tslist.auto (+4/-0)
tests/run-touch-upgrade.sh (+46/-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/touch-smoke-boot.run (+6/-0)
tests/touch-smoke-default.run (+4/-0)
tests/touch-smoke-sdk.run (+4/-0)
tests/touch-smoke-security.run (+4/-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-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 (+3/-0)
utils/host/prepare-autopilot-test.sh (+5/-0)
utils/target/autopilot-list (+13/-0)
utils/target/autopilot-run (+4/-0)
utils/target/prepare-autopilot-test.sh (+17/-0)
utils/target/unlock_screen.py (+87/-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:~cjohnston/ubuntu-test-cases/convergence
Reviewer Review Type Date Requested Status
Ubuntu Test Case Developers Pending
Review via email: mp+183247@code.launchpad.net

This proposal has been superseded by a proposal from 2013-08-30.

To post a comment you must log in.
23. By Chris Johnston

Updating paths

24. By Chris Johnston

Move runlists to proper place

25. By Chris Johnston

Fix paths

26. By Chris Johnston

Move run-touch-upgrade to scripts

27. By Chris Johnston

Applying patch

28. By Chris Johnston

Fix path issue

29. By Chris Johnston

Update branches

30. By Chris Johnston

Fix path for from host

31. By Chris Johnston

Merge trunk

Unmerged revisions

31. By Chris Johnston

Merge trunk

30. By Chris Johnston

Fix path for from host

29. By Chris Johnston

Update branches

28. By Chris Johnston

Fix path issue

27. By Chris Johnston

Applying patch

26. By Chris Johnston

Move run-touch-upgrade to scripts

25. By Chris Johnston

Fix paths

24. By Chris Johnston

Move runlists to proper place

23. By Chris Johnston

Updating paths

22. By Chris Johnston

Switch to a common setup for obtaining ANDROID_SERIAL

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

Subscribers

People subscribed via source and target branches