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
=== modified file 'run-test.py'
--- run-test.py 2011-07-29 16:28:51 +0000
+++ run-test.py 2011-08-09 16:51:19 +0000
@@ -20,10 +20,8 @@
20# 20#
2121
22import datetime22import datetime
23import glob
24import logging23import logging
25import optparse24import optparse
26import os.path
27import os25import os
28import pipes26import pipes
29import random27import random
@@ -33,12 +31,11 @@
33import sys31import sys
34import tempfile32import tempfile
35import uuid33import uuid
36import urllib
37import time34import time
38import couchdb35import couchdb
39import jinja236import jinja2
40import re37import re
41from stat import S_IRWXU, S_IRGRP, S_IXGRP, S_IROTH, S_IXOTH38import ConfigParser
4239
43logging.basicConfig(level=logging.DEBUG)40logging.basicConfig(level=logging.DEBUG)
4441
@@ -61,9 +58,32 @@
61 DEFAULT_TEST_TIMEOUT = 360058 DEFAULT_TEST_TIMEOUT = 3600
62 DISK_SIZE = "6G"59 DISK_SIZE = "6G"
6360
61def load_test_config(test_dir, config_file = "config"):
62 """Load test configuration from config file in test directory"""
63 config_path = os.path.join(test_dir, config_file)
64 logging.debug("Loading test configuration file: '%s'", config_path)
65 config = ConfigParser.SafeConfigParser()
66
67 config.read(config_path)
68
69 return config
70
71def get_config_value(config, section, option):
72 """Return the value for a section/option in a preloaded config file"""
73 logging.debug("Loading configuration option: '%s/%s'", section, option)
74 try:
75 value = config.get(section, option)
76 return value
77 except ConfigParser.NoSectionError:
78 logging.info("Section doesn't exists: '%s'", section)
79 return ''
80 except ConfigParser.NoOptionError:
81 logging.info("Option doesn't exists: '%s/%s'", section, option)
82 return ''
83
64# Defaults84# Defaults
65DEFAULT_VARIANT = 'server'85DEFAULT_VARIANT = 'server'
66DEFAULT_RELEASE = 'maverick'86DEFAULT_RELEASE = 'oneiric'
67DEFAULT_ARCH = 'i386'87DEFAULT_ARCH = 'i386'
68DEFAULT_FLAVOR= 'ubuntu-server'88DEFAULT_FLAVOR= 'ubuntu-server'
69DEFAULT_ISOROOT = os.path.expanduser('~/isos')89DEFAULT_ISOROOT = os.path.expanduser('~/isos')
@@ -193,6 +213,7 @@
193213
194t_preseed = os.path.basename(os.path.normpath(preseed))214t_preseed = os.path.basename(os.path.normpath(preseed))
195logging.info("Generating %s configuration" % (t_preseed))215logging.info("Generating %s configuration" % (t_preseed))
216test_config = load_test_config(os.path.join(preseed))
196217
197old_wd = os.getcwd()218old_wd = os.getcwd()
198mac_address = random_mac_address()219mac_address = random_mac_address()
@@ -237,7 +258,7 @@
237logging.debug("Copying preseed to tftp root")258logging.debug("Copying preseed to tftp root")
238shutil.copy(preseed_file,os.path.join(TFTP_DIR,'preseed.%s' % test_uuid))259shutil.copy(preseed_file,os.path.join(TFTP_DIR,'preseed.%s' % test_uuid))
239260
240logging.info("Copying run_test")261logging.info("Copying %s -> %s", RUN_TEST, initrd_tmp_dir)
241# Put run_test in the initrd so that the installer can copy it262# Put run_test in the initrd so that the installer can copy it
242# into the target system at late_command time263# into the target system at late_command time
243shutil.copy(RUN_TEST, os.path.join(initrd_tmp_dir, 'run_test'))264shutil.copy(RUN_TEST, os.path.join(initrd_tmp_dir, 'run_test'))
@@ -301,9 +322,11 @@
301# Generate pxelinux configuration file for test cashe322# Generate pxelinux configuration file for test cashe
302323
303logging.debug("Copying pxelinux config to tftp root")324logging.debug("Copying pxelinux config to tftp root")
325kernel_boot_args = get_config_value(test_config, 'pxelinux', 'kernel_boot_args')
304tmpl = templates.get_template('pxelinuxcfg.install')326tmpl = templates.get_template('pxelinuxcfg.install')
305ctxt = { 'mac': mac_address,327ctxt = { 'mac': mac_address,
306 'uuid': test_uuid328 'uuid': test_uuid,
329 'kernel_boot_args': kernel_boot_args
307 }330 }
308logging.debug("Context: %s" % (ctxt))331logging.debug("Context: %s" % (ctxt))
309pxelinux_cfg_file = os.path.join(TFTP_DIR,'pxelinux.cfg',332pxelinux_cfg_file = os.path.join(TFTP_DIR,'pxelinux.cfg',
310333
=== modified file 'templates.alternate/libvirt.xml'
--- templates.alternate/libvirt.xml 2011-06-26 14:06:40 +0000
+++ templates.alternate/libvirt.xml 2011-08-09 16:51:19 +0000
@@ -20,7 +20,7 @@
20<domain type='kvm'>20<domain type='kvm'>
21 <name>{{ name }}</name>21 <name>{{ name }}</name>
22 <uuid>{{ uuid }}</uuid>22 <uuid>{{ uuid }}</uuid>
23 <memory>450000</memory>23 <memory>1024000</memory>
24 <vcpu>1</vcpu>24 <vcpu>1</vcpu>
25 <features>25 <features>
26 <acpi/>26 <acpi/>
@@ -50,7 +50,12 @@
50 <mac address='{{ mac }}'/>50 <mac address='{{ mac }}'/>
51 <source network='iso-testing' />51 <source network='iso-testing' />
52 <model type='virtio'/>52 <model type='virtio'/>
53 </interface>53 </interface>
54 <graphics type='vnc' listen='0.0.0.0'/>54 <graphics type='vnc' listen='0.0.0.0'/>
55 </devices>55 <video>
56 <model type='vga' vram='12288' heads='1'>
57 <acceleration accel3d='yes' accel2d='yes'/>
58 </model>
59 </video>
60 </devices>
56</domain>61</domain>
5762
=== modified file 'templates.alternate/preseeds-common/base'
--- templates.alternate/preseeds-common/base 2011-03-04 13:50:04 +0000
+++ templates.alternate/preseeds-common/base 2011-08-09 16:51:19 +0000
@@ -20,13 +20,13 @@
2020
21### Localization21### Localization
22# Locale sets language and country.22# Locale sets language and country.
23d-i debian-installer/locale string en_CA.UTF-823d-i debian-installer/locale string en_US.UTF-8
2424
25# Keyboard selection.25# Keyboard selection.
26# Disable automatic (interactive) keymap detection.26# Disable automatic (interactive) keymap detection.
27d-i console-setup/ask_detect boolean false27d-i console-setup/ask_detect boolean false
28#d-i console-setup/modelcode string pc10528#d-i console-setup/modelcode string pc105
29d-i console-setup/layoutcode string ca29d-i console-setup/layoutcode string us
30# To select a variant of the selected layout (if you leave this out, the30# To select a variant of the selected layout (if you leave this out, the
31# basic form of the layout will be used):31# basic form of the layout will be used):
32#d-i console-setup/variantcode string dvorak32#d-i console-setup/variantcode string dvorak
@@ -175,12 +175,14 @@
175# or encrypted using an MD5 hash.175# or encrypted using an MD5 hash.
176#d-i passwd/root-password-crypted password [MD5 hash]176#d-i passwd/root-password-crypted password [MD5 hash]
177177
178{% block user_account %}
178# To create a normal user account.179# To create a normal user account.
179d-i passwd/user-fullname string Ubuntu180d-i passwd/user-fullname string Ubuntu
180d-i passwd/username string ubuntu181d-i passwd/username string ubuntu
181# Normal user's password, either in clear text182# Normal user's password, either in clear text
182d-i passwd/user-password password !ubuntu123183d-i passwd/user-password password !ubuntu123
183d-i passwd/user-password-again password !ubuntu123184d-i passwd/user-password-again password !ubuntu123
185{% endblock %}
184186
185# No boot splash screen.187# No boot splash screen.
186d-i debian-installer/splash boolean false188d-i debian-installer/splash boolean false
@@ -219,6 +221,11 @@
219# Wait for two seconds in grub221# Wait for two seconds in grub
220d-i grub-installer/timeout string 2222d-i grub-installer/timeout string 2
221223
224### OEM Configuration
225{% block oem_mode %}
226# OEM Mode disabled
227{% endblock %}
228
222### Package selection229### Package selection
223230
224{% block tasksel_first %}231{% block tasksel_first %}
225232
=== modified file 'templates.alternate/pxelinuxcfg.install'
--- templates.alternate/pxelinuxcfg.install 2011-06-15 12:06:07 +0000
+++ templates.alternate/pxelinuxcfg.install 2011-08-09 16:51:19 +0000
@@ -25,5 +25,4 @@
25label install25label install
26kernel kernel.{{ uuid }}26kernel kernel.{{ uuid }}
27initrd initrd.{{ uuid }}27initrd initrd.{{ uuid }}
28append file=/preseed DEBCONF_DEBUG=developer -- debconf/priority=critical locale=en_US console-setup/ask_detect=false console-setup/layoutcode=us28append file=/preseed DEBCONF_DEBUG=developer -- debconf/priority=critical locale=en_US console-setup/ask_detect=false console-setup/layoutcode=us {{ kernel_boot_args }}
29
3029
=== added directory 'templates.alternate/test_cases/oem'
=== added file 'templates.alternate/test_cases/oem/config'
--- templates.alternate/test_cases/oem/config 1970-01-01 00:00:00 +0000
+++ templates.alternate/test_cases/oem/config 2011-08-09 16:51:19 +0000
@@ -0,0 +1,23 @@
1#
2# Copyright (C) 2011, Canonical Ltd (http://www.canonical.com/)
3#
4# This file is part of ubuntu-server-iso-testing.
5#
6# ubuntu-server-iso-testing is free software: you can redistribute it
7# and/or modify it under the terms of the GNU General Public License
8# as published by the Free Software Foundation, either version 3 of
9# the License, or (at your option) any later version.
10#
11# ubuntu-server-iso-testing is distributed in the hope that it will
12# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with ubuntu-server-iso-testing. If not, see
18# <http://www.gnu.org/licenses/>.
19#
20#
21# Test Case specific configuration file
22[pxelinux]
23kernel_boot_args=oem-config/enable=true
024
=== added file 'templates.alternate/test_cases/oem/preseed'
--- templates.alternate/test_cases/oem/preseed 1970-01-01 00:00:00 +0000
+++ templates.alternate/test_cases/oem/preseed 2011-08-09 16:51:19 +0000
@@ -0,0 +1,36 @@
1#
2# Copyright (C) 2010, Canonical Ltd (http://www.canonical.com/)
3#
4# This file is part of ubuntu-server-iso-testing.
5#
6# ubuntu-server-iso-testing is free software: you can redistribute it
7# and/or modify it under the terms of the GNU General Public License
8# as published by the Free Software Foundation, either version 3 of
9# the License, or (at your option) any later version.
10#
11# ubuntu-server-iso-testing is distributed in the hope that it will
12# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with ubuntu-server-iso-testing. If not, see
18# <http://www.gnu.org/licenses/>.
19#
20
21{% extends "base" %}
22
23{% block user_account %}
24# OEM Install
25d-i passwd/allow-password-empty boolean true
26d-i passwd/user-fullname string OEM Configuration (temporary user)
27d-i passwd/username string oem
28d-i passwd/user-password string !ubuntu123
29d-i passwd/user-password-again string !ubuntu123
30{% endblock %}
31
32{% block oem_mode %}
33# enable oem mode
34d-i oem-config/enable boolean true
35d-i oem-config/id string USIT_OEM
36{% endblock %}
037
=== added file 'templates.alternate/test_cases/oem/test'
--- templates.alternate/test_cases/oem/test 1970-01-01 00:00:00 +0000
+++ templates.alternate/test_cases/oem/test 2011-08-09 16:51:19 +0000
@@ -0,0 +1,77 @@
1#!/usr/bin/python
2#
3# Copyright (C) 2010, Canonical Ltd (http://www.canonical.com/)
4#
5# This file is part of ubuntu-server-iso-testing.
6#
7# ubuntu-server-iso-testing is free software: you can redistribute it
8# and/or modify it under the terms of the GNU General Public License
9# as published by the Free Software Foundation, either version 3 of
10# the License, or (at your option) any later version.
11#
12# ubuntu-server-iso-testing is distributed in the hope that it will
13# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with ubuntu-server-iso-testing. If not, see
19# <http://www.gnu.org/licenses/>.
20#
21
22import logging
23import os.path
24import unittest
25import subprocess
26
27logging.basicConfig(level=logging.INFO)
28
29def cmd(command, input = None, stderr = subprocess.STDOUT, stdout = subprocess.PIPE, stdin = None):
30 '''Try to execute given command (array) and return its stdout, or return
31 a textual error if it failed.'''
32 try:
33 sp = subprocess.Popen(command, stdin=stdin, stdout=stdout, stderr=stderr, close_fds=True)
34 except OSError, e:
35 return [127, str(e)]
36
37 out, outerr = sp.communicate(input)
38 # Handle redirection of stdout
39 if out == None:
40 out = ''
41 # Handle redirection of stderr
42 if outerr == None:
43 outerr = ''
44 return [sp.returncode,out+outerr]
45
46
47class OemTest(unittest.TestCase):
48 # Only works on english installation since Desktop is localized
49 desktop_shortcut_path = '/home/oem/Desktop/oem-config-prepare-gtk.desktop'
50
51 # The following packages must be installed
52 oem_pkglist = (
53 'oem-config',
54 'oem-config-gtk'
55 )
56
57 def test_01ReadWrite(self):
58 t_fh = open(os.path.join('/tmp', 'a'), 'w')
59 self.assertNotEqual(t_fh, None)
60 self.assertEqual(t_fh.write('a'), None)
61 self.assertEqual(t_fh.close(), None)
62
63 def test_02DesktopShortcutExists(self):
64 """Test if the desktop shortcut has been created successfully"""
65 self.assertTrue(os.path.exists(self.desktop_shortcut_path))
66
67 def test_03OEMPkgInstalled(self):
68 """Verify that OEM packages are installed"""
69 for pkg in self.oem_pkglist:
70 rc, report = cmd(['dpkg-query', '-W', pkg])
71 expected = 0
72 result = 'Got exit code %d, expected %d\n' % (rc, expected)
73 self.assertEquals(expected, rc, result + report)
74
75
76if __name__ == '__main__':
77 unittest.main()
078
=== modified file 'templates.desktop/libvirt.xml'
--- templates.desktop/libvirt.xml 2011-06-26 14:06:40 +0000
+++ templates.desktop/libvirt.xml 2011-08-09 16:51:19 +0000
@@ -52,5 +52,10 @@
52 <model type='virtio'/>52 <model type='virtio'/>
53 </interface>53 </interface>
54 <graphics type='vnc' listen='0.0.0.0'/>54 <graphics type='vnc' listen='0.0.0.0'/>
55 <video>
56 <model type='vga' vram='12288' heads='1'>
57 <acceleration accel3d='yes' accel2d='yes'/>
58 </model>
59 </video>
55 </devices>60 </devices>
56</domain>61</domain>

Subscribers

People subscribed via source and target branches