lrt

Merge lp:~canonical-platform-qa/lrt/lrt-to-dep8 into lp:lrt

Proposed by Allan LeSage
Status: Merged
Merged at revision: 98
Proposed branch: lp:~canonical-platform-qa/lrt/lrt-to-dep8
Merge into: lp:lrt
Diff against target: 248 lines (+166/-3)
12 files modified
PROVISIONING_IN_CI_README.sh (+10/-0)
README (+21/-0)
debian/changelog (+5/-0)
debian/compat (+1/-0)
debian/control (+8/-0)
debian/copyright (+27/-0)
debian/source/format (+1/-0)
debian/tests/control (+8/-0)
debian/tests/lrt-random-gestures (+5/-0)
dep-8-run-lrt.sh (+72/-0)
lrt/__init__.py (+0/-1)
lrt/test_random_gestures.py (+8/-2)
To merge this branch: bzr merge lp:~canonical-platform-qa/lrt/lrt-to-dep8
Reviewer Review Type Date Requested Status
Martin Pitt (community) Needs Fixing
Christopher Lee (community) Needs Information
Review via email: mp+241353@code.launchpad.net

Commit message

Enable LRT as an autopkgtest.

Description of the change

Enable LRT as an autopkgtest.

To post a comment you must log in.
Revision history for this message
Allan LeSage (allanlesage) wrote :

Performed a test run of this for kicks, and witnessed a failure. Note that I made a point of not changing any of ChrisGagnon's code as it's been working for us, however it could probably use a subsequent review or two.

96. By Allan LeSage

Restore test_switch.py, not quite ready for it.

Revision history for this message
Christopher Lee (veebers) wrote :

A couple of comments and questions.

review: Needs Fixing
97. By Allan LeSage

Per veebers' suggestions.

Revision history for this message
Christopher Lee (veebers) wrote :

1 remaining question regarding return code, otherwise it looks good. Once there is an answer to the retcode question I would be more than happy approving this.

review: Needs Information
Revision history for this message
Martin Pitt (pitti) wrote :

The whole sudo thing is really really ugly and bad. Please try to avoid it entirely, and the current implementation is definitively not working without special pre-arrangements to the testbed (like allowing sudo without password). I made some comments about the usage of sudo, and some alternatives.

Revision history for this message
Martin Pitt (pitti) :
review: Needs Fixing
Revision history for this message
Allan LeSage (allanlesage) wrote :

Jeez I guess I didn't realize exactly how evil these sudos really were :) , in my defense we're just using what works from Chris' local setup--I'll do a test without and then ask for another review Martin, thanks.

98. By Allan LeSage

De-sudo-fication, having tested.

Revision history for this message
Martin Pitt (pitti) wrote :

/usr/share/polkit-1/actions/org.freedesktop.urfkill.policy limits the D-BUS calls to an active local session. Thus the call fails in phablet-shell:

$ /usr/share/urfkill/scripts/flight-mode 1
dbus.exceptions.DBusException: org.freedesktop.URfkill.Daemon.Error.General: not authorized

But it might behave differently in the actual test under adt-run, so if it works, perfect! Otherwise it's a little more tricky; we can't just "break into" the running session from outside and pretend the external ssh session would run in that; but we might be able to talk to the network indicator over (session) D-BUS to trigger flight mode, which then talks to urfkill?

Revision history for this message
Allan LeSage (allanlesage) wrote :

Martin's right, the flight mode setting doesn't work without root; will call the d-bus action instead.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'PROVISIONING_IN_CI_README.sh'
2--- PROVISIONING_IN_CI_README.sh 1970-01-01 00:00:00 +0000
3+++ PROVISIONING_IN_CI_README.sh 2014-11-13 15:27:18 +0000
4@@ -0,0 +1,10 @@
5+#!/bin/sh
6+
7+# XXX 20141112 alesage
8+# TO DISCUSS WITH CI: we need to report crashes via whoopsie; as noted
9+# in dep-8-run-lrt.sh ChrisGagnon has secured special CRASH_IDs for
10+# the defined tests. ChrisGagnon modified the whoopsie.conf during
11+# provisioning to reference this $CRASH_ID as follows:
12+
13+sed -i '/CRASH_DB_IDENTIFIER/d' /etc/init/whoopsie.conf
14+sed -i '/env CRASH_DB_URL=https:\/\/daisy.ubuntu.com/a env CRASH_DB_IDENTIFIER=$CRASH_ID' /etc/init/whoopsie.conf
15
16=== modified file 'README'
17--- README 2014-08-06 21:52:32 +0000
18+++ README 2014-11-13 15:27:18 +0000
19@@ -39,3 +39,24 @@
20 The jenkins url is stored in settings
21
22 python -m helpers_py2.post_process_jenkins_jobs -p LRT -j generic-monkey-runner -t RandomGesture -i 20140805.3 -b 13000 | python3 /insert_lrt_in_nfss.py LRT RandomGesture
23+
24+
25+Running the tests on a Touch device under autopkgtest
26+=====================================================
27+
28+This test should be run on an Ubuntu Touch device. To run the test:
29+
30+1. Flash an Ubuntu Touch device.
31+2. Enable adb access on the device.
32+3. Get the test code:
33+
34+ $ bzr branch lp:lrt
35+
36+4. Connect the device to the runner machine with an USB cable.
37+5. Run the tests with adt-run:
38+
39+ $ adt-run -B --built-tree=. --output-dir=output --- ssh -s adb
40+
41+The test executable exits with 0 if successful, non-zero otherwise.
42+
43+The NFSS json data file will be stored at the output/artifacts/ directory, along with a file that indicates that it should be uploaded only to the staging server.
44
45=== added directory 'debian'
46=== added file 'debian/changelog'
47--- debian/changelog 1970-01-01 00:00:00 +0000
48+++ debian/changelog 2014-11-13 15:27:18 +0000
49@@ -0,0 +1,5 @@
50+ubuntu-lrt-tests (0.1-1) unstable; urgency=low
51+
52+ * Initial release
53+
54+ -- Allan LeSage <allan.lesage@canonical.com> Wed, 05 Nov 2014 09:44:55 -0600
55
56=== added file 'debian/compat'
57--- debian/compat 1970-01-01 00:00:00 +0000
58+++ debian/compat 2014-11-13 15:27:18 +0000
59@@ -0,0 +1,1 @@
60+9
61
62=== added file 'debian/control'
63--- debian/control 1970-01-01 00:00:00 +0000
64+++ debian/control 2014-11-13 15:27:18 +0000
65@@ -0,0 +1,8 @@
66+Source: ubuntu-lrt-tests
67+Priority: optional
68+Maintainer: Chris Gagnon <chris.gagnon@canonical.com>
69+Build-Depends: debhelper (>= 9), autotools-dev
70+Standards-Version: 3.9.5
71+Section: utils
72+Vcs-bzr: lp:lrt
73+XS-Testsuite: autopkgtest
74
75=== added file 'debian/copyright'
76--- debian/copyright 1970-01-01 00:00:00 +0000
77+++ debian/copyright 2014-11-13 15:27:18 +0000
78@@ -0,0 +1,27 @@
79+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
80+Upstream-Name: ubuntu-lrt-tests
81+Source: https://code.launchpad.net/lrt
82+
83+Files: *
84+Copyright: 2014 Ubuntu Quality Team <ubuntu-quality@lists.ubuntu.com>
85+License: GPL-3.0+
86+
87+Files: debian/*
88+Copyright: 2014 Ubuntu Quality Team <ubuntu-quality@lists.ubuntu.com>
89+License: GPL-3.0+
90+
91+ This package is free software; you can redistribute it and/or modify
92+ it under the terms of the GNU General Public License as published by
93+ the Free Software Foundation; either version 3 of the License, or
94+ (at your option) any later version.
95+ .
96+ This package is distributed in the hope that it will be useful,
97+ but WITHOUT ANY WARRANTY; without even the implied warranty of
98+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
99+ GNU General Public License for more details.
100+ .
101+ You should have received a copy of the GNU General Public License
102+ along with this program. If not, see <http://www.gnu.org/licenses/>
103+ .
104+ On Debian systems, the complete text of the GNU General
105+ Public License version 2 can be found in "/usr/share/common-licenses/GPL-3".
106
107=== added directory 'debian/source'
108=== added file 'debian/source/format'
109--- debian/source/format 1970-01-01 00:00:00 +0000
110+++ debian/source/format 2014-11-13 15:27:18 +0000
111@@ -0,0 +1,1 @@
112+3.0 (quilt)
113
114=== added directory 'debian/tests'
115=== added file 'debian/tests/control'
116--- debian/tests/control 1970-01-01 00:00:00 +0000
117+++ debian/tests/control 2014-11-13 15:27:18 +0000
118@@ -0,0 +1,8 @@
119+Tests: lrt-random-gestures
120+Depends: android-tools-adb,
121+ autopilot-touch,
122+ bzr,
123+ imagemagick,
124+ python3-subunit,
125+ python3-autopilot,
126+Restrictions: needs-root
127
128=== added file 'debian/tests/lrt-random-gestures'
129--- debian/tests/lrt-random-gestures 1970-01-01 00:00:00 +0000
130+++ debian/tests/lrt-random-gestures 2014-11-13 15:27:18 +0000
131@@ -0,0 +1,5 @@
132+#!/bin/sh
133+
134+./dep-8-run-lrt.sh "lrt.test_random_gestures"
135+
136+exit $?
137
138=== added file 'dep-8-run-lrt.sh'
139--- dep-8-run-lrt.sh 1970-01-01 00:00:00 +0000
140+++ dep-8-run-lrt.sh 2014-11-13 15:27:18 +0000
141@@ -0,0 +1,72 @@
142+#!/bin/bash
143+set -e
144+
145+if [ -z $1 ]; then
146+ echo 'you must specify the test to run, example: lrt.test_random_gestures'
147+ exit 1
148+fi
149+TEST_NAME=$1
150+
151+# ChrisGagnon has secured special CRASH_IDs for the defined tests via
152+# bdmurray (NOTE that each starts with 'deadbeef').
153+# XXX alesage 20141112
154+# NOTE that that $CRASH_ID needs to appear in whoopsie.conf;
155+# suggestions for implementation in PROVISIONING_IN_CI_README.sh.
156+if [ $TEST_NAME == "lrt.test_random_gestures" ]; then
157+CRASH_ID=deadbeef2b73679bb94cc77874f81c4822482114dd8bf912741713eb15bf61533b5d8176f0d870f758cc6f241445ffd3359debe1616c832a8ab3b7626d9ed369
158+fi
159+# NOTE: re-enable these if and when each test below is brought online.
160+#if [ $TEST_NAME == "lrt.test_switch" ]; then
161+#CRASH_ID=deadbeef17372a2ac165df1ed82002d7cbeeb0aad6adaa39a7a65fc29cb6c724878e3009de7787c88de01911bf874932edb8d11d7debc7506331e8fb5c99a9e3
162+#fi
163+#if [ $test_to_run == &quot;lrt.test_random&quot; ]; then
164+#CRASH_ID=deadbeef2b73679bb94cc77874f81c4822482114dd8bf912741713eb15bf61533b5d8176f0d870f758cc6f241445ffd3359debe1616c832a8ab3b7626d9ed369
165+#fi
166+#if [ $test_to_run == &quot;lrt.test_switch&quot; ]; then
167+#CRASH_ID=deadbeef17372a2ac165df1ed82002d7cbeeb0aad6adaa39a7a65fc29cb6c724878e3009de7787c88de01911bf874932edb8d11d7debc7506331e8fb5c99a9e3
168+#fi
169+#if [ $test_to_run == &quot;lrt.test_ap_core_apps&quot; ]; then
170+#CRASH_ID=deadbeef6ad56ff7b1050f384439a7900acdd7dcce06e81cb051c3417320a19baa4f1769d9fe20e9b01ac5b970d7b1a339526d6edf572d9e2eb7fa3c3232d13c6
171+#fi
172+#if [ $test_to_run == &quot;lrt.test_ap_system&quot; ]; then
173+#CRASH_ID=deadbeef34567890123de0f384439a7900acdd7dcce06e81cb051c3417320a19baa4f1769d9fe20e9b01cd5b970d7b1e339897d6fdf572d9e2eb7fa3c3232d14
174+#fi
175+#if [ $test_to_run == &quot;lrt.test_power&quot; ]; then
176+#CRASH_ID=deadbeefad56ff7b1050f384439a7900acdd7dcce06e81cb051c3417320a19baa4f1769d9fe20e9b01ac5b970d7b1a339526d6edf572d9e2eb7fa3c3232d1376
177+#fi
178+
179+python3 -m subunit.run $TEST_NAME > ~/result.subunit || true
180+chmod a+rw ~/result.subunit
181+
182+# Prepare to whoopsie.
183+# disable flight mode (a random gesture may have enabled)
184+/usr/share/urfkill/scripts/flight-mode 0
185+# wait for wifi a bit
186+sleep 10
187+# enable wifi, the test sometimes disables it
188+ping -c2 launchpad.net || nmcli nm wifi on
189+list_crashes=$(ls /var/crash)
190+if [ -z "$list_crashes" ]; then
191+ echo no crash files found
192+ exit 0
193+fi
194+# wait for crash file to be ready
195+ls /var/crash | grep crash | while read line; do
196+ while [ $(stat -c "%a %n" /var/crash/$line | cut -d ' ' -f1) -le 0 ] ; do
197+ sleep 5
198+ echo "waiting for crash file to become ready" to upload
199+ done
200+done
201+
202+# gather our artifacts
203+ls=$(ls /var/crash)
204+echo $ls > $ADT_ARTIFACTS/crash_files.log
205+cp -R /var/crash/ $ADT_ARTIFACTS/crash
206+cp -R /var/log/system-image $ADT_ARTIFACTS/system-image
207+cp /home/phablet/result.subunit $ADT_ARTIFACTS/result.subunit
208+cp /var/log/syslog $ADT_ARTIFACTS/syslog
209+cp /var/log/kern.log $ADT_ARTIFACTS/kern.log || true
210+cp -R /home/phablet/.cache/upstart $ADT_ARTIFACTS/upstart
211+echo "exiting"
212+
213+exit 1
214
215=== modified file 'lrt/__init__.py'
216--- lrt/__init__.py 2014-10-20 21:25:19 +0000
217+++ lrt/__init__.py 2014-11-13 15:27:18 +0000
218@@ -208,7 +208,6 @@
219 self._start_time = time.clock_gettime(time.CLOCK_MONOTONIC_RAW)
220 self._screenshot_clock = time.clock_gettime(time.CLOCK_MONOTONIC_RAW)
221 self._desired_runtime = 43200 # run for 12 hours
222- unlock_ui() # open greeter
223 turn_off_sound()
224
225 def tearDown(self):
226
227=== modified file 'lrt/test_random_gestures.py'
228--- lrt/test_random_gestures.py 2014-07-23 19:06:02 +0000
229+++ lrt/test_random_gestures.py 2014-11-13 15:27:18 +0000
230@@ -1,6 +1,8 @@
231-
232-"""Generate random gestures until something crashes, or something times out."""
233+#!/usr/bin/python3
234+"""Generate random gestures until something crashes, or something
235+times out."""
236 import random
237+import unittest
238
239 from testtools.content import text_content
240
241@@ -26,3 +28,7 @@
242 else:
243 swipe(SwipeDirection.get_random_direction())
244 self.check_for_crash()
245+
246+
247+if __name__ == '__main__':
248+ unittest.main()

Subscribers

People subscribed via source and target branches

to all changes: