Merge lp:~laney/ubuntu-test-cases/dbus-etc-machine-id into lp:ubuntu-test-cases

Proposed by Iain Lane
Status: Superseded
Proposed branch: lp:~laney/ubuntu-test-cases/dbus-etc-machine-id
Merge into: lp:ubuntu-test-cases
Diff against target: 1931 lines (+1624/-0) (has conflicts)
57 files modified
README (+17/-0)
configs/oem.conf (+4/-0)
preseeds/default.cfg (+40/-0)
preseeds/default_btrfs.cfg (+41/-0)
preseeds/default_de.cfg (+40/-0)
preseeds/encrypted_home.cfg (+46/-0)
preseeds/lvm.cfg (+40/-0)
preseeds/oem.cfg (+43/-0)
runlists/default.run (+8/-0)
runlists/default_btrfs.run (+8/-0)
runlists/default_de.run (+8/-0)
runlists/encrypted_home.run (+8/-0)
runlists/live_session.run (+8/-0)
runlists/lvm.run (+4/-0)
runlists/min_config.run (+11/-0)
runlists/oem.run (+8/-0)
runlists/ubiquity.run (+6/-0)
scripts/base.sh (+52/-0)
scripts/default.sh (+10/-0)
scripts/default_btrfs.sh (+10/-0)
scripts/default_de.sh (+10/-0)
scripts/encrypted_home.sh (+10/-0)
scripts/health-check.sh (+12/-0)
scripts/lvm.sh (+10/-0)
scripts/min_config.sh (+12/-0)
scripts/oem.sh (+11/-0)
testsuites/usit/archive_location/tc_control (+9/-0)
testsuites/usit/archive_location/test.py (+54/-0)
testsuites/usit/dbus_machine_id/tc_control (+15/-0)
testsuites/usit/dbus_machine_id/test.py (+71/-0)
testsuites/usit/desktop_shortcut_exists/tc_control (+9/-0)
testsuites/usit/desktop_shortcut_exists/test.py (+42/-0)
testsuites/usit/disk_not_full/tc_control (+9/-0)
testsuites/usit/disk_not_full/test.py (+58/-0)
testsuites/usit/empty_startup_app/setup.py (+46/-0)
testsuites/usit/empty_startup_app/tc_control (+14/-0)
testsuites/usit/empty_startup_app/test.py (+82/-0)
testsuites/usit/encrypted_home_content/tc_control (+14/-0)
testsuites/usit/encrypted_home_content/test.py (+73/-0)
testsuites/usit/encrypted_home_permissions/tc_control (+13/-0)
testsuites/usit/encrypted_home_permissions/test.py (+63/-0)
testsuites/usit/no_rofs_machine_id/tc_control (+4/-0)
testsuites/usit/no_rofs_machine_id/test.py (+53/-0)
testsuites/usit/oem_pkg_installed/tc_control (+12/-0)
testsuites/usit/oem_pkg_installed/test.py (+66/-0)
testsuites/usit/out_of_memory/tc_control (+11/-0)
testsuites/usit/out_of_memory/test.py (+49/-0)
testsuites/usit/read_write/tc_control (+19/-0)
testsuites/usit/read_write/test.py (+62/-0)
testsuites/usit/total_disk/tc_control (+9/-0)
testsuites/usit/total_disk/test.py (+54/-0)
testsuites/usit/total_mem/tc_control (+9/-0)
testsuites/usit/total_mem/test.py (+62/-0)
testsuites/usit/ts_control (+1/-0)
testsuites/usit/tslist.run (+14/-0)
testsuites/usit/ubiquity/tc_control (+4/-0)
testsuites/usit/ubiquity/test.py (+146/-0)
Conflict adding file scripts.  Moved existing file to scripts.moved.
To merge this branch: bzr merge lp:~laney/ubuntu-test-cases/dbus-etc-machine-id
Reviewer Review Type Date Requested Status
Ubuntu Test Case Developers Pending
Review via email: mp+253254@code.launchpad.net

This proposal has been superseded by a proposal from 2015-03-18.

Description of the change

D-Bus uses /etc/machine-id and the other file is no longer necessary.

Do we need to keep backwards compatibility?

To post a comment you must log in.

Unmerged revisions

50. By Iain Lane

dbus uses /etc/machine-id now

Fallback to the old file for backwards compatibility - dbus will still read this.

49. By Para Siva

/var/log/installer log archiving

48. By Paul Larson

New btrfs test

47. By Paul Larson

Add support for extra args

46. By Paul Larson

add health-check.sh

45. By Para Siva

remove duplicate late command too in default.cfg

44. By Paul Larson

remove duplicate early_command in default.cfg

43. By Paul Larson

Temporary workaround for LP:1258245

42. By Paul Larson

preseed changes to work around https://bugs.launchpad.net/ubuntu/+source/rsyslog/+bug/1258245

41. By Javier Collado

Merged changes to remove latecommand for lvm scenario (LP: #1167904)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'README'
2--- README 1970-01-01 00:00:00 +0000
3+++ README 2015-03-17 18:25:33 +0000
4@@ -0,0 +1,17 @@
5+This is a branch to run smoke tests for desktop images (i386/amd64)
6+
7+To use it, the utah-client package must be installed. After that, the client
8+can be launched in any of the following ways:
9+
10+- Launchpad url
11+utah -r lp:ubuntu-test-cases/desktop/runlists/default.run
12+
13+- master.run downloaded
14+utah -r <path to runlist file>
15+
16+This requires to download the runlist file manually to use it.
17+
18+To work with a local branch, the UTAH_BRANCH environment varible should be set
19+to a URL that can be understood by the `bzr export` command, so that the test
20+suites are downloaded from that branch instead of from launchpad. For example:
21+export UTAH_BRANCH=bzr+ssh://127.0.0.1/home/user/code/bzr/utah/desktop
22
23=== added directory 'configs'
24=== added file 'configs/oem.conf'
25--- configs/oem.conf 1970-01-01 00:00:00 +0000
26+++ configs/oem.conf 2015-03-17 18:25:33 +0000
27@@ -0,0 +1,4 @@
28+{
29+ "sshprivatekey": "~/.ssh/utah",
30+ "user": "oem"
31+}
32
33=== added directory 'preseeds'
34=== added file 'preseeds/default.cfg'
35--- preseeds/default.cfg 1970-01-01 00:00:00 +0000
36+++ preseeds/default.cfg 2015-03-17 18:25:33 +0000
37@@ -0,0 +1,40 @@
38+#
39+# Copyright (C) 2010, Canonical Ltd (http://www.canonical.com/)
40+#
41+# This file is part of ubuntu-server-iso-testing.
42+#
43+# ubuntu-server-iso-testing is free software: you can redistribute it
44+# and/or modify it under the terms of the GNU General Public License
45+# as published by the Free Software Foundation, either version 3 of
46+# the License, or (at your option) any later version.
47+#
48+# ubuntu-server-iso-testing is distributed in the hope that it will
49+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
50+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
51+# GNU General Public License for more details.
52+#
53+# You should have received a copy of the GNU General Public License
54+# along with ubuntu-server-iso-testing. If not, see
55+# <http://www.gnu.org/licenses/>.
56+#
57+
58+d-i debian-installer/locale string en_US.UTF-8
59+d-i netcfg/get_hostname string utah-example
60+d-i partman-auto/method string regular
61+#need this for desktop
62+d-i partman/choose_partition select Finish partitioning and write changes to disk
63+#need this for cobbler
64+d-i partman/confirm boolean true
65+#need this for non-desktop
66+d-i partman/confirm_nooverwrite boolean true
67+d-i time/zone string Etc/UTC
68+d-i passwd/user-fullname string UTAH
69+d-i passwd/username string utah
70+d-i passwd/user-password password !ubuntu123
71+d-i passwd/user-password-again password !ubuntu123
72+d-i pkgsel/include string openssh-server python-yaml bzr git gdebi-core
73+#need this for non-desktop
74+d-i finish-install/reboot_in_progress note
75+#Temporary workaround for LP:1258245
76+d-i preseed/early_command string chmod 666 /dev/ttyS0
77+d-i preseed/late_command string chroot /target /usr/sbin/usermod -G dialout syslog
78
79=== added file 'preseeds/default_btrfs.cfg'
80--- preseeds/default_btrfs.cfg 1970-01-01 00:00:00 +0000
81+++ preseeds/default_btrfs.cfg 2015-03-17 18:25:33 +0000
82@@ -0,0 +1,41 @@
83+#
84+# Copyright (C) 2010, Canonical Ltd (http://www.canonical.com/)
85+#
86+# This file is part of ubuntu-server-iso-testing.
87+#
88+# ubuntu-server-iso-testing is free software: you can redistribute it
89+# and/or modify it under the terms of the GNU General Public License
90+# as published by the Free Software Foundation, either version 3 of
91+# the License, or (at your option) any later version.
92+#
93+# ubuntu-server-iso-testing is distributed in the hope that it will
94+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
95+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96+# GNU General Public License for more details.
97+#
98+# You should have received a copy of the GNU General Public License
99+# along with ubuntu-server-iso-testing. If not, see
100+# <http://www.gnu.org/licenses/>.
101+#
102+
103+d-i debian-installer/locale string en_US.UTF-8
104+d-i netcfg/get_hostname string utah-example
105+d-i partman-auto/method string regular
106+d-i partman/default_filesystem string btrfs
107+#need this for desktop
108+d-i partman/choose_partition select Finish partitioning and write changes to disk
109+#need this for cobbler
110+d-i partman/confirm boolean true
111+#need this for non-desktop
112+d-i partman/confirm_nooverwrite boolean true
113+d-i time/zone string Etc/UTC
114+d-i passwd/user-fullname string UTAH
115+d-i passwd/username string utah
116+d-i passwd/user-password password !ubuntu123
117+d-i passwd/user-password-again password !ubuntu123
118+d-i pkgsel/include string openssh-server python-yaml bzr git gdebi-core
119+#need this for non-desktop
120+d-i finish-install/reboot_in_progress note
121+#Temporary workaround for LP:1258245
122+d-i preseed/early_command string chmod 666 /dev/ttyS0
123+d-i preseed/late_command string chroot /target /usr/sbin/usermod -G dialout syslog
124
125=== added file 'preseeds/default_de.cfg'
126--- preseeds/default_de.cfg 1970-01-01 00:00:00 +0000
127+++ preseeds/default_de.cfg 2015-03-17 18:25:33 +0000
128@@ -0,0 +1,40 @@
129+#
130+# Copyright (C) 2010, Canonical Ltd (http://www.canonical.com/)
131+#
132+# This file is part of ubuntu-server-iso-testing.
133+#
134+# ubuntu-server-iso-testing is free software: you can redistribute it
135+# and/or modify it under the terms of the GNU General Public License
136+# as published by the Free Software Foundation, either version 3 of
137+# the License, or (at your option) any later version.
138+#
139+# ubuntu-server-iso-testing is distributed in the hope that it will
140+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
141+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
142+# GNU General Public License for more details.
143+#
144+# You should have received a copy of the GNU General Public License
145+# along with ubuntu-server-iso-testing. If not, see
146+# <http://www.gnu.org/licenses/>.
147+#
148+
149+d-i debian-installer/locale string de_DE.UTF-8
150+d-i netcfg/get_hostname string utah-example
151+d-i partman-auto/method string regular
152+#need this for desktop
153+d-i partman/choose_partition select Finish partitioning and write changes to disk
154+#need this for cobbler
155+d-i partman/confirm boolean true
156+#need this for non-desktop
157+d-i partman/confirm_nooverwrite boolean true
158+d-i time/zone string US/Eastern
159+d-i passwd/user-fullname string UTAH
160+d-i passwd/username string utah
161+d-i passwd/user-password password !ubuntu123
162+d-i passwd/user-password-again password !ubuntu123
163+d-i pkgsel/include string openssh-server python-yaml bzr git gdebi-core
164+#need this for non-desktop
165+d-i finish-install/reboot_in_progress note
166+#Temporary workaround for LP:1258245
167+d-i preseed/early_command string chmod 666 /dev/ttyS0
168+d-i preseed/late_command string chroot /target /usr/sbin/usermod -G dialout syslog
169
170=== added file 'preseeds/encrypted_home.cfg'
171--- preseeds/encrypted_home.cfg 1970-01-01 00:00:00 +0000
172+++ preseeds/encrypted_home.cfg 2015-03-17 18:25:33 +0000
173@@ -0,0 +1,46 @@
174+#
175+# Copyright (C) 2010, Canonical Ltd (http://www.canonical.com/)
176+#
177+# This file is part of ubuntu-server-iso-testing.
178+#
179+# ubuntu-server-iso-testing is free software: you can redistribute it
180+# and/or modify it under the terms of the GNU General Public License
181+# as published by the Free Software Foundation, either version 3 of
182+# the License, or (at your option) any later version.
183+#
184+# ubuntu-server-iso-testing is distributed in the hope that it will
185+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
186+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
187+# GNU General Public License for more details.
188+#
189+# You should have received a copy of the GNU General Public License
190+# along with ubuntu-server-iso-testing. If not, see
191+# <http://www.gnu.org/licenses/>.
192+#
193+
194+d-i debian-installer/locale string en_US.UTF-8
195+d-i netcfg/get_hostname string utah-example
196+d-i partman-auto/method string regular
197+#need this for desktop
198+d-i partman/choose_partition select Finish partitioning and write changes to disk
199+#need this for cobbler
200+d-i partman/confirm boolean true
201+#need this for non-desktop
202+d-i partman/confirm_nooverwrite boolean true
203+d-i time/zone string Etc/UTC
204+d-i passwd/user-fullname string UTAH
205+d-i passwd/username string utah
206+d-i passwd/user-password password !ubuntu123
207+d-i passwd/user-password-again password !ubuntu123
208+d-i pkgsel/include string openssh-server python-yaml bzr git gdebi-core
209+
210+# Encrypt home directory
211+# Auto-login and encrypted home are exclusives
212+d-i user-setup/encrypt-home boolean true
213+d-i passwd/auto-login boolean false
214+
215+#need this for non-desktop
216+d-i finish-install/reboot_in_progress note
217+#Temporary workaround for LP:1258245
218+d-i preseed/early_command string chmod 666 /dev/ttyS0
219+d-i preseed/late_command string chroot /target /usr/sbin/usermod -G dialout syslog
220
221=== added file 'preseeds/lvm.cfg'
222--- preseeds/lvm.cfg 1970-01-01 00:00:00 +0000
223+++ preseeds/lvm.cfg 2015-03-17 18:25:33 +0000
224@@ -0,0 +1,40 @@
225+#
226+# Copyright (C) 2010-2013, Canonical Ltd (http://www.canonical.com/)
227+#
228+# This file is part of ubuntu-server-iso-testing.
229+#
230+# ubuntu-server-iso-testing is free software: you can redistribute it
231+# and/or modify it under the terms of the GNU General Public License
232+# as published by the Free Software Foundation, either version 3 of
233+# the License, or (at your option) any later version.
234+#
235+# ubuntu-server-iso-testing is distributed in the hope that it will
236+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
237+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
238+# GNU General Public License for more details.
239+#
240+# You should have received a copy of the GNU General Public License
241+# along with ubuntu-server-iso-testing. If not, see
242+# <http://www.gnu.org/licenses/>.
243+#
244+
245+d-i debian-installer/locale string en_US.UTF-8
246+d-i netcfg/get_hostname string utah-example
247+d-i partman-auto/method string lvm
248+#need this for desktop
249+d-i partman/choose_partition select Finish partitioning and write changes to disk
250+#need this for cobbler
251+d-i partman/confirm boolean true
252+#need this for non-desktop
253+d-i partman/confirm_nooverwrite boolean true
254+d-i time/zone string Etc/UTC
255+d-i passwd/user-fullname string UTAH
256+d-i passwd/username string utah
257+d-i passwd/user-password password !ubuntu123
258+d-i passwd/user-password-again password !ubuntu123
259+d-i pkgsel/include string openssh-server python-yaml bzr git gdebi-core
260+#need this for non-desktop
261+d-i finish-install/reboot_in_progress note
262+#Temporary workaround for LP:1258245
263+d-i preseed/early_command string chmod 666 /dev/ttyS0
264+d-i preseed/late_command string chroot /target /usr/sbin/usermod -G dialout syslog
265
266=== added symlink 'preseeds/min_config.cfg'
267=== target is u'default.cfg'
268=== added file 'preseeds/oem.cfg'
269--- preseeds/oem.cfg 1970-01-01 00:00:00 +0000
270+++ preseeds/oem.cfg 2015-03-17 18:25:33 +0000
271@@ -0,0 +1,43 @@
272+#
273+# Copyright (C) 2010, Canonical Ltd (http://www.canonical.com/)
274+#
275+# This file is part of ubuntu-server-iso-testing.
276+#
277+# ubuntu-server-iso-testing is free software: you can redistribute it
278+# and/or modify it under the terms of the GNU General Public License
279+# as published by the Free Software Foundation, either version 3 of
280+# the License, or (at your option) any later version.
281+#
282+# ubuntu-server-iso-testing is distributed in the hope that it will
283+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
284+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
285+# GNU General Public License for more details.
286+#
287+# You should have received a copy of the GNU General Public License
288+# along with ubuntu-server-iso-testing. If not, see
289+# <http://www.gnu.org/licenses/>.
290+#
291+
292+d-i debian-installer/locale string en_US.UTF-8
293+d-i netcfg/get_hostname string utah-example
294+d-i partman-auto/method string regular
295+#need this for desktop
296+d-i partman/choose_partition select Finish partitioning and write changes to disk
297+#need this for cobbler
298+d-i partman/confirm boolean true
299+#need this for non-desktop
300+d-i partman/confirm_nooverwrite boolean true
301+d-i time/zone string Etc/UTC
302+d-i passwd/user-fullname string UTAH
303+d-i passwd/username string utah
304+d-i passwd/user-password password !ubuntu123
305+d-i passwd/user-password-again password !ubuntu123
306+d-i pkgsel/include string openssh-server python-yaml bzr git gdebi-core
307+#need this for non-desktop
308+d-i finish-install/reboot_in_progress note
309+# These are specific to this test case
310+d-i oem-config/enable boolean true
311+d-i oem-config/id string USIT_OEM
312+#Temporary workaround for LP:1258245
313+d-i preseed/early_command string chmod 666 /dev/ttyS0
314+d-i preseed/late_command string chroot /target /usr/sbin/usermod -G dialout syslog
315
316=== added directory 'runlists'
317=== added file 'runlists/default.run'
318--- runlists/default.run 1970-01-01 00:00:00 +0000
319+++ runlists/default.run 2015-03-17 18:25:33 +0000
320@@ -0,0 +1,8 @@
321+testsuites:
322+ - name: usit
323+ fetch_method: bzr-export
324+ fetch_location: lp:ubuntu-test-cases/desktop/testsuites/usit
325+ include_tests:
326+ - read_write
327+ - dbus_machine_id
328+ #- empty_startup_app
329
330=== added file 'runlists/default_btrfs.run'
331--- runlists/default_btrfs.run 1970-01-01 00:00:00 +0000
332+++ runlists/default_btrfs.run 2015-03-17 18:25:33 +0000
333@@ -0,0 +1,8 @@
334+testsuites:
335+ - name: usit
336+ fetch_method: bzr-export
337+ fetch_location: lp:ubuntu-test-cases/desktop/testsuites/usit
338+ include_tests:
339+ - read_write
340+ - dbus_machine_id
341+ - archive_location
342
343=== added file 'runlists/default_de.run'
344--- runlists/default_de.run 1970-01-01 00:00:00 +0000
345+++ runlists/default_de.run 2015-03-17 18:25:33 +0000
346@@ -0,0 +1,8 @@
347+testsuites:
348+ - name: usit
349+ fetch_method: bzr-export
350+ fetch_location: lp:ubuntu-test-cases/desktop/testsuites/usit
351+ include_tests:
352+ - read_write
353+ - dbus_machine_id
354+ - archive_location
355
356=== added file 'runlists/encrypted_home.run'
357--- runlists/encrypted_home.run 1970-01-01 00:00:00 +0000
358+++ runlists/encrypted_home.run 2015-03-17 18:25:33 +0000
359@@ -0,0 +1,8 @@
360+testsuites:
361+ - name: usit
362+ fetch_method: bzr-export
363+ fetch_location: lp:ubuntu-test-cases/desktop/testsuites/usit
364+ include_tests:
365+ - read_write
366+ - encrypted_home_permissions
367+ - encrypted_home_content
368
369=== added file 'runlists/live_session.run'
370--- runlists/live_session.run 1970-01-01 00:00:00 +0000
371+++ runlists/live_session.run 2015-03-17 18:25:33 +0000
372@@ -0,0 +1,8 @@
373+testsuites:
374+ - name: usit
375+ fetch_method: bzr-export
376+ fetch_location: lp:ubuntu-test-cases/desktop/testsuites/usit
377+ include_tests:
378+ - read_write
379+ - dbus_machine_id
380+ - no_rofs_machine_id
381
382=== added file 'runlists/lvm.run'
383--- runlists/lvm.run 1970-01-01 00:00:00 +0000
384+++ runlists/lvm.run 2015-03-17 18:25:33 +0000
385@@ -0,0 +1,4 @@
386+testsuites:
387+ - name: lvm
388+ fetch_method: bzr-export
389+ fetch_location: lp:ubuntu-test-cases/server/testsuites/lvm/
390
391=== added file 'runlists/min_config.run'
392--- runlists/min_config.run 1970-01-01 00:00:00 +0000
393+++ runlists/min_config.run 2015-03-17 18:25:33 +0000
394@@ -0,0 +1,11 @@
395+testsuites:
396+ - name: usit
397+ fetch_method: bzr-export
398+ fetch_location: lp:ubuntu-test-cases/desktop/testsuites/usit
399+ include_tests:
400+ - read_write
401+ - dbus_machine_id
402+ - total_mem
403+ - total_disk
404+ - disk_not_full
405+ - out_of_memory
406
407=== added file 'runlists/oem.run'
408--- runlists/oem.run 1970-01-01 00:00:00 +0000
409+++ runlists/oem.run 2015-03-17 18:25:33 +0000
410@@ -0,0 +1,8 @@
411+testsuites:
412+ - name: usit
413+ fetch_method: bzr-export
414+ fetch_location: lp:ubuntu-test-cases/desktop/testsuites/usit
415+ include_tests:
416+ - read_write
417+ - desktop_shortcut_exists
418+ - oem_pkg_installed
419
420=== added file 'runlists/ubiquity.run'
421--- runlists/ubiquity.run 1970-01-01 00:00:00 +0000
422+++ runlists/ubiquity.run 2015-03-17 18:25:33 +0000
423@@ -0,0 +1,6 @@
424+testsuites:
425+ - name: usit
426+ fetch_method: bzr-export
427+ fetch_location: lp:ubuntu-test-cases/desktop/testsuites/usit
428+ include_tests:
429+ - ubiquity
430
431=== added directory 'scripts'
432=== renamed directory 'scripts' => 'scripts.moved'
433=== added file 'scripts/base.sh'
434--- scripts/base.sh 1970-01-01 00:00:00 +0000
435+++ scripts/base.sh 2015-03-17 18:25:33 +0000
436@@ -0,0 +1,52 @@
437+usage()
438+{
439+ cat <<EOF
440+usage: $(basename $0) -i IMAGE
441+
442+Run desktop default scenario using default parameters
443+
444+options:
445+ -h Show this help and exit
446+ -i IMAGE Path/URL to image to be used
447+EOF
448+}
449+
450+parse_args()
451+{
452+ while getopts :i: OPTION; do
453+ case $OPTION in
454+ i)
455+ IMAGE=$OPTARG
456+ ;;
457+ ?)
458+ usage
459+ exit
460+ ;;
461+ esac
462+ done
463+
464+ if [ -z "$IMAGE" ]; then
465+ usage
466+ exit
467+ fi
468+
469+ if [ -z "$PRESEED" ]; then
470+ echo "PRESEED environment variable not found"
471+ exit
472+ fi
473+
474+ if [ -z "$RUNLIST" ]; then
475+ echo "RUNLIST environment variable not found"
476+ exit
477+ fi
478+
479+ if [ -z "$BOOT_ARGS" ]; then
480+ CMD="run_utah_tests.py -i $IMAGE -p $PRESEED $RUNLIST -f /var/log/installer"
481+ else
482+ CMD="run_utah_tests.py -i $IMAGE -p $PRESEED -b $BOOT_ARGS $RUNLIST -f /var/log/installer"
483+ fi
484+
485+ if [ -n "$EXTRA_ARGS" ]; then
486+ CMD="$CMD $EXTRA_ARGS"
487+ fi
488+}
489
490=== added file 'scripts/default.sh'
491--- scripts/default.sh 1970-01-01 00:00:00 +0000
492+++ scripts/default.sh 2015-03-17 18:25:33 +0000
493@@ -0,0 +1,10 @@
494+#!/bin/sh
495+# Run default scenario
496+SCRIPT_DIR=$(readlink -e $(dirname $0))
497+BRANCH_DIR=${BRANCH_DIR:-lp:ubuntu-test-cases/desktop}
498+PRESEED=$BRANCH_DIR/preseeds/default.cfg
499+RUNLIST=$BRANCH_DIR/runlists/default.run
500+
501+. $SCRIPT_DIR/base.sh
502+parse_args "$@"
503+echo $CMD
504
505=== added file 'scripts/default_btrfs.sh'
506--- scripts/default_btrfs.sh 1970-01-01 00:00:00 +0000
507+++ scripts/default_btrfs.sh 2015-03-17 18:25:33 +0000
508@@ -0,0 +1,10 @@
509+#!/bin/sh
510+# Run default scenario
511+SCRIPT_DIR=$(readlink -e $(dirname $0))
512+BRANCH_DIR=${BRANCH_DIR:-lp:ubuntu-test-cases/desktop}
513+PRESEED=$BRANCH_DIR/preseeds/default_btrfs.cfg
514+RUNLIST=$BRANCH_DIR/runlists/default_btrfs.run
515+
516+. $SCRIPT_DIR/base.sh
517+parse_args "$@"
518+echo $CMD
519
520=== added file 'scripts/default_de.sh'
521--- scripts/default_de.sh 1970-01-01 00:00:00 +0000
522+++ scripts/default_de.sh 2015-03-17 18:25:33 +0000
523@@ -0,0 +1,10 @@
524+#!/bin/sh
525+# Run default scenario
526+SCRIPT_DIR=$(readlink -e $(dirname $0))
527+BRANCH_DIR=${BRANCH_DIR:-lp:ubuntu-test-cases/desktop}
528+PRESEED=$BRANCH_DIR/preseeds/default_de.cfg
529+RUNLIST=$BRANCH_DIR/runlists/default_de.run
530+
531+. $SCRIPT_DIR/base.sh
532+parse_args "$@"
533+echo $CMD
534
535=== added file 'scripts/encrypted_home.sh'
536--- scripts/encrypted_home.sh 1970-01-01 00:00:00 +0000
537+++ scripts/encrypted_home.sh 2015-03-17 18:25:33 +0000
538@@ -0,0 +1,10 @@
539+#!/bin/sh
540+# Run encrypted_home scenario
541+SCRIPT_DIR=$(readlink -e $(dirname $0))
542+BRANCH_DIR=${BRANCH_DIR:-lp:ubuntu-test-cases/desktop}
543+PRESEED=$BRANCH_DIR/preseeds/encrypted_home.cfg
544+RUNLIST=$BRANCH_DIR/runlists/encrypted_home.run
545+
546+. $SCRIPT_DIR/base.sh
547+parse_args "$@"
548+echo $CMD
549
550=== added file 'scripts/health-check.sh'
551--- scripts/health-check.sh 1970-01-01 00:00:00 +0000
552+++ scripts/health-check.sh 2015-03-17 18:25:33 +0000
553@@ -0,0 +1,12 @@
554+#!/bin/sh
555+# Run default scenario
556+SCRIPT_DIR=$(readlink -e $(dirname $0))
557+BRANCH_DIR=${BRANCH_DIR:-lp:ubuntu-test-cases/desktop}
558+HEALTHCHECK_BRANCH_DIR=lp:~ubuntu-test-case-dev/ubuntu-test-cases/health-check
559+PRESEED=$BRANCH_DIR/preseeds/default.cfg
560+RUNLIST=$HEALTHCHECK_BRANCH_DIR/master.run
561+EXTRA_ARGS="-f /tmp/results"
562+
563+. $SCRIPT_DIR/base.sh
564+parse_args "$@"
565+echo $CMD
566
567=== added file 'scripts/lvm.sh'
568--- scripts/lvm.sh 1970-01-01 00:00:00 +0000
569+++ scripts/lvm.sh 2015-03-17 18:25:33 +0000
570@@ -0,0 +1,10 @@
571+#!/bin/sh
572+# Run default scenario
573+SCRIPT_DIR=$(readlink -e $(dirname $0))
574+BRANCH_DIR=${BRANCH_DIR:-lp:ubuntu-test-cases/desktop}
575+PRESEED=$BRANCH_DIR/preseeds/lvm.cfg
576+RUNLIST=$BRANCH_DIR/runlists/lvm.run
577+
578+. $SCRIPT_DIR/base.sh
579+parse_args "$@"
580+echo $CMD
581
582=== added file 'scripts/min_config.sh'
583--- scripts/min_config.sh 1970-01-01 00:00:00 +0000
584+++ scripts/min_config.sh 2015-03-17 18:25:33 +0000
585@@ -0,0 +1,12 @@
586+#!/bin/sh
587+# Run default scenario
588+SCRIPT_DIR=$(readlink -e $(dirname $0))
589+SCRIPT=$(basename $0)
590+SCRIPT_NAME=${SCRIPT%.*}
591+BRANCH_DIR=${BRANCH_DIR:-lp:ubuntu-test-cases/desktop}
592+PRESEED=$BRANCH_DIR/preseeds/$SCRIPT_NAME.cfg
593+RUNLIST=$BRANCH_DIR/runlists/$SCRIPT_NAME.run
594+
595+. $SCRIPT_DIR/base.sh
596+parse_args "$@"
597+echo $CMD --gigabytes 5
598
599=== added file 'scripts/oem.sh'
600--- scripts/oem.sh 1970-01-01 00:00:00 +0000
601+++ scripts/oem.sh 2015-03-17 18:25:33 +0000
602@@ -0,0 +1,11 @@
603+#!/bin/sh
604+# Run oem scenario
605+SCRIPT_DIR=$(readlink -e $(dirname $0))
606+BRANCH_DIR=${BRANCH_DIR:-lp:ubuntu-test-cases/desktop}
607+PRESEED=$BRANCH_DIR/preseeds/oem.cfg
608+RUNLIST=$BRANCH_DIR/runlists/oem.run
609+BOOT_ARGS=oem-config/enable=true
610+
611+. $SCRIPT_DIR/base.sh
612+parse_args "$@"
613+echo "UTAH_CONFIG_FILE=$BRANCH_DIR/configs/oem.conf $CMD"
614
615=== added directory 'testsuites'
616=== added directory 'testsuites/usit'
617=== added directory 'testsuites/usit/archive_location'
618=== added file 'testsuites/usit/archive_location/tc_control'
619--- testsuites/usit/archive_location/tc_control 1970-01-01 00:00:00 +0000
620+++ testsuites/usit/archive_location/tc_control 2015-03-17 18:25:33 +0000
621@@ -0,0 +1,9 @@
622+description: Sources.list should match archive according to the timezone
623+dependencies: none
624+action: |
625+ 1. Check if the archive location matches the timezone and not the locale
626+expected_results: |
627+ 1. Archive location matches the timezone and not the locale
628+type: userland
629+command: ./test.py
630+run_as: utah
631
632=== added file 'testsuites/usit/archive_location/test.py'
633--- testsuites/usit/archive_location/test.py 1970-01-01 00:00:00 +0000
634+++ testsuites/usit/archive_location/test.py 2015-03-17 18:25:33 +0000
635@@ -0,0 +1,54 @@
636+#!/usr/bin/python
637+#
638+# Copyright (C) 2013, Canonical Ltd (http://www.canonical.com/)
639+#
640+# This file is part of ubuntu-test-cases.
641+#
642+# ubuntu-test-cases is free software: you can redistribute it
643+# and/or modify it under the terms of the GNU General Public License
644+# as published by the Free Software Foundation, either version 3 of
645+# the License, or (at your option) any later version.
646+#
647+# ubuntu-test-cases is distributed in the hope that it will
648+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
649+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
650+# GNU General Public License for more details.
651+#
652+# You should have received a copy of the GNU General Public License
653+# along with ubuntu-test-cases. If not, see
654+# <http://www.gnu.org/licenses/>.
655+
656+"""Archive location should only match the timezone and not the locale"""
657+
658+import logging
659+import unittest
660+
661+
662+class ArchiveLocationTest(unittest.TestCase):
663+ SOURCES_FILE = '/etc/apt/sources.list'
664+
665+ # Timezone is US/Eastern. Hence correct archive is us.archive.ubuntu.com
666+ # de.archive.ubuntu.com is incorrect even when the locale is de_DE.UTF-8
667+ RIGHT_LOC = 'us.archive.ubuntu.com'
668+ WRONG_LOC = 'de.archive.ubuntu.com'
669+
670+ def test_archive_location(self):
671+ """Test sources.list contains correct archive settings."""
672+ logging.info('Reading {!r} file...'.format(self.SOURCES_FILE))
673+ with open(self.SOURCES_FILE) as f:
674+ sources = f.read()
675+
676+ logging.info('Checking that archive location is ({!r})'
677+ .format(self.RIGHT_LOC))
678+ self.assertTrue(self.RIGHT_LOC in sources,
679+ 'Archive is not US specific')
680+
681+ logging.info('Checking that archive location is NOT ({!r})'
682+ .format(self.WRONG_LOC))
683+ self.assertTrue(self.WRONG_LOC not in sources,
684+ 'Archive is set according to locale - German')
685+
686+if __name__ == '__main__':
687+ logging.basicConfig(level=logging.DEBUG,
688+ format='%(levelname)s: %(message)s')
689+ unittest.main()
690
691=== added directory 'testsuites/usit/dbus_machine_id'
692=== added file 'testsuites/usit/dbus_machine_id/tc_control'
693--- testsuites/usit/dbus_machine_id/tc_control 1970-01-01 00:00:00 +0000
694+++ testsuites/usit/dbus_machine_id/tc_control 2015-03-17 18:25:33 +0000
695@@ -0,0 +1,15 @@
696+description: Machine ID file exists and it was created recently
697+dependencies: none
698+action: |
699+ 1. Open machine id file
700+ 2. Read file contents
701+ 3. Write file contents to the log
702+ 4. Get file modification tieme
703+expected_results: |
704+ 1. The file opens
705+ 2. The contents is read
706+ 3. The contents is written to the log
707+ 4. The file was modified recently
708+type: userland
709+command: ./test.py
710+run_as: utah
711
712=== added file 'testsuites/usit/dbus_machine_id/test.py'
713--- testsuites/usit/dbus_machine_id/test.py 1970-01-01 00:00:00 +0000
714+++ testsuites/usit/dbus_machine_id/test.py 2015-03-17 18:25:33 +0000
715@@ -0,0 +1,71 @@
716+#!/usr/bin/python
717+#
718+# Copyright (C) 2012, Canonical Ltd (http://www.canonical.com/)
719+#
720+# This file is part of ubuntu-test-cases.
721+#
722+# ubuntu-test-cases is free software: you can redistribute it
723+# and/or modify it under the terms of the GNU General Public License
724+# as published by the Free Software Foundation, either version 3 of
725+# the License, or (at your option) any later version.
726+#
727+# ubuntu-test-cases is distributed in the hope that it will
728+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
729+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
730+# GNU General Public License for more details.
731+#
732+# You should have received a copy of the GNU General Public License
733+# along with ubuntu-test-cases. If not, see
734+# <http://www.gnu.org/licenses/>.
735+
736+"""Machine ID file exists and it was created recently."""
737+
738+import logging
739+import os.path
740+import unittest
741+import time
742+
743+
744+class MachineIdTest(unittest.TestCase):
745+ MACHINE_ID_FILE = '/etc/machine-id'
746+ MACHINE_ID_FILE_FALLBACK = '/var/lib/dbus/machine-id'
747+
748+ # Expected age of the file is 5 minutes (300 seconds) which is an arbitrary
749+ # value sane in VM with low resources as well as bare metal environments
750+ EXPECTED_AGE = 300
751+
752+ def test_machine_id(self):
753+ """Machine Id is there and log content and age."""
754+ logging.info('Checking that machine id file {!r} or {!r} exists...'
755+ .format(self.MACHINE_ID_FILE,
756+ self.MACHINE_ID_FILE_FALLBACK))
757+
758+ logging.info('Reading file...')
759+ try:
760+ with open(self.MACHINE_ID_FILE) as f:
761+ machine_id = f.read().rstrip()
762+ logging.info('The machine id is {!r}'.format(machine_id))
763+ except IOError:
764+ logging.info('Couldn\'t open {!r}, trying {!r}'
765+ .format(self.MACHINE_ID_FILE,
766+ self.MACHINE_ID_FILE_FALLBACK))
767+ with open(self.MACHINE_ID_FILE_FALLBACK) as f:
768+ self.MACHINE_ID_FILE = self.MACHINE_ID_FILE_FALLBACK
769+ machine_id = f.read().rstrip()
770+ logging.info('The machine id is {!r}'.format(machine_id))
771+
772+ logging.info('Getting last modification time...')
773+ mtime = os.path.getmtime(self.MACHINE_ID_FILE)
774+ mtime_struct = time.gmtime(mtime)
775+ mtime_str = time.strftime('%c', mtime_struct)
776+ logging.info('Last modification time: {} ({})'
777+ .format(mtime_str, mtime))
778+ now = time.time()
779+ age = now - mtime
780+ logging.info('Machine id is {} seconds old'.format(age))
781+ self.assertLess(age, self.EXPECTED_AGE)
782+
783+if __name__ == '__main__':
784+ logging.basicConfig(level=logging.DEBUG,
785+ format='%(levelname)s: %(message)s')
786+ unittest.main()
787
788=== added directory 'testsuites/usit/desktop_shortcut_exists'
789=== added file 'testsuites/usit/desktop_shortcut_exists/tc_control'
790--- testsuites/usit/desktop_shortcut_exists/tc_control 1970-01-01 00:00:00 +0000
791+++ testsuites/usit/desktop_shortcut_exists/tc_control 2015-03-17 18:25:33 +0000
792@@ -0,0 +1,9 @@
793+description: Desktop shortcut exists
794+dependencies: none
795+action: |
796+ 1. Look for OEM configuration desktop shortcut
797+expected_results: |
798+ 1. Desktop shortcut should be found at the expected location
799+type: userland
800+command: ./test.py
801+run_as: utah
802
803=== added file 'testsuites/usit/desktop_shortcut_exists/test.py'
804--- testsuites/usit/desktop_shortcut_exists/test.py 1970-01-01 00:00:00 +0000
805+++ testsuites/usit/desktop_shortcut_exists/test.py 2015-03-17 18:25:33 +0000
806@@ -0,0 +1,42 @@
807+#!/usr/bin/python
808+#
809+# Copyright (C) 2012, Canonical Ltd (http://www.canonical.com/)
810+#
811+# This file is part of ubuntu-test-cases.
812+#
813+# ubuntu-test-cases is free software: you can redistribute it
814+# and/or modify it under the terms of the GNU General Public License
815+# as published by the Free Software Foundation, either version 3 of
816+# the License, or (at your option) any later version.
817+#
818+# ubuntu-test-cases is distributed in the hope that it will
819+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
820+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
821+# GNU General Public License for more details.
822+#
823+# You should have received a copy of the GNU General Public License
824+# along with ubuntu-test-cases. If not, see
825+# <http://www.gnu.org/licenses/>.
826+
827+"""Desktop shortcut exists."""
828+
829+import logging
830+import unittest
831+import os
832+
833+
834+class DesktopShortcutExistTest(unittest.TestCase):
835+ # Only works on english installation since Desktop is localized
836+ DESKTOP_SHORTCUT_PATH = '/home/oem/Desktop/oem-config-prepare-gtk.desktop'
837+
838+ def test_desktop_shortcut_exists(self):
839+ """Test if the desktop shortcut has been created successfully."""
840+ logging.info('Checking if desktop shortcut ({}) exists'
841+ .format(self.DESKTOP_SHORTCUT_PATH))
842+ self.assertTrue(os.path.exists(self.DESKTOP_SHORTCUT_PATH),
843+ "Desktop shortcut doesn't exist")
844+
845+if __name__ == '__main__':
846+ logging.basicConfig(level=logging.DEBUG,
847+ format='%(levelname)s: %(message)s')
848+ unittest.main()
849
850=== added directory 'testsuites/usit/disk_not_full'
851=== added file 'testsuites/usit/disk_not_full/tc_control'
852--- testsuites/usit/disk_not_full/tc_control 1970-01-01 00:00:00 +0000
853+++ testsuites/usit/disk_not_full/tc_control 2015-03-17 18:25:33 +0000
854@@ -0,0 +1,9 @@
855+description: Check that root partition isn't completely full
856+dependencies: coreutils
857+action: |
858+ 1. Get root partition usage
859+expected_results: |
860+ 1. Current usage is less than 100%
861+type: userland
862+command: ./test.py
863+run_as: utah
864
865=== added file 'testsuites/usit/disk_not_full/test.py'
866--- testsuites/usit/disk_not_full/test.py 1970-01-01 00:00:00 +0000
867+++ testsuites/usit/disk_not_full/test.py 2015-03-17 18:25:33 +0000
868@@ -0,0 +1,58 @@
869+#!/usr/bin/python
870+#
871+# Copyright (C) 2012, Canonical Ltd (http://www.canonical.com/)
872+#
873+# This file is part of ubuntu-test-cases.
874+#
875+# ubuntu-test-cases is free software: you can redistribute it
876+# and/or modify it under the terms of the GNU General Public License
877+# as published by the Free Software Foundation, either version 3 of
878+# the License, or (at your option) any later version.
879+#
880+# ubuntu-test-cases is distributed in the hope that it will
881+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
882+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
883+# GNU General Public License for more details.
884+#
885+# You should have received a copy of the GNU General Public License
886+# along with ubuntu-test-cases. If not, see
887+# <http://www.gnu.org/licenses/>.
888+
889+"""Check that root partition isn't completely full.
890+
891+Note: There isn't any threshold defined, any value below 100% usage would be
892+considered as a pass.
893+
894+"""
895+
896+import logging
897+import unittest
898+import subprocess
899+import re
900+
901+
902+class DiskNotFullTest(unittest.TestCase):
903+
904+ def test_disk_not_full(self):
905+ """Check that root partition isn't completely full."""
906+ logging.info('Getting disk usage...')
907+ process = subprocess.Popen('df', stdout=subprocess.PIPE)
908+ stdout, _stderr = process.communicate()
909+ logging.info('Disk usage:\n{}'.format(stdout))
910+ logging.info('Parsing root partition usage...')
911+ root_line = next(line for line in stdout.splitlines()
912+ if line.endswith('/'))
913+ use_str = root_line.split()[4]
914+ match = re.match('(\d+)%', use_str)
915+ self.assertTrue(match,
916+ "Unable to parse root partition use percentage: {}"
917+ .format(use_str))
918+ use = int(match.group(1))
919+ logging.info('Root partition usage is: {}%'.format(use))
920+ self.assertLess(use, 100,
921+ 'Root filesystem must *not* be full after install')
922+
923+if __name__ == '__main__':
924+ logging.basicConfig(level=logging.DEBUG,
925+ format='%(levelname)s: %(message)s')
926+ unittest.main()
927
928=== added directory 'testsuites/usit/empty_startup_app'
929=== added file 'testsuites/usit/empty_startup_app/setup.py'
930--- testsuites/usit/empty_startup_app/setup.py 1970-01-01 00:00:00 +0000
931+++ testsuites/usit/empty_startup_app/setup.py 2015-03-17 18:25:33 +0000
932@@ -0,0 +1,46 @@
933+#!/usr/bin/env python
934+#
935+# Copyright (C) 2012, Canonical Ltd (http://www.canonical.com/)
936+#
937+# This file is part of ubuntu-test-cases.
938+#
939+# ubuntu-test-cases is free software: you can redistribute it
940+# and/or modify it under the terms of the GNU General Public License
941+# as published by the Free Software Foundation, either version 3 of
942+# the License, or (at your option) any later version.
943+#
944+# ubuntu-test-cases is distributed in the hope that it will
945+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
946+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
947+# GNU General Public License for more details.
948+#
949+# You should have received a copy of the GNU General Public License
950+# along with ubuntu-test-cases. If not, see
951+# <http://www.gnu.org/licenses/>.
952+
953+"""Check imagemagic is installed."""
954+
955+import logging
956+import apt
957+
958+PKG_NAME = 'imagemagick'
959+
960+
961+def main():
962+ """Check imagemagic is installed."""
963+ logging.info('Getting apt cache')
964+ cache = apt.cache.Cache()
965+
966+ logging.info('Checking if {!r} is installed...'.format(PKG_NAME))
967+ if not PKG_NAME in cache:
968+ raise AssertionError('{!r} not found'.format(PKG_NAME))
969+
970+ pkg = cache[PKG_NAME]
971+ if not pkg.is_installed:
972+ raise AssertionError('{!r} is not installed'.format(PKG_NAME))
973+ logging.info('{!r} is installed'.format(PKG_NAME))
974+
975+if __name__ == '__main__':
976+ logging.basicConfig(level=logging.DEBUG,
977+ format='%(levelname)s: %(message)s')
978+ main()
979
980=== added file 'testsuites/usit/empty_startup_app/tc_control'
981--- testsuites/usit/empty_startup_app/tc_control 1970-01-01 00:00:00 +0000
982+++ testsuites/usit/empty_startup_app/tc_control 2015-03-17 18:25:33 +0000
983@@ -0,0 +1,14 @@
984+description: Startup list is empty (bug#803917)
985+dependencies: x11-apps, imagemagick
986+action: |
987+ 1. Launch gnome-session-properties
988+ 2. Take window screenshot
989+ 3. Compare screenshot to blank image
990+expected_results: |
991+ 1. Application window is displayed
992+ 2. Screenshot is taken
993+ 3. Comparison reveals that startup list is empty
994+type: userland
995+tc_setup: ./setup.py
996+command: ./test.py
997+run_as: utah
998
999=== added file 'testsuites/usit/empty_startup_app/test.py'
1000--- testsuites/usit/empty_startup_app/test.py 1970-01-01 00:00:00 +0000
1001+++ testsuites/usit/empty_startup_app/test.py 2015-03-17 18:25:33 +0000
1002@@ -0,0 +1,82 @@
1003+#!/usr/bin/env python
1004+#
1005+# Copyright (C) 2012, Canonical Ltd (http://www.canonical.com/)
1006+#
1007+# This file is part of ubuntu-test-cases.
1008+#
1009+# ubuntu-test-cases is free software: you can redistribute it
1010+# and/or modify it under the terms of the GNU General Public License
1011+# as published by the Free Software Foundation, either version 3 of
1012+# the License, or (at your option) any later version.
1013+#
1014+# ubuntu-test-cases is distributed in the hope that it will
1015+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
1016+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1017+# GNU General Public License for more details.
1018+#
1019+# You should have received a copy of the GNU General Public License
1020+# along with ubuntu-test-cases. If not, see
1021+# <http://www.gnu.org/licenses/>.
1022+
1023+"""Startup application list is empty."""
1024+
1025+import logging
1026+import unittest
1027+import subprocess
1028+import time
1029+import os
1030+import tempfile
1031+
1032+
1033+class EmptyStartupAppTest(unittest.TestCase):
1034+ APP_BINARY = 'gnome-session-properties'
1035+ WINDOW_NAME = 'Startup Applications Preferences'
1036+ IMAGE_SIZE = '400x300'
1037+
1038+ def test_empty_startup_app_test(self):
1039+ """Startup application list is empty."""
1040+ logging.info('Launching {!r}...'.format(self.APP_BINARY))
1041+ app_process = subprocess.Popen(self.APP_BINARY)
1042+ time.sleep(1) # Wait for the application window to be displayed
1043+
1044+ try:
1045+ logging.info('Creating temporary directory...')
1046+ temp_dir = tempfile.mkdtemp(prefix='empty_startup_app_test_')
1047+
1048+ xwd_image = os.path.join(temp_dir, 'capture.xwd')
1049+ png_image = os.path.join(temp_dir, 'capture.png')
1050+ blank_image = os.path.join(temp_dir, 'blank.png')
1051+ diff_image = os.path.join(temp_dir, 'diff.png')
1052+
1053+ logging.info('Taking window screenshot...')
1054+ cmd = ['xwd', '-name', self.WINDOW_NAME, '-out', xwd_image]
1055+ subprocess.check_call(cmd)
1056+
1057+ # Get rid of window decoration that might change depending on the
1058+ # theme
1059+ logging.info('Cropping application list from window screenshot...')
1060+ cmd = ['convert', '-crop', self.IMAGE_SIZE + '+30+55',
1061+ '-monochrome', xwd_image, png_image]
1062+ subprocess.check_call(cmd)
1063+
1064+ logging.info('Generating blank image of the same size...')
1065+ cmd = ['convert', '-size', self.IMAGE_SIZE,
1066+ 'xc:white', blank_image]
1067+ subprocess.check_call(cmd)
1068+
1069+ logging.info('Comparing captured and blank images...')
1070+ # Note: compare outputs to stderr
1071+ cmd = ['compare', '-metric', 'AE',
1072+ png_image, blank_image, diff_image]
1073+ output = (subprocess.Popen(cmd, stderr=subprocess.PIPE)
1074+ .communicate()[1])
1075+ self.assertEqual(output.strip(), '0',
1076+ "Startup application list doesn't seem empty")
1077+ finally:
1078+ logging.info('Closing {!r}...'.format(self.APP_BINARY))
1079+ app_process.kill()
1080+
1081+if __name__ == '__main__':
1082+ logging.basicConfig(level=logging.DEBUG,
1083+ format='%(levelname)s: %(message)s')
1084+ unittest.main()
1085
1086=== added directory 'testsuites/usit/encrypted_home_content'
1087=== added file 'testsuites/usit/encrypted_home_content/tc_control'
1088--- testsuites/usit/encrypted_home_content/tc_control 1970-01-01 00:00:00 +0000
1089+++ testsuites/usit/encrypted_home_content/tc_control 2015-03-17 18:25:33 +0000
1090@@ -0,0 +1,14 @@
1091+description: Encrypted home has expected symbolic links
1092+dependencies: none
1093+action: |
1094+ 1. Look for home directory
1095+ 2. Get home directory mount status
1096+ 3. Look for symlinks
1097+
1098+expected_results: |
1099+ 1. Home directory exists
1100+ 2. Home directory might be mounted or not
1101+ 3. Different symlinks exist depending on the mount status
1102+type: userland
1103+command: ./test.py
1104+run_as: utah
1105
1106=== added file 'testsuites/usit/encrypted_home_content/test.py'
1107--- testsuites/usit/encrypted_home_content/test.py 1970-01-01 00:00:00 +0000
1108+++ testsuites/usit/encrypted_home_content/test.py 2015-03-17 18:25:33 +0000
1109@@ -0,0 +1,73 @@
1110+#!/usr/bin/env python
1111+#
1112+# Copyright (C) 2012, Canonical Ltd (http://www.canonical.com/)
1113+#
1114+# This file is part of ubuntu-test-cases.
1115+#
1116+# ubuntu-test-cases is free software: you can redistribute it
1117+# and/or modify it under the terms of the GNU General Public License
1118+# as published by the Free Software Foundation, either version 3 of
1119+# the License, or (at your option) any later version.
1120+#
1121+# ubuntu-test-cases is distributed in the hope that it will
1122+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
1123+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1124+# GNU General Public License for more details.
1125+#
1126+# You should have received a copy of the GNU General Public License
1127+# along with ubuntu-test-cases. If not, see
1128+# <http://www.gnu.org/licenses/>.
1129+
1130+"""Test encrypted home content.
1131+
1132+Requires root access to access these links
1133+
1134+If it is not mounted there are 2 symlinks:
1135+Access-Your-Private-Data.desktop ->
1136+ /usr/share/ecryptfs-utils/ecryptfs-mount-private.desktop
1137+README.txt -> /usr/share/ecryptfs-utils/ecryptfs-mount-private.txt
1138+
1139+"""
1140+
1141+
1142+import logging
1143+import unittest
1144+import os
1145+
1146+
1147+class EncryptedHomeContentTest(unittest.TestCase):
1148+ USER = 'utah'
1149+ HOMEDIR = os.path.join('/home', USER)
1150+ ACCESS_DESKTOP = os.path.join(HOMEDIR,
1151+ 'Access-Your-Private-Data.desktop')
1152+ README_TXT = os.path.join(HOMEDIR, 'README.txt')
1153+ PRIVATE_DIR = os.path.join(HOMEDIR, '.Private')
1154+
1155+ def test_encrypted_home_content(self):
1156+ """Test encrypted home content."""
1157+ logging.info('Checking that home directory ({!r}) exists'
1158+ .format(self.HOMEDIR))
1159+ self.assertTrue(os.path.exists(self.HOMEDIR),
1160+ "Home directory ({!r}) doesn't exist"
1161+ .format(self.HOMEDIR))
1162+
1163+ if not os.path.ismount(self.HOMEDIR):
1164+ logging.info('Home directory ({!r}) is mounted'
1165+ .format(self.HOMEDIR))
1166+ are_links = (os.path.islink(self.ACCESS_DESKTOP) and
1167+ os.path.islink(self.README_TXT))
1168+ self.assertTrue(are_links,
1169+ 'Expected symlinks not found:\n- {}\n- {}'
1170+ .format(self.ACCESS_DESKTOP, self.README_TXT))
1171+ else:
1172+ logging.info('Home directory ({!r}) is *not* mounted'
1173+ .format(self.HOMEDIR))
1174+ self.assertTrue(os.path.islink(self.PRIVATE_DIR),
1175+ 'Expected symlink not found:\n- {}'
1176+ .format(self.PRIVATE_DIR))
1177+ logging.info('Expected links found')
1178+
1179+if __name__ == '__main__':
1180+ logging.basicConfig(level=logging.DEBUG,
1181+ format='%(levelname)s: %(message)s')
1182+ unittest.main()
1183
1184=== added directory 'testsuites/usit/encrypted_home_permissions'
1185=== added file 'testsuites/usit/encrypted_home_permissions/tc_control'
1186--- testsuites/usit/encrypted_home_permissions/tc_control 1970-01-01 00:00:00 +0000
1187+++ testsuites/usit/encrypted_home_permissions/tc_control 2015-03-17 18:25:33 +0000
1188@@ -0,0 +1,13 @@
1189+description: Encrypted home permissions
1190+dependencies: none
1191+action: |
1192+ 1. Look for home directory
1193+ 2. Get home directory permissions
1194+expected_results: |
1195+ 1. Home directory exists
1196+ 2. Permissions are
1197+ 2.1 0500 if mounted
1198+ 2.2 0700 it *not* mount
1199+type: userland
1200+command: ./test.py
1201+run_as: utah
1202
1203=== added file 'testsuites/usit/encrypted_home_permissions/test.py'
1204--- testsuites/usit/encrypted_home_permissions/test.py 1970-01-01 00:00:00 +0000
1205+++ testsuites/usit/encrypted_home_permissions/test.py 2015-03-17 18:25:33 +0000
1206@@ -0,0 +1,63 @@
1207+#!/usr/bin/env python
1208+#
1209+# Copyright (C) 2012, Canonical Ltd (http://www.canonical.com/)
1210+#
1211+# This file is part of ubuntu-test-cases.
1212+#
1213+# ubuntu-test-cases is free software: you can redistribute it
1214+# and/or modify it under the terms of the GNU General Public License
1215+# as published by the Free Software Foundation, either version 3 of
1216+# the License, or (at your option) any later version.
1217+#
1218+# ubuntu-test-cases is distributed in the hope that it will
1219+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
1220+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1221+# GNU General Public License for more details.
1222+#
1223+# You should have received a copy of the GNU General Public License
1224+# along with ubuntu-test-cases. If not, see
1225+# <http://www.gnu.org/licenses/>.
1226+
1227+"""Test permissions of encrypted home directory.
1228+
1229+Must be owned by ubuntu and mode set to 0500 if not mounted or 0700 if mounted
1230+
1231+"""
1232+
1233+import logging
1234+import unittest
1235+import os
1236+import stat
1237+
1238+
1239+class EncryptedHomePermissionsTest(unittest.TestCase):
1240+ USER = 'utah'
1241+ HOMEDIR = os.path.join('/home', USER)
1242+
1243+ def test_encrypted_home_permissions(self):
1244+ """Test permissions of encrypted home directory."""
1245+ logging.info('Checking that home directory ({!r}) exists'
1246+ .format(self.HOMEDIR))
1247+ self.assertTrue(os.path.exists(self.HOMEDIR),
1248+ "Home directory ({!r}) doesn't exist"
1249+ .format(self.HOMEDIR))
1250+
1251+ logging.info('Getting home directory permissions...')
1252+ permissions = stat.S_IMODE(os.stat(self.HOMEDIR).st_mode)
1253+ if not os.path.ismount(self.HOMEDIR):
1254+ logging.info('Home directory is mounted')
1255+ expected_permissions = 0500
1256+ else:
1257+ logging.info('Home directory is *not* mounted')
1258+ expected_permissions = 0700
1259+ self.assertEqual(
1260+ permissions, expected_permissions,
1261+ 'Home directory permissions ({:o}) should be set to {:o}'
1262+ .format(permissions, expected_permissions))
1263+ logging.info('Permissions ({:o}) are correctly set'
1264+ .format(permissions))
1265+
1266+if __name__ == '__main__':
1267+ logging.basicConfig(level=logging.DEBUG,
1268+ format='%(levelname)s: %(message)s')
1269+ unittest.main()
1270
1271=== added directory 'testsuites/usit/no_rofs_machine_id'
1272=== added file 'testsuites/usit/no_rofs_machine_id/tc_control'
1273--- testsuites/usit/no_rofs_machine_id/tc_control 1970-01-01 00:00:00 +0000
1274+++ testsuites/usit/no_rofs_machine_id/tc_control 2015-03-17 18:25:33 +0000
1275@@ -0,0 +1,4 @@
1276+description: Machine Id file doesn't exist under /rofs
1277+type: userland
1278+command: ./test.py
1279+run_as: utah
1280
1281=== added file 'testsuites/usit/no_rofs_machine_id/test.py'
1282--- testsuites/usit/no_rofs_machine_id/test.py 1970-01-01 00:00:00 +0000
1283+++ testsuites/usit/no_rofs_machine_id/test.py 2015-03-17 18:25:33 +0000
1284@@ -0,0 +1,53 @@
1285+#!/usr/bin/env python
1286+#
1287+# Copyright (C) 2012, Canonical Ltd (http://www.canonical.com/)
1288+#
1289+# This file is part of ubuntu-test-cases.
1290+#
1291+# ubuntu-test-cases is free software: you can redistribute it
1292+# and/or modify it under the terms of the GNU General Public License
1293+# as published by the Free Software Foundation, either version 3 of
1294+# the License, or (at your option) any later version.
1295+#
1296+# ubuntu-test-cases is distributed in the hope that it will
1297+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
1298+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1299+# GNU General Public License for more details.
1300+#
1301+# You should have received a copy of the GNU General Public License
1302+# along with ubuntu-test-cases. If not, see
1303+# <http://www.gnu.org/licenses/>.
1304+
1305+"""Machine ID doesn't exist on the rofs."""
1306+
1307+import logging
1308+import os
1309+import unittest
1310+
1311+
1312+class NoRofsMachineId(unittest.TestCase):
1313+ MACHINE_ID_FILE = 'etc/machine-id'
1314+ MACHINE_ID_FILE_FALLBACK = 'var/lib/dbus/machine-id'
1315+ ROFS_DIR = '/rofs'
1316+
1317+ def test_no_rofs_machine_id(self):
1318+ """Machine ID doesn't exist on the rofs."""
1319+ rofs_machine_id = os.path.join(self.ROFS_DIR, self.MACHINE_ID_FILE)
1320+ rofs_machine_id_fallback = os.path.join(self.ROFS_DIR,
1321+ self.MACHINE_ID_FILE_FALLBACK)
1322+ logging.info("Checking that machine id file under {} ({}) "
1323+ "doesn't exist"
1324+ .format(self.ROFS_DIR, rofs_machine_id))
1325+ self.assertFalse(os.path.exists(rofs_machine_id),
1326+ 'Machine ID file ({}) exists'.format(rofs_machine_id))
1327+ logging.info("Checking that machine id file under {} ({}) "
1328+ "doesn't exist"
1329+ .format(self.ROFS_DIR, rofs_machine_id_fallback))
1330+ self.assertFalse(os.path.exists(rofs_machine_id_fallback),
1331+ 'Machine ID file ({}) exists'
1332+ .format(rofs_machine_id_fallback))
1333+
1334+if __name__ == '__main__':
1335+ logging.basicConfig(level=logging.DEBUG,
1336+ format='%(levelname)s: %(message)s')
1337+ unittest.main()
1338
1339=== added directory 'testsuites/usit/oem_pkg_installed'
1340=== added file 'testsuites/usit/oem_pkg_installed/tc_control'
1341--- testsuites/usit/oem_pkg_installed/tc_control 1970-01-01 00:00:00 +0000
1342+++ testsuites/usit/oem_pkg_installed/tc_control 2015-03-17 18:25:33 +0000
1343@@ -0,0 +1,12 @@
1344+description: OEM packages are installed
1345+dependencies: none
1346+action: |
1347+ 1. Look for package in apt cache
1348+ 2. Get installation status for package
1349+ 3. Repeat 1-2 for oem-config and oem-config-gtk
1350+expected_results: |
1351+ 1. Package is found in apt cache
1352+ 2. Package is installed
1353+type: userland
1354+command: ./test.py
1355+run_as: utah
1356
1357=== added file 'testsuites/usit/oem_pkg_installed/test.py'
1358--- testsuites/usit/oem_pkg_installed/test.py 1970-01-01 00:00:00 +0000
1359+++ testsuites/usit/oem_pkg_installed/test.py 2015-03-17 18:25:33 +0000
1360@@ -0,0 +1,66 @@
1361+#!/usr/bin/python
1362+#
1363+# Copyright (C) 2012, Canonical Ltd (http://www.canonical.com/)
1364+#
1365+# This file is part of ubuntu-test-cases.
1366+#
1367+# ubuntu-test-cases is free software: you can redistribute it
1368+# and/or modify it under the terms of the GNU General Public License
1369+# as published by the Free Software Foundation, either version 3 of
1370+# the License, or (at your option) any later version.
1371+#
1372+# ubuntu-test-cases is distributed in the hope that it will
1373+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
1374+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1375+# GNU General Public License for more details.
1376+#
1377+# You should have received a copy of the GNU General Public License
1378+# along with ubuntu-test-cases. If not, see
1379+# <http://www.gnu.org/licenses/>.
1380+
1381+"""OEM packages are installed."""
1382+
1383+import logging
1384+import unittest
1385+import apt
1386+
1387+
1388+class OemPkgInstalled(unittest.TestCase):
1389+ PACKAGE_NAMES = ('oem-config', 'oem-config-gtk')
1390+
1391+ def test_oem_pkg_intalled(self):
1392+ """OEM packages are installed."""
1393+ logging.info('Getting apt cache...')
1394+ cache = apt.cache.Cache()
1395+
1396+ def check_installed(package_name):
1397+ """
1398+ Check a single package
1399+ """
1400+ logging.info('Checking if {!r} is in cache...'
1401+ .format(package_name))
1402+ if package_name not in cache:
1403+ logging.error('{!r} not found in the cache'
1404+ .format(package_name))
1405+ return False
1406+
1407+ logging.info('Checking if {!r} is installed...'
1408+ .format(package_name))
1409+ package = cache[package_name]
1410+ if not package.is_installed:
1411+ logging.error('{!r} is not installed'
1412+ .format(package_name))
1413+ return False
1414+ return True
1415+
1416+ installed = [check_installed(package_name)
1417+ for package_name in self.PACKAGE_NAMES]
1418+ if not all(installed):
1419+ raise AssertionError('Not all packages have been found '
1420+ 'and are installed')
1421+
1422+
1423+if __name__ == '__main__':
1424+ logging.basicConfig(level=logging.DEBUG,
1425+ format='%(levelname)s: %(message)s')
1426+ unittest.main()
1427
1428=== added directory 'testsuites/usit/out_of_memory'
1429=== added file 'testsuites/usit/out_of_memory/tc_control'
1430--- testsuites/usit/out_of_memory/tc_control 1970-01-01 00:00:00 +0000
1431+++ testsuites/usit/out_of_memory/tc_control 2015-03-17 18:25:33 +0000
1432@@ -0,0 +1,11 @@
1433+description: Check that kernel ring buffer doesn't contain any out of memory error
1434+dependencies: util-linux
1435+action: |
1436+ 1. Read kernel ring buffer
1437+ 2. Look for out of memory errors
1438+expected_results: |
1439+ 1. The buffer is read successfully
1440+ 2. There isn't any out of memory error
1441+type: userland
1442+command: ./test.py
1443+run_as: utah
1444
1445=== added file 'testsuites/usit/out_of_memory/test.py'
1446--- testsuites/usit/out_of_memory/test.py 1970-01-01 00:00:00 +0000
1447+++ testsuites/usit/out_of_memory/test.py 2015-03-17 18:25:33 +0000
1448@@ -0,0 +1,49 @@
1449+#!/usr/bin/python
1450+#
1451+# Copyright (C) 2012, Canonical Ltd (http://www.canonical.com/)
1452+#
1453+# This file is part of ubuntu-test-cases.
1454+#
1455+# ubuntu-test-cases is free software: you can redistribute it
1456+# and/or modify it under the terms of the GNU General Public License
1457+# as published by the Free Software Foundation, either version 3 of
1458+# the License, or (at your option) any later version.
1459+#
1460+# ubuntu-test-cases is distributed in the hope that it will
1461+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
1462+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1463+# GNU General Public License for more details.
1464+#
1465+# You should have received a copy of the GNU General Public License
1466+# along with ubuntu-test-cases. If not, see
1467+# <http://www.gnu.org/licenses/>.
1468+
1469+"""Check that kernel ring buffer doesn't contain any out of memory error."""
1470+
1471+import logging
1472+import unittest
1473+import subprocess
1474+import re
1475+
1476+
1477+class OutOfMemoryTest(unittest.TestCase):
1478+ OOM_REGEX = re.compile(r'^.*oom-killer.*$', re.MULTILINE)
1479+
1480+ def test_out_of_memory(self):
1481+ """Check that there isn't any out of memory error."""
1482+ logging.info('Reading kernel ring buffer...')
1483+ output = subprocess.check_output('dmesg')
1484+ logging.info('Looking for out of memory pattern...')
1485+ matches = self.OOM_REGEX.findall(output)
1486+ logging.info('Pattern found {} times'.format(len(matches)))
1487+ for match in matches:
1488+ logging.debug(match)
1489+ self.assertEqual(len(matches), 0,
1490+ 'Out of memory pattern found {} times (see above)'
1491+ .format(len(matches)))
1492+
1493+
1494+if __name__ == '__main__':
1495+ logging.basicConfig(level=logging.DEBUG,
1496+ format='%(levelname)s: %(message)s')
1497+ unittest.main()
1498
1499=== added directory 'testsuites/usit/read_write'
1500=== added file 'testsuites/usit/read_write/tc_control'
1501--- testsuites/usit/read_write/tc_control 1970-01-01 00:00:00 +0000
1502+++ testsuites/usit/read_write/tc_control 2015-03-17 18:25:33 +0000
1503@@ -0,0 +1,19 @@
1504+description: Write something to a temporary file and read it back
1505+dependencies: none
1506+action: |
1507+ 1. Open temporary file for writing
1508+ 2. Write some contents to the file
1509+ 3. Close file
1510+ 4. Open temporary file for reading
1511+ 5. Read file contents
1512+ 6. Close file
1513+expected_results: |
1514+ 1. The file opens
1515+ 2. The contents is written
1516+ 3. The file closes
1517+ 4. The file opens
1518+ 5. The contents is read matches what it was written
1519+ 6. The file closes
1520+type: userland
1521+command: ./test.py
1522+run_as: utah
1523
1524=== added file 'testsuites/usit/read_write/test.py'
1525--- testsuites/usit/read_write/test.py 1970-01-01 00:00:00 +0000
1526+++ testsuites/usit/read_write/test.py 2015-03-17 18:25:33 +0000
1527@@ -0,0 +1,62 @@
1528+#!/usr/bin/python
1529+#
1530+# Copyright (C) 2012, Canonical Ltd (http://www.canonical.com/)
1531+#
1532+# This file is part of ubuntu-test-cases.
1533+#
1534+# ubuntu-test-cases is free software: you can redistribute it
1535+# and/or modify it under the terms of the GNU General Public License
1536+# as published by the Free Software Foundation, either version 3 of
1537+# the License, or (at your option) any later version.
1538+#
1539+# ubuntu-test-cases is distributed in the hope that it will
1540+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
1541+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1542+# GNU General Public License for more details.
1543+#
1544+# You should have received a copy of the GNU General Public License
1545+# along with ubuntu-test-cases. If not, see
1546+# <http://www.gnu.org/licenses/>.
1547+
1548+"""Temporary file can be written."""
1549+
1550+import logging
1551+import os.path
1552+import unittest
1553+
1554+
1555+class ReadWriteTest(unittest.TestCase):
1556+ FILENAME = os.path.join('/tmp', 'a')
1557+ CONTENTS = 'a'
1558+
1559+ def test_read_write(self):
1560+ """Temporary file can be written."""
1561+ logging.info('Opening file {!r} for writing...'.format(self.FILENAME))
1562+ f = open(self.FILENAME, 'w')
1563+
1564+ logging.info('Checking if the file opened...')
1565+ self.assertNotEqual(f, None)
1566+
1567+ logging.info('Writing {!r} to {!r}...'
1568+ .format(self.CONTENTS, self.FILENAME))
1569+ self.assertEqual(f.write('a'), None)
1570+
1571+ logging.info('Closing file...')
1572+ self.assertEqual(f.close(), None)
1573+
1574+ logging.info('Opening file {!r} for reading...'.format(self.FILENAME))
1575+ f = open(self.FILENAME)
1576+
1577+ logging.info('Checking if the file opened...')
1578+ self.assertNotEqual(f, None)
1579+
1580+ logging.info('Reading file contents...'.format(self.FILENAME))
1581+ self.assertEqual(f.read(), self.CONTENTS)
1582+
1583+ logging.info("Closing file...")
1584+ self.assertEqual(f.close(), None)
1585+
1586+if __name__ == '__main__':
1587+ logging.basicConfig(level=logging.DEBUG,
1588+ format='%(levelname)s: %(message)s')
1589+ unittest.main()
1590
1591=== added directory 'testsuites/usit/total_disk'
1592=== added file 'testsuites/usit/total_disk/tc_control'
1593--- testsuites/usit/total_disk/tc_control 1970-01-01 00:00:00 +0000
1594+++ testsuites/usit/total_disk/tc_control 2015-03-17 18:25:33 +0000
1595@@ -0,0 +1,9 @@
1596+description: Check that disk size is the expected one
1597+dependencies: util-linux
1598+action: |
1599+ 1. Get disk size using `sfdisk`command
1600+expected_results: |
1601+ 1. Disk size is the expected value
1602+type: userland
1603+command: ./test.py
1604+run_as: root
1605
1606=== added file 'testsuites/usit/total_disk/test.py'
1607--- testsuites/usit/total_disk/test.py 1970-01-01 00:00:00 +0000
1608+++ testsuites/usit/total_disk/test.py 2015-03-17 18:25:33 +0000
1609@@ -0,0 +1,54 @@
1610+#!/usr/bin/python
1611+#
1612+# Copyright (C) 2012, Canonical Ltd (http://www.canonical.com/)
1613+#
1614+# This file is part of ubuntu-test-cases.
1615+#
1616+# ubuntu-test-cases is free software: you can redistribute it
1617+# and/or modify it under the terms of the GNU General Public License
1618+# as published by the Free Software Foundation, either version 3 of
1619+# the License, or (at your option) any later version.
1620+#
1621+# ubuntu-test-cases is distributed in the hope that it will
1622+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
1623+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1624+# GNU General Public License for more details.
1625+#
1626+# You should have received a copy of the GNU General Public License
1627+# along with ubuntu-test-cases. If not, see
1628+# <http://www.gnu.org/licenses/>.
1629+
1630+"""Check that disk size is the expected one.
1631+
1632+Note: This test case assumes expected size (5GB) matches the physical size or
1633+the size assigned to the virtual machine being tested for the expected device.
1634+
1635+"""
1636+
1637+import logging
1638+import unittest
1639+import subprocess
1640+
1641+
1642+class TotalDiskTest(unittest.TestCase):
1643+ DEVICE = '/dev/vda'
1644+ EXPECTED_SIZE = 5242880
1645+
1646+ def test_total_disk(self):
1647+ """Check that disk size is the expected one."""
1648+ logging.info('Getting disk size for {}'.format(self.DEVICE))
1649+ command = ['sfdisk', '--show-size', self.DEVICE]
1650+ size = int(subprocess.check_output(command))
1651+ logging.info('Disk size is: {}'.format(size))
1652+ self.assertEqual(size, self.EXPECTED_SIZE,
1653+ 'Expected disk size ({}), '
1654+ 'does *not* match expected value: {}'
1655+ .format(size, self.EXPECTED_SIZE))
1656+
1657+ logging.info('Disk size matches the expected value: {}'
1658+ .format(self.EXPECTED_SIZE))
1659+
1660+if __name__ == '__main__':
1661+ logging.basicConfig(level=logging.DEBUG,
1662+ format='%(levelname)s: %(message)s')
1663+ unittest.main()
1664
1665=== added directory 'testsuites/usit/total_mem'
1666=== added file 'testsuites/usit/total_mem/tc_control'
1667--- testsuites/usit/total_mem/tc_control 1970-01-01 00:00:00 +0000
1668+++ testsuites/usit/total_mem/tc_control 2015-03-17 18:25:33 +0000
1669@@ -0,0 +1,9 @@
1670+description: Check that total memory is in the expected range
1671+dependencies: procps
1672+action: |
1673+ 1. Get total memory using `free` command
1674+expected_results: |
1675+ 1. Total memory is in the expected range
1676+type: userland
1677+command: ./test.py
1678+run_as: utah
1679
1680=== added file 'testsuites/usit/total_mem/test.py'
1681--- testsuites/usit/total_mem/test.py 1970-01-01 00:00:00 +0000
1682+++ testsuites/usit/total_mem/test.py 2015-03-17 18:25:33 +0000
1683@@ -0,0 +1,62 @@
1684+#!/usr/bin/python
1685+#
1686+# Copyright (C) 2012, Canonical Ltd (http://www.canonical.com/)
1687+#
1688+# This file is part of ubuntu-test-cases.
1689+#
1690+# ubuntu-test-cases is free software: you can redistribute it
1691+# and/or modify it under the terms of the GNU General Public License
1692+# as published by the Free Software Foundation, either version 3 of
1693+# the License, or (at your option) any later version.
1694+#
1695+# ubuntu-test-cases is distributed in the hope that it will
1696+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
1697+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1698+# GNU General Public License for more details.
1699+#
1700+# You should have received a copy of the GNU General Public License
1701+# along with ubuntu-test-cases. If not, see
1702+# <http://www.gnu.org/licenses/>.
1703+
1704+"""Check that total memory is in the expected range.
1705+
1706+Note: This test case assumes the upper bound matches the physical memory or the
1707+memory assigned to the virtual machine being tested.
1708+
1709+"""
1710+
1711+import logging
1712+import unittest
1713+import subprocess
1714+
1715+
1716+class TotalMemTest(unittest.TestCase):
1717+ UPPER_BOUND = 512
1718+ LOWER_BOUND = UPPER_BOUND - 40
1719+
1720+ def test_total_mem(self):
1721+ """Check that total memory is in the expected range."""
1722+ logging.info('Getting total memory...')
1723+ stdout = subprocess.check_output(['free', '-m'])
1724+ lines = stdout.splitlines()
1725+ mem_line = lines[1].split()
1726+ self.assertEqual(mem_line[0], 'Mem:',
1727+ 'Failed to parse memory line: {}'.format(mem_line))
1728+
1729+ total_mem = int(mem_line[1])
1730+ logging.info('Total memory is: {}'.format(total_mem))
1731+
1732+ self.assertTrue(
1733+ self.LOWER_BOUND < total_mem < self.UPPER_BOUND,
1734+ "Total memory ({} MB) is *not* in the expected range: "
1735+ "({} MB - {} MB)"
1736+ .format(total_mem, self.LOWER_BOUND, self.UPPER_BOUND))
1737+
1738+ logging.info("Total memory ({} MB) is in the expected range: "
1739+ "({} MB - {} MB)"
1740+ .format(total_mem, self.LOWER_BOUND, self.UPPER_BOUND))
1741+
1742+if __name__ == '__main__':
1743+ logging.basicConfig(level=logging.DEBUG,
1744+ format='%(levelname)s: %(message)s')
1745+ unittest.main()
1746
1747=== added file 'testsuites/usit/ts_control'
1748--- testsuites/usit/ts_control 1970-01-01 00:00:00 +0000
1749+++ testsuites/usit/ts_control 2015-03-17 18:25:33 +0000
1750@@ -0,0 +1,1 @@
1751+{}
1752
1753=== added file 'testsuites/usit/tslist.run'
1754--- testsuites/usit/tslist.run 1970-01-01 00:00:00 +0000
1755+++ testsuites/usit/tslist.run 2015-03-17 18:25:33 +0000
1756@@ -0,0 +1,14 @@
1757+- test: read_write
1758+- test: dbus_machine_id
1759+- test: empty_startup_app
1760+- test: encrypted_home_content
1761+- test: encrypted_home_permissions
1762+- test: no_rofs_machine_id
1763+- test: desktop_shortcut_exists
1764+- test: oem_pkg_installed
1765+- test: ubiquity
1766+- test: total_mem
1767+- test: total_disk
1768+- test: disk_not_full
1769+- test: out_of_memory
1770+- test: archive_location
1771
1772=== added directory 'testsuites/usit/ubiquity'
1773=== added file 'testsuites/usit/ubiquity/tc_control'
1774--- testsuites/usit/ubiquity/tc_control 1970-01-01 00:00:00 +0000
1775+++ testsuites/usit/ubiquity/tc_control 2015-03-17 18:25:33 +0000
1776@@ -0,0 +1,4 @@
1777+description: Ubiquity installation works correctly
1778+type: userland
1779+command: ./test.py
1780+run_as: utah
1781
1782=== added file 'testsuites/usit/ubiquity/test.py'
1783--- testsuites/usit/ubiquity/test.py 1970-01-01 00:00:00 +0000
1784+++ testsuites/usit/ubiquity/test.py 2015-03-17 18:25:33 +0000
1785@@ -0,0 +1,146 @@
1786+#!/usr/bin/python
1787+#
1788+# Copyright (C) 2012, Canonical Ltd (http://www.canonical.com/)
1789+#
1790+# This file is part of ubuntu-test-cases.
1791+#
1792+# ubuntu-test-cases is free software: you can redistribute it
1793+# and/or modify it under the terms of the GNU General Public License
1794+# as published by the Free Software Foundation, either version 3 of
1795+# the License, or (at your option) any later version.
1796+#
1797+# ubuntu-test-cases is distributed in the hope that it will
1798+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
1799+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1800+# GNU General Public License for more details.
1801+#
1802+# You should have received a copy of the GNU General Public License
1803+# along with ubuntu-test-cases. If not, see
1804+# <http://www.gnu.org/licenses/>.
1805+
1806+"""Ubiquity installation works correctly."""
1807+
1808+import logging
1809+import unittest
1810+import ldtp
1811+import ooldtp
1812+import time
1813+
1814+
1815+class UbiquityTest(unittest.TestCase):
1816+ MAIN_WINDOW = 'frmlive_installer'
1817+ BTN_FORWARD = 'btnnext'
1818+ BTN_INSTALL_NOW = 'btnnext'
1819+ RBTN_USE_ENTIRE_DISK = 'rbtnusedevice'
1820+ RBTN_LOGIN_AUTOMATICALLY = 'rbtnloginauto'
1821+
1822+ TXT_LOCATION = 'txttimezonecityentry' # Timezone selector
1823+ TXT_FULLNAME = 'txtfullname'
1824+ TXT_HOSTNAME = 'txthostname'
1825+ TXT_USERNAME = 'txtusername'
1826+ TXT_PASSWORD1 = 'txtpassword' # Password
1827+ TXT_PASSWORD2 = 'txtverifiedpassword' # Password confirmation
1828+
1829+ def _waittillenabled(self, ui, component_name, timeout=300):
1830+ """Wait until widget is enabled."""
1831+ ldtp.wait(15) # UI is slow to react sometimes
1832+ component = ui.getchild(component_name)
1833+ while not component.stateenabled():
1834+ logging.debug('Waiting for {}. Till {} to go'
1835+ .format(component_name, timeout))
1836+ ldtp.wait(15)
1837+ timeout -= 15
1838+ if timeout < 0:
1839+ return False
1840+ return True
1841+
1842+ def test_ubiquity(self):
1843+ """Ubiquity installation works correctly."""
1844+ # Content to fill the forms with
1845+ data = {
1846+ 'location': 'London',
1847+ 'fullname': 'Ubuntu Smoke Test User',
1848+ 'hostname': 'smoketest',
1849+ 'username': 'ubuntu',
1850+ 'password1': 'ubuntu',
1851+ 'password2': 'ubuntu'
1852+ }
1853+
1854+ # Give time for LDTP to start up
1855+ logging.info('Sleeping for 5s')
1856+ time.sleep(5)
1857+
1858+ logging.info('Launching Ubiquity')
1859+ ldtp.launchapp('ubiquity', ['gtk_ui'])
1860+ ldtp.waittillguiexist(self.MAIN_WINDOW)
1861+ ldtp.wait(30) # Ubiquity in a VM is sooo sloooow
1862+ ui = ooldtp.context(self.MAIN_WINDOW)
1863+
1864+ # First Screen
1865+ logging.info('Welcome Screen')
1866+ ldtp.wait(30)
1867+ ui.click(self.BTN_FORWARD)
1868+ self._waittillenabled(ui, self.BTN_FORWARD)
1869+
1870+ # Choose here if you want to install stuff from network
1871+ logging.info('Preparing to install Ubuntu')
1872+ logging.info('Leave defaults')
1873+ ui.click(self.BTN_FORWARD)
1874+ self._waittillenabled(ui, self.BTN_FORWARD)
1875+
1876+ # Drive setup
1877+ logging.info('Allocate Disk Drive')
1878+ logging.info('Use entire partition')
1879+ ui.click(self.RBTN_USE_ENTIRE_DISK)
1880+ ui.click(self.BTN_FORWARD)
1881+ ldtp.wait(30)
1882+ ui.remap()
1883+ ldtp.wait(30)
1884+ self._waittillenabled(ui, self.BTN_INSTALL_NOW)
1885+
1886+ logging.info('Allocate Drive Space')
1887+ logging.info('Leave defaults')
1888+ ui.click(self.BTN_INSTALL_NOW)
1889+ ui.remap()
1890+ ldtp.wait(30)
1891+
1892+ # Location
1893+ logging.info('Where are you')
1894+ ui.settextvalue(self.TXT_LOCATION, data['location'])
1895+ ui.click(self.BTN_FORWARD)
1896+ self._waittillenabled(ui, self.BTN_FORWARD)
1897+
1898+ # Keyboard
1899+ logging.info('Keyboard Layout')
1900+ ui.click(self.BTN_FORWARD)
1901+ self._waittillenabled(ui, self.BTN_FORWARD)
1902+
1903+ # User Identity
1904+ logging.debug('Who are you?')
1905+ ui.settextvalue(self.TXT_FULLNAME, data['fullname'])
1906+ ui.settextvalue(self.TXT_HOSTNAME, data['hostname'])
1907+ ui.settextvalue(self.TXT_USERNAME, data['username'])
1908+ ui.settextvalue(self.TXT_PASSWORD1, data['password1'])
1909+ ui.settextvalue(self.TXT_PASSWORD2, data['password2'])
1910+ ui.click(self.RBTN_LOGIN_AUTOMATICALLY)
1911+ ldtp.wait(30)
1912+ ui.click(self.BTN_FORWARD)
1913+
1914+ ldtp.wait(30)
1915+ ldtp.waittillguiexist('dlgfinished_dialog', guiTimeOut=60 * 20)
1916+
1917+ ldtp.wait(30)
1918+
1919+ # Don't reboot just verify that ubiquity is done
1920+ self.assertTrue(ldtp.guiexist('dlgfinished_dialog', 'btnrebootbutton'))
1921+
1922+ # TODO:
1923+ # Execute here steps to setup pan boot tests
1924+ # Do not reboot here otherwise, the parent script will be interupted
1925+ if ldtp.guiexist('dlgfinished_dialog', 'btnrebootbutton'):
1926+ ldtp.click('dlgfinished_dialog', 'btnquitbutton')
1927+
1928+if __name__ == '__main__':
1929+ logging.basicConfig(level=logging.DEBUG,
1930+ format='%(levelname)s: %(message)s')
1931+ unittest.main()

Subscribers

People subscribed via source and target branches