Merge lp:~jibel/ubuntu-server-iso-testing/alternate.oem into lp:ubuntu-server-iso-testing

Proposed by Jean-Baptiste Lallement
Status: Merged
Merged at revision: 235
Proposed branch: lp:~jibel/ubuntu-server-iso-testing/alternate.oem
Merge into: lp:ubuntu-server-iso-testing
Diff against target: 346 lines (+190/-15)
8 files modified
run-test.py (+30/-7)
templates.alternate/libvirt.xml (+9/-4)
templates.alternate/preseeds-common/base (+9/-2)
templates.alternate/pxelinuxcfg.install (+1/-2)
templates.alternate/test_cases/oem/config (+23/-0)
templates.alternate/test_cases/oem/preseed (+36/-0)
templates.alternate/test_cases/oem/test (+77/-0)
templates.desktop/libvirt.xml (+5/-0)
To merge this branch: bzr merge lp:~jibel/ubuntu-server-iso-testing/alternate.oem
Reviewer Review Type Date Requested Status
C de-Avillez (community) Approve
Review via email: mp+70926@code.launchpad.net

Description of the change

Added OEM to alternate
Small fixes to alternate VM definition
+ little feature added to run-test.py to define test specific parameters.

To post a comment you must log in.
Revision history for this message
C de-Avillez (hggdh2) wrote :

Go for it.

Just two comments, mostly for reference, and before I forget:

1. we should standardise on an account/password for those throw-away systems. Right now we use account=ubuntu, password={!ubuntu123, ubuntu, insecure}, on different places. Personally, I like 'insecure' ;-)

2. we have to look for, and change all references to en_ca.UTF8 (or country code CA) to en_US.UTF8 and US). Jean-Baptiste already did this one here, which was why I remembered about it.

Revision history for this message
C de-Avillez (hggdh2) wrote :

Of course, if I approve, I should mark it as such. Sigh.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'run-test.py'
2--- run-test.py 2011-07-29 16:28:51 +0000
3+++ run-test.py 2011-08-09 16:51:19 +0000
4@@ -20,10 +20,8 @@
5 #
6
7 import datetime
8-import glob
9 import logging
10 import optparse
11-import os.path
12 import os
13 import pipes
14 import random
15@@ -33,12 +31,11 @@
16 import sys
17 import tempfile
18 import uuid
19-import urllib
20 import time
21 import couchdb
22 import jinja2
23 import re
24-from stat import S_IRWXU, S_IRGRP, S_IXGRP, S_IROTH, S_IXOTH
25+import ConfigParser
26
27 logging.basicConfig(level=logging.DEBUG)
28
29@@ -61,9 +58,32 @@
30 DEFAULT_TEST_TIMEOUT = 3600
31 DISK_SIZE = "6G"
32
33+def load_test_config(test_dir, config_file = "config"):
34+ """Load test configuration from config file in test directory"""
35+ config_path = os.path.join(test_dir, config_file)
36+ logging.debug("Loading test configuration file: '%s'", config_path)
37+ config = ConfigParser.SafeConfigParser()
38+
39+ config.read(config_path)
40+
41+ return config
42+
43+def get_config_value(config, section, option):
44+ """Return the value for a section/option in a preloaded config file"""
45+ logging.debug("Loading configuration option: '%s/%s'", section, option)
46+ try:
47+ value = config.get(section, option)
48+ return value
49+ except ConfigParser.NoSectionError:
50+ logging.info("Section doesn't exists: '%s'", section)
51+ return ''
52+ except ConfigParser.NoOptionError:
53+ logging.info("Option doesn't exists: '%s/%s'", section, option)
54+ return ''
55+
56 # Defaults
57 DEFAULT_VARIANT = 'server'
58-DEFAULT_RELEASE = 'maverick'
59+DEFAULT_RELEASE = 'oneiric'
60 DEFAULT_ARCH = 'i386'
61 DEFAULT_FLAVOR= 'ubuntu-server'
62 DEFAULT_ISOROOT = os.path.expanduser('~/isos')
63@@ -193,6 +213,7 @@
64
65 t_preseed = os.path.basename(os.path.normpath(preseed))
66 logging.info("Generating %s configuration" % (t_preseed))
67+test_config = load_test_config(os.path.join(preseed))
68
69 old_wd = os.getcwd()
70 mac_address = random_mac_address()
71@@ -237,7 +258,7 @@
72 logging.debug("Copying preseed to tftp root")
73 shutil.copy(preseed_file,os.path.join(TFTP_DIR,'preseed.%s' % test_uuid))
74
75-logging.info("Copying run_test")
76+logging.info("Copying %s -> %s", RUN_TEST, initrd_tmp_dir)
77 # Put run_test in the initrd so that the installer can copy it
78 # into the target system at late_command time
79 shutil.copy(RUN_TEST, os.path.join(initrd_tmp_dir, 'run_test'))
80@@ -301,9 +322,11 @@
81 # Generate pxelinux configuration file for test cashe
82
83 logging.debug("Copying pxelinux config to tftp root")
84+kernel_boot_args = get_config_value(test_config, 'pxelinux', 'kernel_boot_args')
85 tmpl = templates.get_template('pxelinuxcfg.install')
86 ctxt = { 'mac': mac_address,
87- 'uuid': test_uuid
88+ 'uuid': test_uuid,
89+ 'kernel_boot_args': kernel_boot_args
90 }
91 logging.debug("Context: %s" % (ctxt))
92 pxelinux_cfg_file = os.path.join(TFTP_DIR,'pxelinux.cfg',
93
94=== modified file 'templates.alternate/libvirt.xml'
95--- templates.alternate/libvirt.xml 2011-06-26 14:06:40 +0000
96+++ templates.alternate/libvirt.xml 2011-08-09 16:51:19 +0000
97@@ -20,7 +20,7 @@
98 <domain type='kvm'>
99 <name>{{ name }}</name>
100 <uuid>{{ uuid }}</uuid>
101- <memory>450000</memory>
102+ <memory>1024000</memory>
103 <vcpu>1</vcpu>
104 <features>
105 <acpi/>
106@@ -50,7 +50,12 @@
107 <mac address='{{ mac }}'/>
108 <source network='iso-testing' />
109 <model type='virtio'/>
110- </interface>
111- <graphics type='vnc' listen='0.0.0.0'/>
112- </devices>
113+ </interface>
114+ <graphics type='vnc' listen='0.0.0.0'/>
115+ <video>
116+ <model type='vga' vram='12288' heads='1'>
117+ <acceleration accel3d='yes' accel2d='yes'/>
118+ </model>
119+ </video>
120+ </devices>
121 </domain>
122
123=== modified file 'templates.alternate/preseeds-common/base'
124--- templates.alternate/preseeds-common/base 2011-03-04 13:50:04 +0000
125+++ templates.alternate/preseeds-common/base 2011-08-09 16:51:19 +0000
126@@ -20,13 +20,13 @@
127
128 ### Localization
129 # Locale sets language and country.
130-d-i debian-installer/locale string en_CA.UTF-8
131+d-i debian-installer/locale string en_US.UTF-8
132
133 # Keyboard selection.
134 # Disable automatic (interactive) keymap detection.
135 d-i console-setup/ask_detect boolean false
136 #d-i console-setup/modelcode string pc105
137-d-i console-setup/layoutcode string ca
138+d-i console-setup/layoutcode string us
139 # To select a variant of the selected layout (if you leave this out, the
140 # basic form of the layout will be used):
141 #d-i console-setup/variantcode string dvorak
142@@ -175,12 +175,14 @@
143 # or encrypted using an MD5 hash.
144 #d-i passwd/root-password-crypted password [MD5 hash]
145
146+{% block user_account %}
147 # To create a normal user account.
148 d-i passwd/user-fullname string Ubuntu
149 d-i passwd/username string ubuntu
150 # Normal user's password, either in clear text
151 d-i passwd/user-password password !ubuntu123
152 d-i passwd/user-password-again password !ubuntu123
153+{% endblock %}
154
155 # No boot splash screen.
156 d-i debian-installer/splash boolean false
157@@ -219,6 +221,11 @@
158 # Wait for two seconds in grub
159 d-i grub-installer/timeout string 2
160
161+### OEM Configuration
162+{% block oem_mode %}
163+# OEM Mode disabled
164+{% endblock %}
165+
166 ### Package selection
167
168 {% block tasksel_first %}
169
170=== modified file 'templates.alternate/pxelinuxcfg.install'
171--- templates.alternate/pxelinuxcfg.install 2011-06-15 12:06:07 +0000
172+++ templates.alternate/pxelinuxcfg.install 2011-08-09 16:51:19 +0000
173@@ -25,5 +25,4 @@
174 label install
175 kernel kernel.{{ uuid }}
176 initrd initrd.{{ uuid }}
177-append file=/preseed DEBCONF_DEBUG=developer -- debconf/priority=critical locale=en_US console-setup/ask_detect=false console-setup/layoutcode=us
178-
179+append file=/preseed DEBCONF_DEBUG=developer -- debconf/priority=critical locale=en_US console-setup/ask_detect=false console-setup/layoutcode=us {{ kernel_boot_args }}
180
181=== added directory 'templates.alternate/test_cases/oem'
182=== added file 'templates.alternate/test_cases/oem/config'
183--- templates.alternate/test_cases/oem/config 1970-01-01 00:00:00 +0000
184+++ templates.alternate/test_cases/oem/config 2011-08-09 16:51:19 +0000
185@@ -0,0 +1,23 @@
186+#
187+# Copyright (C) 2011, Canonical Ltd (http://www.canonical.com/)
188+#
189+# This file is part of ubuntu-server-iso-testing.
190+#
191+# ubuntu-server-iso-testing is free software: you can redistribute it
192+# and/or modify it under the terms of the GNU General Public License
193+# as published by the Free Software Foundation, either version 3 of
194+# the License, or (at your option) any later version.
195+#
196+# ubuntu-server-iso-testing is distributed in the hope that it will
197+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
198+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
199+# GNU General Public License for more details.
200+#
201+# You should have received a copy of the GNU General Public License
202+# along with ubuntu-server-iso-testing. If not, see
203+# <http://www.gnu.org/licenses/>.
204+#
205+#
206+# Test Case specific configuration file
207+[pxelinux]
208+kernel_boot_args=oem-config/enable=true
209
210=== added file 'templates.alternate/test_cases/oem/preseed'
211--- templates.alternate/test_cases/oem/preseed 1970-01-01 00:00:00 +0000
212+++ templates.alternate/test_cases/oem/preseed 2011-08-09 16:51:19 +0000
213@@ -0,0 +1,36 @@
214+#
215+# Copyright (C) 2010, Canonical Ltd (http://www.canonical.com/)
216+#
217+# This file is part of ubuntu-server-iso-testing.
218+#
219+# ubuntu-server-iso-testing is free software: you can redistribute it
220+# and/or modify it under the terms of the GNU General Public License
221+# as published by the Free Software Foundation, either version 3 of
222+# the License, or (at your option) any later version.
223+#
224+# ubuntu-server-iso-testing is distributed in the hope that it will
225+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
226+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
227+# GNU General Public License for more details.
228+#
229+# You should have received a copy of the GNU General Public License
230+# along with ubuntu-server-iso-testing. If not, see
231+# <http://www.gnu.org/licenses/>.
232+#
233+
234+{% extends "base" %}
235+
236+{% block user_account %}
237+# OEM Install
238+d-i passwd/allow-password-empty boolean true
239+d-i passwd/user-fullname string OEM Configuration (temporary user)
240+d-i passwd/username string oem
241+d-i passwd/user-password string !ubuntu123
242+d-i passwd/user-password-again string !ubuntu123
243+{% endblock %}
244+
245+{% block oem_mode %}
246+# enable oem mode
247+d-i oem-config/enable boolean true
248+d-i oem-config/id string USIT_OEM
249+{% endblock %}
250
251=== added file 'templates.alternate/test_cases/oem/test'
252--- templates.alternate/test_cases/oem/test 1970-01-01 00:00:00 +0000
253+++ templates.alternate/test_cases/oem/test 2011-08-09 16:51:19 +0000
254@@ -0,0 +1,77 @@
255+#!/usr/bin/python
256+#
257+# Copyright (C) 2010, Canonical Ltd (http://www.canonical.com/)
258+#
259+# This file is part of ubuntu-server-iso-testing.
260+#
261+# ubuntu-server-iso-testing is free software: you can redistribute it
262+# and/or modify it under the terms of the GNU General Public License
263+# as published by the Free Software Foundation, either version 3 of
264+# the License, or (at your option) any later version.
265+#
266+# ubuntu-server-iso-testing is distributed in the hope that it will
267+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
268+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
269+# GNU General Public License for more details.
270+#
271+# You should have received a copy of the GNU General Public License
272+# along with ubuntu-server-iso-testing. If not, see
273+# <http://www.gnu.org/licenses/>.
274+#
275+
276+import logging
277+import os.path
278+import unittest
279+import subprocess
280+
281+logging.basicConfig(level=logging.INFO)
282+
283+def cmd(command, input = None, stderr = subprocess.STDOUT, stdout = subprocess.PIPE, stdin = None):
284+ '''Try to execute given command (array) and return its stdout, or return
285+ a textual error if it failed.'''
286+ try:
287+ sp = subprocess.Popen(command, stdin=stdin, stdout=stdout, stderr=stderr, close_fds=True)
288+ except OSError, e:
289+ return [127, str(e)]
290+
291+ out, outerr = sp.communicate(input)
292+ # Handle redirection of stdout
293+ if out == None:
294+ out = ''
295+ # Handle redirection of stderr
296+ if outerr == None:
297+ outerr = ''
298+ return [sp.returncode,out+outerr]
299+
300+
301+class OemTest(unittest.TestCase):
302+ # Only works on english installation since Desktop is localized
303+ desktop_shortcut_path = '/home/oem/Desktop/oem-config-prepare-gtk.desktop'
304+
305+ # The following packages must be installed
306+ oem_pkglist = (
307+ 'oem-config',
308+ 'oem-config-gtk'
309+ )
310+
311+ def test_01ReadWrite(self):
312+ t_fh = open(os.path.join('/tmp', 'a'), 'w')
313+ self.assertNotEqual(t_fh, None)
314+ self.assertEqual(t_fh.write('a'), None)
315+ self.assertEqual(t_fh.close(), None)
316+
317+ def test_02DesktopShortcutExists(self):
318+ """Test if the desktop shortcut has been created successfully"""
319+ self.assertTrue(os.path.exists(self.desktop_shortcut_path))
320+
321+ def test_03OEMPkgInstalled(self):
322+ """Verify that OEM packages are installed"""
323+ for pkg in self.oem_pkglist:
324+ rc, report = cmd(['dpkg-query', '-W', pkg])
325+ expected = 0
326+ result = 'Got exit code %d, expected %d\n' % (rc, expected)
327+ self.assertEquals(expected, rc, result + report)
328+
329+
330+if __name__ == '__main__':
331+ unittest.main()
332
333=== modified file 'templates.desktop/libvirt.xml'
334--- templates.desktop/libvirt.xml 2011-06-26 14:06:40 +0000
335+++ templates.desktop/libvirt.xml 2011-08-09 16:51:19 +0000
336@@ -52,5 +52,10 @@
337 <model type='virtio'/>
338 </interface>
339 <graphics type='vnc' listen='0.0.0.0'/>
340+ <video>
341+ <model type='vga' vram='12288' heads='1'>
342+ <acceleration accel3d='yes' accel2d='yes'/>
343+ </model>
344+ </video>
345 </devices>
346 </domain>

Subscribers

People subscribed via source and target branches