ubuntu-server-iso-testing-dev team mailing list archive
-
ubuntu-server-iso-testing-dev team
-
Mailing list archive
-
Message #00089
[Merge] lp:~jibel/ubuntu-server-iso-testing/alternate.oem into lp:ubuntu-server-iso-testing
Jean-Baptiste Lallement has proposed merging lp:~jibel/ubuntu-server-iso-testing/alternate.oem into lp:ubuntu-server-iso-testing.
Requested reviews:
Ubuntu Server Iso Testing Developers (ubuntu-server-iso-testing-dev)
For more details, see:
https://code.launchpad.net/~jibel/ubuntu-server-iso-testing/alternate.oem/+merge/70926
Added OEM to alternate
Small fixes to alternate VM definition
+ little feature added to run-test.py to define test specific parameters.
--
https://code.launchpad.net/~jibel/ubuntu-server-iso-testing/alternate.oem/+merge/70926
Your team Ubuntu Server Iso Testing Developers is requested to review the proposed merge of lp:~jibel/ubuntu-server-iso-testing/alternate.oem into lp:ubuntu-server-iso-testing.
=== 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 @@
#
import datetime
-import glob
import logging
import optparse
-import os.path
import os
import pipes
import random
@@ -33,12 +31,11 @@
import sys
import tempfile
import uuid
-import urllib
import time
import couchdb
import jinja2
import re
-from stat import S_IRWXU, S_IRGRP, S_IXGRP, S_IROTH, S_IXOTH
+import ConfigParser
logging.basicConfig(level=logging.DEBUG)
@@ -61,9 +58,32 @@
DEFAULT_TEST_TIMEOUT = 3600
DISK_SIZE = "6G"
+def load_test_config(test_dir, config_file = "config"):
+ """Load test configuration from config file in test directory"""
+ config_path = os.path.join(test_dir, config_file)
+ logging.debug("Loading test configuration file: '%s'", config_path)
+ config = ConfigParser.SafeConfigParser()
+
+ config.read(config_path)
+
+ return config
+
+def get_config_value(config, section, option):
+ """Return the value for a section/option in a preloaded config file"""
+ logging.debug("Loading configuration option: '%s/%s'", section, option)
+ try:
+ value = config.get(section, option)
+ return value
+ except ConfigParser.NoSectionError:
+ logging.info("Section doesn't exists: '%s'", section)
+ return ''
+ except ConfigParser.NoOptionError:
+ logging.info("Option doesn't exists: '%s/%s'", section, option)
+ return ''
+
# Defaults
DEFAULT_VARIANT = 'server'
-DEFAULT_RELEASE = 'maverick'
+DEFAULT_RELEASE = 'oneiric'
DEFAULT_ARCH = 'i386'
DEFAULT_FLAVOR= 'ubuntu-server'
DEFAULT_ISOROOT = os.path.expanduser('~/isos')
@@ -193,6 +213,7 @@
t_preseed = os.path.basename(os.path.normpath(preseed))
logging.info("Generating %s configuration" % (t_preseed))
+test_config = load_test_config(os.path.join(preseed))
old_wd = os.getcwd()
mac_address = random_mac_address()
@@ -237,7 +258,7 @@
logging.debug("Copying preseed to tftp root")
shutil.copy(preseed_file,os.path.join(TFTP_DIR,'preseed.%s' % test_uuid))
-logging.info("Copying run_test")
+logging.info("Copying %s -> %s", RUN_TEST, initrd_tmp_dir)
# Put run_test in the initrd so that the installer can copy it
# into the target system at late_command time
shutil.copy(RUN_TEST, os.path.join(initrd_tmp_dir, 'run_test'))
@@ -301,9 +322,11 @@
# Generate pxelinux configuration file for test cashe
logging.debug("Copying pxelinux config to tftp root")
+kernel_boot_args = get_config_value(test_config, 'pxelinux', 'kernel_boot_args')
tmpl = templates.get_template('pxelinuxcfg.install')
ctxt = { 'mac': mac_address,
- 'uuid': test_uuid
+ 'uuid': test_uuid,
+ 'kernel_boot_args': kernel_boot_args
}
logging.debug("Context: %s" % (ctxt))
pxelinux_cfg_file = os.path.join(TFTP_DIR,'pxelinux.cfg',
=== 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 @@
<domain type='kvm'>
<name>{{ name }}</name>
<uuid>{{ uuid }}</uuid>
- <memory>450000</memory>
+ <memory>1024000</memory>
<vcpu>1</vcpu>
<features>
<acpi/>
@@ -50,7 +50,12 @@
<mac address='{{ mac }}'/>
<source network='iso-testing' />
<model type='virtio'/>
- </interface>
- <graphics type='vnc' listen='0.0.0.0'/>
- </devices>
+ </interface>
+ <graphics type='vnc' listen='0.0.0.0'/>
+ <video>
+ <model type='vga' vram='12288' heads='1'>
+ <acceleration accel3d='yes' accel2d='yes'/>
+ </model>
+ </video>
+ </devices>
</domain>
=== 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 @@
### Localization
# Locale sets language and country.
-d-i debian-installer/locale string en_CA.UTF-8
+d-i debian-installer/locale string en_US.UTF-8
# Keyboard selection.
# Disable automatic (interactive) keymap detection.
d-i console-setup/ask_detect boolean false
#d-i console-setup/modelcode string pc105
-d-i console-setup/layoutcode string ca
+d-i console-setup/layoutcode string us
# To select a variant of the selected layout (if you leave this out, the
# basic form of the layout will be used):
#d-i console-setup/variantcode string dvorak
@@ -175,12 +175,14 @@
# or encrypted using an MD5 hash.
#d-i passwd/root-password-crypted password [MD5 hash]
+{% block user_account %}
# To create a normal user account.
d-i passwd/user-fullname string Ubuntu
d-i passwd/username string ubuntu
# Normal user's password, either in clear text
d-i passwd/user-password password !ubuntu123
d-i passwd/user-password-again password !ubuntu123
+{% endblock %}
# No boot splash screen.
d-i debian-installer/splash boolean false
@@ -219,6 +221,11 @@
# Wait for two seconds in grub
d-i grub-installer/timeout string 2
+### OEM Configuration
+{% block oem_mode %}
+# OEM Mode disabled
+{% endblock %}
+
### Package selection
{% block tasksel_first %}
=== 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 @@
label install
kernel kernel.{{ uuid }}
initrd initrd.{{ uuid }}
-append file=/preseed DEBCONF_DEBUG=developer -- debconf/priority=critical locale=en_US console-setup/ask_detect=false console-setup/layoutcode=us
-
+append file=/preseed DEBCONF_DEBUG=developer -- debconf/priority=critical locale=en_US console-setup/ask_detect=false console-setup/layoutcode=us {{ kernel_boot_args }}
=== 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 @@
+#
+# Copyright (C) 2011, Canonical Ltd (http://www.canonical.com/)
+#
+# This file is part of ubuntu-server-iso-testing.
+#
+# ubuntu-server-iso-testing is free software: you can redistribute it
+# and/or modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ubuntu-server-iso-testing is distributed in the hope that it will
+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with ubuntu-server-iso-testing. If not, see
+# <http://www.gnu.org/licenses/>.
+#
+#
+# Test Case specific configuration file
+[pxelinux]
+kernel_boot_args=oem-config/enable=true
=== 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 @@
+#
+# Copyright (C) 2010, Canonical Ltd (http://www.canonical.com/)
+#
+# This file is part of ubuntu-server-iso-testing.
+#
+# ubuntu-server-iso-testing is free software: you can redistribute it
+# and/or modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ubuntu-server-iso-testing is distributed in the hope that it will
+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with ubuntu-server-iso-testing. If not, see
+# <http://www.gnu.org/licenses/>.
+#
+
+{% extends "base" %}
+
+{% block user_account %}
+# OEM Install
+d-i passwd/allow-password-empty boolean true
+d-i passwd/user-fullname string OEM Configuration (temporary user)
+d-i passwd/username string oem
+d-i passwd/user-password string !ubuntu123
+d-i passwd/user-password-again string !ubuntu123
+{% endblock %}
+
+{% block oem_mode %}
+# enable oem mode
+d-i oem-config/enable boolean true
+d-i oem-config/id string USIT_OEM
+{% endblock %}
=== 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 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2010, Canonical Ltd (http://www.canonical.com/)
+#
+# This file is part of ubuntu-server-iso-testing.
+#
+# ubuntu-server-iso-testing is free software: you can redistribute it
+# and/or modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ubuntu-server-iso-testing is distributed in the hope that it will
+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with ubuntu-server-iso-testing. If not, see
+# <http://www.gnu.org/licenses/>.
+#
+
+import logging
+import os.path
+import unittest
+import subprocess
+
+logging.basicConfig(level=logging.INFO)
+
+def cmd(command, input = None, stderr = subprocess.STDOUT, stdout = subprocess.PIPE, stdin = None):
+ '''Try to execute given command (array) and return its stdout, or return
+ a textual error if it failed.'''
+ try:
+ sp = subprocess.Popen(command, stdin=stdin, stdout=stdout, stderr=stderr, close_fds=True)
+ except OSError, e:
+ return [127, str(e)]
+
+ out, outerr = sp.communicate(input)
+ # Handle redirection of stdout
+ if out == None:
+ out = ''
+ # Handle redirection of stderr
+ if outerr == None:
+ outerr = ''
+ return [sp.returncode,out+outerr]
+
+
+class OemTest(unittest.TestCase):
+ # Only works on english installation since Desktop is localized
+ desktop_shortcut_path = '/home/oem/Desktop/oem-config-prepare-gtk.desktop'
+
+ # The following packages must be installed
+ oem_pkglist = (
+ 'oem-config',
+ 'oem-config-gtk'
+ )
+
+ def test_01ReadWrite(self):
+ t_fh = open(os.path.join('/tmp', 'a'), 'w')
+ self.assertNotEqual(t_fh, None)
+ self.assertEqual(t_fh.write('a'), None)
+ self.assertEqual(t_fh.close(), None)
+
+ def test_02DesktopShortcutExists(self):
+ """Test if the desktop shortcut has been created successfully"""
+ self.assertTrue(os.path.exists(self.desktop_shortcut_path))
+
+ def test_03OEMPkgInstalled(self):
+ """Verify that OEM packages are installed"""
+ for pkg in self.oem_pkglist:
+ rc, report = cmd(['dpkg-query', '-W', pkg])
+ expected = 0
+ result = 'Got exit code %d, expected %d\n' % (rc, expected)
+ self.assertEquals(expected, rc, result + report)
+
+
+if __name__ == '__main__':
+ unittest.main()
=== 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 @@
<model type='virtio'/>
</interface>
<graphics type='vnc' listen='0.0.0.0'/>
+ <video>
+ <model type='vga' vram='12288' heads='1'>
+ <acceleration accel3d='yes' accel2d='yes'/>
+ </model>
+ </video>
</devices>
</domain>
Follow ups