From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Liu Subject: [PATCH RFC V2 4/6] Introduce ts-ovmf-debian-install Date: Wed, 11 Dec 2013 16:11:43 +0000 Message-ID: <1386778305-29995-5-git-send-email-wei.liu2@citrix.com> References: <1386778305-29995-1-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1386778305-29995-1-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Wei Liu , ian.jackson@eu.citrix.com, ian.campbell@citrix.com List-Id: xen-devel@lists.xenproject.org This is OVMF guest test case. It resembles ts-redhat-install: 1. prepare a auto install CD 2. install OVMF guest 3. test if the guets is up The installtion CD is also bootable with seabios. Signed-off-by: Wei Liu --- ts-ovmf-debian-install | 218 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 218 insertions(+) create mode 100755 ts-ovmf-debian-install diff --git a/ts-ovmf-debian-install b/ts-ovmf-debian-install new file mode 100755 index 0000000..2e19348 --- /dev/null +++ b/ts-ovmf-debian-install @@ -0,0 +1,218 @@ +#!/usr/bin/perl -w +# This is part of "osstest", an automated testing framework for Xen. +# Copyright (C) 2009-2013 Citrix Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +use strict qw(vars); +use DBI; +use Osstest; +use Osstest::Debian; +use Osstest::TestSupport; + +tsreadconfig(); + +our $stage=0; +if (@ARGV && $ARGV[0] =~ m/^--stage(\d+)$/) { $stage=$1; shift @ARGV; } + +our ($whhost,$gn) = @ARGV; +$whhost ||= 'host'; +$gn ||= 'ovmf'; + +our $ho= selecthost($whhost); + +our $ram_mb= 768; +our $disk_mb= 10000; + +our $guesthost= "$gn.guest.osstest"; +our $gho; + +our $xl= toolstack()->{Command}; + + +sub preseed () { + + my $preseed_file = preseed_base('wheezy'); + + $preseed_file .= (< 'preserve', + Bios => 'ovmf', + PostImageHook => sub { + target_cmd_root($ho, <{Rimage} /mnt + mkdir $newiso + cp -a /mnt/. $newiso/. + umount /mnt + rm -rf $initrddir + mkdir $initrddir + cd $initrddir + gzip -d \< $newiso/install.amd/initrd.gz | cpio --extract --make-directories --no-absolute-filename + cp /root/guest-preseed preseed.cfg + cp /root/guest-authkeys authorized_keys + find . | cpio -H newc --create | gzip -9 \> $newiso/install.amd/initrd.gz + cd - + rm -rf $initrddir + cd $newiso + md5sum `find -follow -type f` \> md5sum.txt + cd - +END + target_putfilecontents_root_stash($ho, 10, grub_cfg(), + "$newiso/debian/boot/grub/grub.cfg"); + + target_putfilecontents_root_stash($ho, 10, isolinux_cfg(), + "$newiso/isolinux/isolinux.cfg"); + + target_cmd_root($ho, <{Rimage} $newiso/. +END + }); +} + +sub start () { + target_cmd_root($ho, "$xl create $gho->{CfgPath}", 100); +} + +sub rewrite_config_nocd () { + guest_editconfig($ho, $gho, sub { + if (m/^\s*disk\s*\=/ .. /\]/) { + s/\Q$gho->{Rimage}\E/$emptyiso/; + } + s/^on_reboot.*/on_reboot='restart'/; + }); +} + +if (!$stage) { + prep(); + start(); +} else { + $gho= selectguest($gn,$gho); +} +if ($stage<2) { + guest_await_reboot($ho,$gho,2000); + guest_destroy($ho,$gho); +} + +rewrite_config_nocd(); +start(); +guest_await_dhcp_tcp($gho,300); +guest_check_up($gho); -- 1.7.10.4