ubuntu-server-iso-testing-dev team mailing list archive
-
ubuntu-server-iso-testing-dev team
-
Mailing list archive
-
Message #00117
[Merge] lp:~jibel/ubuntu-server-iso-testing/live_session into lp:ubuntu-server-iso-testing
Jean-Baptiste Lallement has proposed merging lp:~jibel/ubuntu-server-iso-testing/live_session into lp:ubuntu-server-iso-testing.
Requested reviews:
Ubuntu Server Iso Testing Developers (ubuntu-server-iso-testing-dev)
Related bugs:
Bug #823429 in ubuntu-server-iso-testing: "Add Live Session testing"
https://bugs.launchpad.net/ubuntu-server-iso-testing/+bug/823429
For more details, see:
https://code.launchpad.net/~jibel/ubuntu-server-iso-testing/live_session/+merge/72168
Basic infrastructure for Live Session testing
I'll then add test cases.
--
https://code.launchpad.net/~jibel/ubuntu-server-iso-testing/live_session/+merge/72168
Your team Ubuntu Server Iso Testing Developers is requested to review the proposed merge of lp:~jibel/ubuntu-server-iso-testing/live_session into lp:ubuntu-server-iso-testing.
=== modified file 'run-test.py'
--- run-test.py 2011-08-16 16:10:01 +0000
+++ run-test.py 2011-08-19 10:55:23 +0000
@@ -36,6 +36,7 @@
import jinja2
import re
import ConfigParser
+import glob
logging.basicConfig(level=logging.DEBUG)
@@ -291,12 +292,31 @@
# Put run_test wrapper in the initrd too
logging.info("Copying custom-installation hooks")
datadir = initrd_tmp_dir
- shutil.copytree( os.path.join(TMPL_DIR, 'custom-installation'), os.path.join(datadir, 'custom-installation') )
+ src_custom_dir = os.path.join(TMPL_DIR, 'custom-installation')
+ dst_custom_dir = os.path.join(datadir, 'custom-installation')
+ test_custom_dir = os.path.join(preseed, 'custom-installation')
+
+ shutil.copytree(src_custom_dir, dst_custom_dir)
+
+ # Overwrite with custom-installation from testdir if any
+ if os.path.exists(test_custom_dir):
+ logging.debug('Test custom-installation directory found. Copying...')
+ cmd = ['cp', '-rf']
+ cmd.extend(glob.glob(test_custom_dir + '/*'))
+ cmd.append(dst_custom_dir)
+ subprocess.call(cmd)
+
+ # Write test_uuid on custom-installation for later use
+ with open(os.path.join(initrd_tmp_dir, 'test.id'), 'w') as ftest:
+ ftest.write('TEST_TRACKER="%s"\n' % TEST_TRACKER)
+ ftest.write('TEST_DATABASE="%s"\n' % TEST_DATABASE)
+ ftest.write('TEST_UUID="%s"\n' % test_uuid)
# TODO: Do not preseed a LDTP installation
shutil.copy(preseed_file, os.path.join(datadir, 'preseed.cfg'))
RUN_TEST_WRAPPER = os.path.join(TMPL_DIR, 'run_test.wrapper')
- shutil.copy(RUN_TEST_WRAPPER, os.path.join(initrd_tmp_dir, 'run_test.wrapper'))
+ shutil.copy(RUN_TEST_WRAPPER, os.path.join(initrd_tmp_dir,
+ 'run_test.wrapper'))
# Keep a copy in test case doc
test_case_doc = db[test_uuid]
db.put_attachment(test_case_doc, open(RUN_TEST_WRAPPER), "run_test.wrapper")
@@ -654,11 +674,11 @@
# Remove TFTP files - no longer required
#shutil.rmtree(test_tftp_dir)
# TODO remove pxelinux configuration from TFTP_DIR
-os.remove(os.path.join(TFTP_DIR,'kernel.%s' % test_uuid))
-os.remove(os.path.join(TFTP_DIR,'initrd.%s' % test_uuid))
-os.remove(os.path.join(TFTP_DIR,'preseed.%s' % test_uuid))
-os.remove(os.path.join(TFTP_DIR,'pxelinux.cfg',
- '01-%s' % mac_address.replace(':','-')))
+os.remove(os.path.join(TFTP_DIR, 'kernel.%s' % test_uuid))
+os.remove(os.path.join(TFTP_DIR, 'initrd.%s' % test_uuid))
+os.remove(os.path.join(TFTP_DIR, 'preseed.%s' % test_uuid))
+os.remove(os.path.join(TFTP_DIR, 'pxelinux.cfg',
+ '01-%s' % mac_address.replace(':', '-')))
# Remove dnsmasq configuration and restart dnsmasq
#logging.debug("Removing dnsmasq configuration for %s" % (test['_id']))
=== modified file 'templates.desktop/pxelinuxcfg.install'
--- templates.desktop/pxelinuxcfg.install 2011-08-11 15:26:22 +0000
+++ templates.desktop/pxelinuxcfg.install 2011-08-19 10:55:23 +0000
@@ -24,5 +24,5 @@
label install
kernel kernel.{{ uuid }}
initrd initrd.{{ uuid }}
-append boot=casper DEBCONF_DEBUG=developer -- debconf/priority=critical locale=en_US console-setup/ask_detect=false console-setup/layoutcode=us keyboard-configuration/layoutcode=fr keyboard-configuration/variantcode=oss noprompt automatic-ubiquity {{ kernel_boot_args }}
+append boot=casper DEBCONF_DEBUG=developer -- debconf/priority=critical locale=en_US console-setup/ask_detect=false console-setup/layoutcode=us keyboard-configuration/layoutcode=fr keyboard-configuration/variantcode=oss noprompt {{ kernel_boot_args }}
=== modified file 'templates.desktop/run_test.wrapper'
--- templates.desktop/run_test.wrapper 2011-04-19 09:22:41 +0000
+++ templates.desktop/run_test.wrapper 2011-08-19 10:55:23 +0000
@@ -35,7 +35,7 @@
done
if [ ! -z "$MISSING" ]; then
- sudo sh -c "echo deb http://archive.ubuntu.com/ubuntu/ natty universe > /etc/apt/sources.list.d/universe.list"
+ sudo sh -c "echo deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs) universe > /etc/apt/sources.list.d/universe.list"
sudo apt-get update
sudo apt-get install -qy $MISSING
@@ -63,12 +63,7 @@
$RUNTEST $@
# Shouldn't reach that point since poweroff is done is run_test
- # Copy the test for the reboot
- #sudo mount -t /dev/vda1 /target
- #cp /run_test /target/usr/local/bin/ ;
- #chroot /target sh -c "sed -i 's/^%admin.*/%admin ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers; chmod 0755 /usr/local/bin/run_test; echo '/usr/local/bin/run_test --syslog --sleep 30 $@' > /etc/rc.local"
- #sudo umount /target
-
+ sleep 30
sudo poweroff
fi
=== added file 'templates.desktop/test_cases/default/config'
--- templates.desktop/test_cases/default/config 1970-01-01 00:00:00 +0000
+++ templates.desktop/test_cases/default/config 2011-08-19 10:55:23 +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=automatic-ubiquity
=== added file 'templates.desktop/test_cases/encryptedhome/config'
--- templates.desktop/test_cases/encryptedhome/config 1970-01-01 00:00:00 +0000
+++ templates.desktop/test_cases/encryptedhome/config 2011-08-19 10:55:23 +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=automatic-ubiquity
=== added directory 'templates.desktop/test_cases/livesession'
=== added directory 'templates.desktop/test_cases/livesession/custom-installation'
=== added directory 'templates.desktop/test_cases/livesession/custom-installation/hooks'
=== added file 'templates.desktop/test_cases/livesession/custom-installation/hooks/casper-bottom.sh'
--- templates.desktop/test_cases/livesession/custom-installation/hooks/casper-bottom.sh 1970-01-01 00:00:00 +0000
+++ templates.desktop/test_cases/livesession/custom-installation/hooks/casper-bottom.sh 2011-08-19 10:55:23 +0000
@@ -0,0 +1,74 @@
+#!/bin/sh
+# If you change this, please also change the copy in ubiquity-hooks/30accessibility.
+
+PREREQ=""
+DESCRIPTION="Running custom script..."
+
+prereqs()
+{
+ echo "$PREREQ"
+}
+
+case $1 in
+# get pre-requisites
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+. /scripts/casper-functions
+
+log_begin_msg "$DESCRIPTION"
+
+gconf_version=$(chroot /root /usr/bin/dpkg-query -W --showformat='${Version}' gconf2 2>/dev/null) || gconf_version=""
+
+gct() {
+ if [ "$gconf_version" ]; then
+ chroot /root sudo -u "$USERNAME" gconftool-2 "$@"
+ fi
+}
+
+create_desktopfile() {
+ AUTOSTART_DIR=/root/home/$USERNAME/.config/autostart
+ DESKTOP_FILE=smoketest.desktop
+ mkdir -p $AUTOSTART_DIR
+ cat > ${AUTOSTART_DIR}/${DESKTOP_FILE}<<EOF
+
+[Desktop Entry]
+Name=ISO SmokeTest
+Comment=ISO SmokeTest
+Exec=/usr/local/bin/run_test.wrapper --syslog --sleep 30 --test-dir=/home/${USERNAME}/tests {{ test_case_url }}
+OnlyShowIn=GNOME;
+NoDisplay=true
+Type=Application
+AutostartCondition=GNOME /desktop/gnome/interface/accessibility
+X-GNOME-Autostart-Phase=Applications
+X-GNOME-AutoRestart=true
+Name[en_US]=ISO SmokeTest
+Comment[en_US]=ISO SmokeTest
+X-GNOME-Autostart-enabled=true
+EOF
+}
+
+override_target() {
+ # Override livefs environment with what has been loaded
+ # on the live cd
+ if [ -d /custom-installation ]; then
+ cp -af /custom-installation/target-override/* /root/ || true
+ rm -rf /custom-installation/target-override* || true
+ fi
+}
+#gct -s -t bool /desktop/gnome/interface/accessibility true
+#create_desktopfile
+
+# Copy the test script which is run from the desktop file
+cp /run_test.wrapper /root/usr/local/bin/
+cp /run_test /root/usr/local/bin/
+cp /test.id /root/
+
+override_target
+
+sed -i 's/^%admin.*/%admin ALL=(ALL) NOPASSWD: ALL/' /root/etc/sudoers
+
+log_end_msg
=== added file 'templates.desktop/test_cases/livesession/custom-installation/hooks/casper-premount.sh'
--- templates.desktop/test_cases/livesession/custom-installation/hooks/casper-premount.sh 1970-01-01 00:00:00 +0000
+++ templates.desktop/test_cases/livesession/custom-installation/hooks/casper-premount.sh 2011-08-19 10:55:23 +0000
@@ -0,0 +1,3 @@
+#!/bin/sh
+#Add casper-premount commands here
+
=== added directory 'templates.desktop/test_cases/livesession/custom-installation/packages'
=== added directory 'templates.desktop/test_cases/livesession/custom-installation/target-override'
=== added directory 'templates.desktop/test_cases/livesession/custom-installation/target-override/etc'
=== added file 'templates.desktop/test_cases/livesession/custom-installation/target-override/etc/rc.local'
--- templates.desktop/test_cases/livesession/custom-installation/target-override/etc/rc.local 1970-01-01 00:00:00 +0000
+++ templates.desktop/test_cases/livesession/custom-installation/target-override/etc/rc.local 2011-08-19 10:55:23 +0000
@@ -0,0 +1,20 @@
+#!/bin/sh -e
+#
+# rc.local
+#
+# This script is executed at the end of each multiuser runlevel.
+# Make sure that the script will "exit 0" on success or any other
+# value on error.
+#
+# In order to enable or disable this script just change the execution
+# bits.
+#
+# By default this script does nothing.
+
+[ -f "/test.id" ] && . /test.id
+
+TEST_CASE_URL="${TEST_TRACKER}/${TEST_DATABASE}/${TEST_UUID}"
+
+echo "/usr/local/bin/run_test.wrapper --syslog --sleep 60 $TEST_CASE_URL" > /run.cmd
+
+exit 0
=== added file 'templates.desktop/test_cases/livesession/preseed'
--- templates.desktop/test_cases/livesession/preseed 1970-01-01 00:00:00 +0000
+++ templates.desktop/test_cases/livesession/preseed 2011-08-19 10:55:23 +0000
@@ -0,0 +1,21 @@
+#
+# 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" %}
=== added file 'templates.desktop/test_cases/livesession/test'
--- templates.desktop/test_cases/livesession/test 1970-01-01 00:00:00 +0000
+++ templates.desktop/test_cases/livesession/test 2011-08-19 10:55:23 +0000
@@ -0,0 +1,37 @@
+#!/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
+
+logging.basicConfig(level=logging.DEBUG)
+
+class DefaultTest(unittest.TestCase):
+
+ def test_10ReadWrite(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)
+
+if __name__ == '__main__':
+ unittest.main()
=== modified file 'templates.desktop/test_cases/oem/config'
--- templates.desktop/test_cases/oem/config 2011-08-11 15:26:22 +0000
+++ templates.desktop/test_cases/oem/config 2011-08-19 10:55:23 +0000
@@ -20,4 +20,4 @@
#
# Test Case specific configuration file
[pxelinux]
-kernel_boot_args=oem-config/enable=true
+kernel_boot_args=oem-config/enable=true automatic-ubiquity
Follow ups