Merge lp:~canonical-ci-engineering/ubuntu-test-cases/boottest into lp:ubuntu-test-cases/touch

Proposed by Paul Larson
Status: Merged
Merged at revision: 366
Proposed branch: lp:~canonical-ci-engineering/ubuntu-test-cases/boottest
Merge into: lp:ubuntu-test-cases/touch
Diff against target: 428 lines (+298/-0)
23 files modified
config/boottest.rc.example (+9/-0)
scripts/boottest.sh (+154/-0)
scripts/device_info.py (+1/-0)
tests/bootfail/README (+15/-0)
tests/bootfail/debian/changelog (+5/-0)
tests/bootfail/debian/compat (+1/-0)
tests/bootfail/debian/control (+10/-0)
tests/bootfail/debian/rules (+4/-0)
tests/bootfail/debian/tests/bootfail (+15/-0)
tests/bootfail/debian/tests/control (+3/-0)
tests/boottest/README (+10/-0)
tests/boottest/debian/changelog (+5/-0)
tests/boottest/debian/compat (+1/-0)
tests/boottest/debian/control (+10/-0)
tests/boottest/debian/rules (+4/-0)
tests/boottest/debian/tests/boottest (+13/-0)
tests/boottest/debian/tests/control.template (+4/-0)
tests/getpkgsrc/debian/changelog (+5/-0)
tests/getpkgsrc/debian/compat (+1/-0)
tests/getpkgsrc/debian/control (+9/-0)
tests/getpkgsrc/debian/rules (+4/-0)
tests/getpkgsrc/debian/tests/control (+2/-0)
tests/getpkgsrc/debian/tests/getpkgsrc.template (+13/-0)
To merge this branch: bzr merge lp:~canonical-ci-engineering/ubuntu-test-cases/boottest
Reviewer Review Type Date Requested Status
Francis Ginther Approve
Review via email: mp+249423@code.launchpad.net

Description of the change

As discussed in the standup today, let's merge this into the same branch we normally use for smoke testing.

To post a comment you must log in.
Revision history for this message
Paul Larson (pwlars) wrote :

See also: https://code.launchpad.net/~pwlars/auto-package-testing/use-touch-branch/+merge/249426 which makes use of this in the jenkins template

Revision history for this message
Francis Ginther (fginther) wrote :

There is some cleanup that could be done, but it's not urgent if this needs to land right away. I've created an MP with the cleanup here:
https://code.launchpad.net/~fginther/ubuntu-test-cases/boottest-cleanup/+merge/249445

I'll approve as the cleanup can just as easily be done after the merge.

review: Approve
407. By Paul Larson

Remove defunct boottest.py and its tests and minor README cleanup.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'config'
2=== added file 'config/boottest.rc.example'
3--- config/boottest.rc.example 1970-01-01 00:00:00 +0000
4+++ config/boottest.rc.example 2015-02-12 15:55:25 +0000
5@@ -0,0 +1,9 @@
6+# This file is sourced by boottest.sh
7+
8+# Example Config Follows - These are the current defaults
9+#
10+# REVISION=81
11+# ARCH=krillin
12+# PHABLET_PASSWORD=0000
13+# ADT_TIMEOUT=600
14+# VERSION=1.2.51-0ubuntu3
15
16=== added file 'scripts/boottest.sh'
17--- scripts/boottest.sh 1970-01-01 00:00:00 +0000
18+++ scripts/boottest.sh 2015-02-12 15:55:25 +0000
19@@ -0,0 +1,154 @@
20+#!/bin/bash
21+set -ex
22+
23+# Where am I ?
24+BASEDIR=$(dirname $(readlink -f $0))/..
25+
26+# The release to test the package on.
27+export RELEASE=${1:-vivid}
28+# The source package under test.
29+export SRC_PKG_NAME=${2:-libpng}
30+# The phone name.
31+export NODE_NAME=$3
32+# Default adt-run timeout
33+export ADT_TIMEOUT=${ADT_TIMEOUT:-600}
34+
35+# XXX psivaa 20150130: This is to use /var/local/boottest
36+# directory in tachash for rsyncing the results back.
37+# This should be revisited and fixed when the actual directory
38+# is decided for final
39+# May need tweaking/ removing the boottest section of /etc/rsyncd.conf
40+# in tachash
41+export RSYNC_DEST=${RSYNC_DEST:-rsync://tachash.ubuntu-ci/boottest/}
42+
43+# If the NODE_NAME is unset, we're running locally, the commands that
44+# requires a phone are prefixed with "[ -z ${NODE_NAME} ] ||"
45+# If you have a phone available locally, set ANDROID_SERIAL and NODE_NAME=yes
46+
47+# These can be set by jenkins when running in that context
48+
49+# ANDROID_SERIAL: The phone ID.
50+[ -z ${NODE_NAME} ] || export ANDROID_SERIAL=${ANDROID_SERIAL:-$(${BASEDIR}/scripts/get-adb-id ${NODE_NAME})}
51+# The package version to test
52+export VERSION=${VERSION:-1.2.51-0ubuntu3}
53+
54+BOOTTESTRC=${HOME}/.ubuntu-ci/boottest.rc
55+if [ -f $BOOTTESTRC ]; then
56+ source $BOOTTESTRC
57+fi
58+
59+# FIXME: Should be provided -- vila 2015-01-26
60+ARCH="${ARCH:-krillin}"
61+
62+PHABLET_PASSWORD="${PHABLET_PASSWORD-0000}"
63+
64+# The provision.sh and run-smoke scripts can install extra packages to meet
65+# the needs of image testing. Since we are installing specific packages from
66+# the archive, this needs to be disabled.
67+export SKIP_CLICK=1
68+export SKIP_TESTCONFIG=1
69+
70+# Ensures we start with a usable phone
71+[ -z ${NODE_NAME} ] || ${BASEDIR}/scripts/recover.py ${NODE_NAME}
72+
73+TESTS=${BASEDIR}/tests
74+
75+# Provision the device
76+# Allow the image revision to be overridden if the latest is unusable
77+REVISION="${REVISION:-0}"
78+PROV_CMD="${BASEDIR}/scripts/provision.sh \
79+ -r $REVISION \
80+ -n ${HOME}/.ubuntu-ci/wifi.conf -w"
81+[ -z ${NODE_NAME} ] || ${PROV_CMD} -s ${ANDROID_SERIAL}
82+
83+# Generate the adt-run setup-command
84+rm -f adt-commands || true
85+# apt-get update like adt-run does it
86+echo "(apt-get update || (sleep 15; apt-get update))" >> adt-commands
87+
88+
89+# --no-built-binaries should come first
90+# --debug helps while debugging, can be removed otherwise
91+ADT_CMD="timeout ${ADT_TIMEOUT} adt-run --debug --no-built-binaries"
92+# ADT_VIRT can be overridden for local tests,
93+# it defaults to ${ANDROID_SERIAL} phone via the adb/ssh combo
94+ADT_VIRT=${ADT_VIRT:-adt-virt-ssh -s /usr/share/autopkgtest/ssh-setup/adb \
95+ -- -s "${ANDROID_SERIAL}"}
96+# - setting up -proposed and doing apt-get update
97+# - via adt-virt-ssh with a setup from adb
98+# - using --apt-upgrade to ensure we only deal with packages already on the
99+# phone (see above)
100+ADT_OPTS="--apt-pocket=proposed\
101+ --setup-commands=adt-commands \
102+ --- ${ADT_VIRT}"
103+
104+
105+# Inject the package name into getpkgsrc DEP8 test
106+FROM=${TESTS}/getpkgsrc/debian/tests/getpkgsrc.template
107+TARGET=${TESTS}/getpkgsrc/debian/tests/getpkgsrc
108+sed -e "s/{{ source_package }}/${SRC_PKG_NAME}/" ${FROM} > ${TARGET}
109+
110+# Execute a first test to get the package source tree from the testbed.
111+PKG_SRC_DIR=pkgsrc
112+rm -fr ${PKG_SRC_DIR} || true
113+set +e
114+${ADT_CMD} --unbuilt-tree ${TESTS}/getpkgsrc -o ${PKG_SRC_DIR} ${ADT_OPTS}
115+RET=$?
116+set -e
117+if [ $RET -ne 0 ]; then
118+ # Something went wrong with the testbed and/or adt-run itself
119+ errfile=${PKG_SRC_DIR}/${RELEASE}_${ARCH}_${SRC_PKG_NAME}_$(date +%Y%m%d-%H%M%S).error
120+ echo "$RELEASE $ARCH $SRC_PKG_NAME" > $errfile
121+ [ -f "$errfile" ] && rsync -a $errfile $RSYNC_DEST/${RELEASE}/tmp/ || true
122+ # Ensure we leave a usable phone
123+ [ -z ${NODE_NAME} ] || test-runner/scripts/recover.py ${NODE_NAME}
124+
125+ exit $RET
126+fi
127+
128+if [ -n "${FORCE_FAILURE}" ]; then
129+ # Force a boottest failure by running an alternate DEP8 test
130+ set +e
131+ ${ADT_CMD} --unbuilt-tree ${TESTS}/bootfail -o results ${ADT_OPTS}
132+ RET=$?
133+ set -e
134+else
135+ # Inject the boot DEP8 test into the package source tree
136+ SOURCE_DIR=$(ls -d ${PKG_SRC_DIR}/artifacts/${SRC_PKG_NAME}-*)
137+ FROM=${TESTS}/boottest/debian/tests
138+ TARGET="${SOURCE_DIR}/debian/tests"
139+ mkdir -p ${TARGET} # For packages that don't define DEP8 tests
140+ # Inject the binary packages built previously
141+ BIN_PACKAGES=$(tr '\n' ',' < ${PKG_SRC_DIR}/artifacts/needs_install.packages | sed -e s/,$//)
142+ sed -e "s/{{ bin_packages }}/${BIN_PACKAGES}/" \
143+ ${FROM}/control.template > ${TARGET}/control
144+ cp ${FROM}/boottest ${TARGET}
145+
146+ # Now execute the boot test from inside the pkg source tree
147+ set +e
148+ ${ADT_CMD} --unbuilt-tree ${SOURCE_DIR} -o results ${ADT_OPTS}
149+ RET=$?
150+ set -e
151+fi
152+
153+# Return Skipped as Passed
154+[ $RET -eq 2 ] && RET=0
155+
156+if [ -e "results/testpkg-version" -a -e "results/testbed-packages" ]; then
157+ result='PASS'
158+ resultfile=results/${RELEASE}_${ARCH}_${SRC_PKG_NAME}_$(date +%Y%m%d-%H%M%S).result
159+ [ $RET -gt 0 ] && result="FAIL"
160+ set +x # quiet mode as it pollutes output
161+ echo "$RELEASE $ARCH $(cat results/testpkg-version) $result $(sort -u results/*-packages|tr -s '[\n\t]' ' ')" > $resultfile
162+ [ -f "$resultfile" ] && rsync -a $resultfile $RSYNC_DEST/${RELEASE}/tmp/ || true
163+else
164+ # Something went wrong with the testbed
165+ errfile=results/${RELEASE}_${ARCH}_${SRC_PKG_NAME}_$(date +%Y%m%d-%H%M%S).error
166+ echo "$RELEASE $ARCH $SRC_PKG_NAME" > $errfile
167+ [ -f "$errfile" ] && rsync -a $errfile $RSYNC_DEST/${RELEASE}/tmp/ || true
168+fi
169+
170+# Ensure we leave a usable phone
171+[ -z ${NODE_NAME} ] || test-runner/scripts/recover.py ${NODE_NAME}
172+
173+exit $RET
174
175=== modified file 'scripts/device_info.py'
176--- scripts/device_info.py 2015-01-29 15:30:26 +0000
177+++ scripts/device_info.py 2015-02-12 15:55:25 +0000
178@@ -263,6 +263,7 @@
179 "mako-20": TouchDevice("mako", "05083705e0d29402",
180 relay_url="http://decatur.ubuntu-ci",
181 bank=1, power_pin=2, volume_down_pin=3),
182+ "mako-fginther": TouchDevice("mako", "04c3c2be1d5248b3"),
183 "ps-manta-01": TouchDevice("manta", "R32D203DDZR"),
184 "manta-01": TouchDevice("manta", "R32D102RPZL"),
185 "manta-02": TouchDevice("manta", "R32D102RPPK"),
186
187=== added directory 'tests/bootfail'
188=== added file 'tests/bootfail/README'
189--- tests/bootfail/README 1970-01-01 00:00:00 +0000
190+++ tests/bootfail/README 2015-02-12 15:55:25 +0000
191@@ -0,0 +1,15 @@
192+!!CAUTION!!
193+Do not execute this test on a device without manual control.
194+The test will render the device unbootable and disable adb.
195+Manual control is required to return the device to fastboot.
196+
197+To run the tests:
198+
199+$ export ANDROID_SERIAL=[adb device id]
200+$ phablet-config writable-image
201+
202+$ adt-run --no-built-binaries --unbuilt-tree bootfail -o log-dir --- \
203+ ssh -s /usr/share/autopkgtest/ssh-setup/adb -- -s $ANDROID_SERIAL
204+
205+Exit code is '0' if it passed.
206+Logs are stored under log-dir as specified with the '-o' option.
207
208=== added directory 'tests/bootfail/debian'
209=== added file 'tests/bootfail/debian/changelog'
210--- tests/bootfail/debian/changelog 1970-01-01 00:00:00 +0000
211+++ tests/bootfail/debian/changelog 2015-02-12 15:55:25 +0000
212@@ -0,0 +1,5 @@
213+bootfail (0.1) vivid; urgency=medium
214+
215+ * Initial release.
216+
217+ -- Francis Ginther <francis.ginther@canonical.com> Mon, 26 Jan 2015 21:34:20 -0600
218
219=== added file 'tests/bootfail/debian/compat'
220--- tests/bootfail/debian/compat 1970-01-01 00:00:00 +0000
221+++ tests/bootfail/debian/compat 2015-02-12 15:55:25 +0000
222@@ -0,0 +1,1 @@
223+9
224
225=== added file 'tests/bootfail/debian/control'
226--- tests/bootfail/debian/control 1970-01-01 00:00:00 +0000
227+++ tests/bootfail/debian/control 2015-02-12 15:55:25 +0000
228@@ -0,0 +1,10 @@
229+Source: bootfail
230+Section: misc
231+Maintainer: Canonical CI Engineering <canonical-ci-engineering@lists.launchpad.net>
232+Build-Depends: debhelper (>= 9),
233+Standards-Version: 3.9.4
234+
235+Package: bootfail
236+Architecture: all
237+Description: A boottest dep8 test package designed to fail
238+ A boottest dep8 test package designed to fail.
239
240=== added file 'tests/bootfail/debian/rules'
241--- tests/bootfail/debian/rules 1970-01-01 00:00:00 +0000
242+++ tests/bootfail/debian/rules 2015-02-12 15:55:25 +0000
243@@ -0,0 +1,4 @@
244+#!/usr/bin/make -f
245+
246+%:
247+ dh $@
248
249=== added directory 'tests/bootfail/debian/tests'
250=== added file 'tests/bootfail/debian/tests/bootfail'
251--- tests/bootfail/debian/tests/bootfail 1970-01-01 00:00:00 +0000
252+++ tests/bootfail/debian/tests/bootfail 2015-02-12 15:55:25 +0000
253@@ -0,0 +1,15 @@
254+#!/bin/bash
255+
256+rc=0
257+
258+if [ "${ADT_REBOOT_MARK}" == "reboot_mark" ]; then
259+ ls > "${ADT_ARTIFACTS}"/ls.txt
260+ rc=$?
261+else
262+ # CAUITON! The following will render a phone device unbootable
263+ # It also requires manual control to reset the device into fastboot
264+ sudo apt-get remove -y --force-yes lxc
265+ /tmp/autopkgtest-reboot reboot_mark
266+ echo "Are we having fun yet?"
267+fi
268+exit $rc
269
270=== added file 'tests/bootfail/debian/tests/control'
271--- tests/bootfail/debian/tests/control 1970-01-01 00:00:00 +0000
272+++ tests/bootfail/debian/tests/control 2015-02-12 15:55:25 +0000
273@@ -0,0 +1,3 @@
274+Tests: bootfail
275+Depends:
276+Restrictions: needs-root
277
278=== added directory 'tests/boottest'
279=== added file 'tests/boottest/README'
280--- tests/boottest/README 1970-01-01 00:00:00 +0000
281+++ tests/boottest/README 2015-02-12 15:55:25 +0000
282@@ -0,0 +1,10 @@
283+To run the tests:
284+
285+$ export ANDROID_SERIAL=[adb device id]
286+$ phablet-config writable-image
287+
288+$ adt-run --unbuilt-tree --no-built-binaries boottest -o log-dir --- \
289+ ssh -s /usr/share/autopkgtest/ssh-setup/adb -- -s $ANDROID_SERIAL
290+
291+Exit code is '0' if it passed.
292+Logs are stored under log-dir as specified with the '-o' option.
293
294=== added directory 'tests/boottest/debian'
295=== added file 'tests/boottest/debian/changelog'
296--- tests/boottest/debian/changelog 1970-01-01 00:00:00 +0000
297+++ tests/boottest/debian/changelog 2015-02-12 15:55:25 +0000
298@@ -0,0 +1,5 @@
299+boottest (0.1) vivid; urgency=medium
300+
301+ * Initial release.
302+
303+ -- Francis Ginther <francis.ginther@canonical.com> Fri, 16 Jan 2015 14:34:34 -0600
304
305=== added file 'tests/boottest/debian/compat'
306--- tests/boottest/debian/compat 1970-01-01 00:00:00 +0000
307+++ tests/boottest/debian/compat 2015-02-12 15:55:25 +0000
308@@ -0,0 +1,1 @@
309+9
310
311=== added file 'tests/boottest/debian/control'
312--- tests/boottest/debian/control 1970-01-01 00:00:00 +0000
313+++ tests/boottest/debian/control 2015-02-12 15:55:25 +0000
314@@ -0,0 +1,10 @@
315+Source: boottest
316+Section: misc
317+Maintainer: Canonical CI Engineering <canonical-ci-engineering@lists.launchpad.net>
318+Build-Depends: debhelper (>= 9),
319+Standards-Version: 3.9.4
320+
321+Package: boottest
322+Architecture: all
323+Description: A boottest dep8 test package
324+ A boottest dep8 test package.
325
326=== added file 'tests/boottest/debian/rules'
327--- tests/boottest/debian/rules 1970-01-01 00:00:00 +0000
328+++ tests/boottest/debian/rules 2015-02-12 15:55:25 +0000
329@@ -0,0 +1,4 @@
330+#!/usr/bin/make -f
331+
332+%:
333+ dh $@
334
335=== added directory 'tests/boottest/debian/tests'
336=== added file 'tests/boottest/debian/tests/boottest'
337--- tests/boottest/debian/tests/boottest 1970-01-01 00:00:00 +0000
338+++ tests/boottest/debian/tests/boottest 2015-02-12 15:55:25 +0000
339@@ -0,0 +1,13 @@
340+#!/bin/bash
341+set -e
342+
343+rc=0
344+
345+if [ "${ADT_REBOOT_MARK}" == "reboot_mark" ]; then
346+ ls > "${ADT_ARTIFACTS}"/ls.txt
347+ rc=$?
348+else
349+ /tmp/autopkgtest-reboot reboot_mark
350+ echo "Are we having fun yet?"
351+fi
352+exit $rc
353
354=== added file 'tests/boottest/debian/tests/control.template'
355--- tests/boottest/debian/tests/control.template 1970-01-01 00:00:00 +0000
356+++ tests/boottest/debian/tests/control.template 2015-02-12 15:55:25 +0000
357@@ -0,0 +1,4 @@
358+Tests: boottest
359+# Make adt-run install the binary packages by declaring a dep
360+Depends: {{ bin_packages }}
361+Restrictions: needs-root
362
363=== added directory 'tests/getpkgsrc'
364=== added directory 'tests/getpkgsrc/debian'
365=== added file 'tests/getpkgsrc/debian/changelog'
366--- tests/getpkgsrc/debian/changelog 1970-01-01 00:00:00 +0000
367+++ tests/getpkgsrc/debian/changelog 2015-02-12 15:55:25 +0000
368@@ -0,0 +1,5 @@
369+getpkgsrc (0.1) vivid; urgency=medium
370+
371+ * Initial release.
372+
373+ -- Vincent Ladeuil <vila+ci@canonical.com> Sat, 24 Jan 2015 16:07:34 +0100
374
375=== added file 'tests/getpkgsrc/debian/compat'
376--- tests/getpkgsrc/debian/compat 1970-01-01 00:00:00 +0000
377+++ tests/getpkgsrc/debian/compat 2015-02-12 15:55:25 +0000
378@@ -0,0 +1,1 @@
379+9
380
381=== added file 'tests/getpkgsrc/debian/control'
382--- tests/getpkgsrc/debian/control 1970-01-01 00:00:00 +0000
383+++ tests/getpkgsrc/debian/control 2015-02-12 15:55:25 +0000
384@@ -0,0 +1,9 @@
385+Source: getpkgsrc
386+Section: misc
387+Maintainer: Canonical CI Engineering <canonical-ci-engineering@lists.launchpad.net>
388+Build-Depends: debhelper (>= 9),
389+Standards-Version: 3.9.4
390+
391+Package: getpkgsrc
392+Architecture: all
393+Description: A dep8 test providing a package source from inside the testbed.
394
395=== added file 'tests/getpkgsrc/debian/rules'
396--- tests/getpkgsrc/debian/rules 1970-01-01 00:00:00 +0000
397+++ tests/getpkgsrc/debian/rules 2015-02-12 15:55:25 +0000
398@@ -0,0 +1,4 @@
399+#!/usr/bin/make -f
400+
401+%:
402+ dh $@
403
404=== added directory 'tests/getpkgsrc/debian/tests'
405=== added file 'tests/getpkgsrc/debian/tests/control'
406--- tests/getpkgsrc/debian/tests/control 1970-01-01 00:00:00 +0000
407+++ tests/getpkgsrc/debian/tests/control 2015-02-12 15:55:25 +0000
408@@ -0,0 +1,2 @@
409+Tests: getpkgsrc
410+Depends: dpkg-dev
411
412=== added file 'tests/getpkgsrc/debian/tests/getpkgsrc.template'
413--- tests/getpkgsrc/debian/tests/getpkgsrc.template 1970-01-01 00:00:00 +0000
414+++ tests/getpkgsrc/debian/tests/getpkgsrc.template 2015-02-12 15:55:25 +0000
415@@ -0,0 +1,13 @@
416+#!/bin/bash
417+set -e
418+
419+cd ${ADT_ARTIFACTS}
420+# List installed packages, removing the ':{arch}' suffix
421+dpkg-query -f '${binary:Package}\n' -W | sed -e 's/:.*$//' > installed.packages
422+# adt-run complains and fails the test if sdterr is not empty
423+# redirect stderr to preserve the output for reference
424+apt-get source {{ source_package }} 2> apt-get-source.stderr
425+# Get the defined binary packages
426+grep ^Package: {{ source_package }}*/debian/control | sed -e 's/^Package: //' | sort > binary.packages
427+# Get the binary packages already installed
428+comm -1 -2 binary.packages installed.packages > needs_install.packages

Subscribers

People subscribed via source and target branches