[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Xen-devel] [PATCH 05/10] Introduce cirros-pvgrub2-pv test
 
 
2017-03-27 19:24 keltezéssel, Stefano Stabellini írta:
 
On Mon, 27 Mar 2017, Stefano Stabellini wrote:
 
On Sat, 25 Mar 2017, Géza Gémes wrote:
 
This test verifies booting the cirros image using pvgrub2
Signed-off-by: Géza Gémes <geza.gemes@xxxxxxxxx>
 
 
Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
 
---
  tests/cirros-pvgrub2-pv | 33 +++++++++++++++++++++++++++++++++
  tests/series            |  1 +
  2 files changed, 34 insertions(+)
  create mode 100644 tests/cirros-pvgrub2-pv
diff --git a/tests/cirros-pvgrub2-pv b/tests/cirros-pvgrub2-pv
new file mode 100644
index 0000000..4994ea9
--- /dev/null
+++ b/tests/cirros-pvgrub2-pv
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+
+set -e
+
+function cirros-pvgrub2-pv-cleanup() {
+    tear_down_cirros_test $testdir
+}
+
+function cirros-pvgrub2-pv-test() {
+    download_cirros_components
+    testdir=`mktemp -d`
+    cp $CIRROS_DOWNLOADS/$CIRROS_DISK_FILE $testdir
+    # Need to install grub.cfg
+    local cirros_disk_loop=`$SUDO $BASEDIR/scripts/lopartsetup 
$testdir/$CIRROS_DISK_FILE | head -1 | cut -d ":" -f 1`
+    local cirros_disk_mntpt=`mktemp -d`
+    $SUDO mount $cirros_disk_loop $cirros_disk_mntpt
+    cirros_grub_cfg $cirros_disk_mntpt
+    $SUDO umount $cirros_disk_mntpt
+    $SUDO rmdir $cirros_disk_mntpt
+    $SUDO losetup -d $cirros_disk_loop
 
 
Actually, one more comment before I commit the series: would it be
possible to call cirros_grub_cfg from download_cirros_components as we
do for cirros_network_init?
If we did that, would the other tests that rely on the grub config file
(for example cirros-qemu-hvm) continue to work properly? I think they
must work properly, otherwise even today with the series as is, they
would fail if they get executed after cirros-pvgrub2-pv, which calls
cirros_grub_cfg.
  As each test runs in its own private testdir, they all run with their 
almost (except the static ip address) verbatim copy of vanilla cirros.
However pvgrub requires a grub2 config file, which is missing from 
cirros, having only a menu.lst.
Modifying the downloaded image to have a grub.cfg by default has no 
effect on the majority of the tests, with the exception of the pygrub 
test, which cannot interpret the grub.cfg needed by pvgrub. Because of 
this incompatibility I've chosen to add grub.cfg only in the case of the 
pvgrub test, which needs it and run the other tests with a cirros image 
as close to the original as possible.
+    cat >$testdir/cirros-pvgrub2-pv.cfg <<EOF
+name = "raisin-test"
+memory = 128
+vcpus = 2
+kernel = "$PVGRUB"
+disk = [ '${testdir}/${CIRROS_DISK_FILE},raw,xvda,rw' ]
+extra = "$CIRROS_GRUB_CFG"
+vif = [ 'bridge=xenbr1' ]
+EOF
+
+    $SUDO xl create $testdir/cirros-pvgrub2-pv.cfg
+    check_guest_alive
+}
diff --git a/tests/series b/tests/series
index 372fafb..1fec245 100644
--- a/tests/series
+++ b/tests/series
@@ -3,3 +3,4 @@ busybox-hvm
  busybox-hvm-migrate
  cirros-separate-kernel-pv
  cirros-pygrub-pv
+cirros-pvgrub2-pv
--
2.7.4
 
 
 
Cheers,
Geza
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
 
 
    
     |