Skip to contentSkip to conversation

pygrub fix + cirros tests

PATCH In review Géza Gémes 2 participants 23 messages Mar 25, 2017 – Mar 27, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover pygrub fix + cirros tests

First patch moves python2.7/site-packages/* to python2.7/dist-packages/ at debian package build, this fixes pygrub imports.

Cirros tests are also introduced by this series of patches. Changes since the previous patchsets:
- Downloaded cirros components are kept in a separate folder
- Each test sets up its own images, keeping the downloaded
parts intact
- qemu-img and pvgrub detection moved to common-functions

Géza Gémes (10):
Fix installation of python libs
Introduce cirros tests
Introduce cirros-separate-kernel-pv test
Introduce cirros-pygrub-pv test
Introduce cirros-pvgrub2-pv test
Introduce cirros-qemu-hvm test
Introduce cirros-minios-stubdom-hvm test
Introduce cirros-qemu-pvhvm test
Introduce cirros-minios-stubdom-pvhvm test
Enable cirros tests in the default config

 defconfig                          |   2 +-
 lib/common-functions.sh            |  33 +++++++++++
 lib/common-tests.sh                | 109 +++++++++++++++++++++++++++++++++++++
 scripts/mkdeb                      |   4 ++
 tests-configs/config-cirros_x86_32 |  13 +++++
 tests-configs/config-cirros_x86_64 |  13 +++++
 tests/cirros-minios-stubdom-hvm    |  27 +++++++++
 tests/cirros-minios-stubdom-pvhvm  |  28 ++++++++++
 tests/cirros-pvgrub2-pv            |  33 +++++++++++
 tests/cirros-pygrub-pv             |  25 +++++++++
 tests/cirros-qemu-hvm              |  26 +++++++++
 tests/cirros-qemu-pvhvm            |  27 +++++++++
 tests/cirros-separate-kernel-pv    |  28 ++++++++++
 tests/series                       |   7 +++
 14 files changed, 374 insertions(+), 1 deletion(-)
 create mode 100644 tests-configs/config-cirros_x86_32
 create mode 100644 tests-configs/config-cirros_x86_64
 create mode 100644 tests/cirros-minios-stubdom-hvm
 create mode 100644 tests/cirros-minios-stubdom-pvhvm
 create mode 100644 tests/cirros-pvgrub2-pv
 create mode 100644 tests/cirros-pygrub-pv
 create mode 100644 tests/cirros-qemu-hvm
 create mode 100644 tests/cirros-qemu-pvhvm
 create mode 100644 tests/cirros-separate-kernel-pv
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw

PATCH 1/10 Fix installation of python libs

Change deb package build in order to move content of the site-packages folder to dist-packages in this way having the libs inluded in the default PYTHONPATH

---
 scripts/mkdeb | 4 ++++
 1 file changed, 4 insertions(+)
scripts/mkdeb +4 -0
index 3796300..d7ddace 100755
@@ -46,6 +46,10 @@ then
     rm -rf deb/usr/lib64
 fi
 
+# Make sure that python libs will be in the path
+mkdir -p deb/usr/lib/python2.7/dist-packages
+mv deb/usr/lib/python2.7/site-packages/* deb/usr/lib/python2.7/dist-packages
+
 # Fill in the debian boilerplate
 mkdir -p deb/DEBIAN
 cat >deb/DEBIAN/control <<EOF
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#3 lore raw

PATCH 2/10 Introduce cirros tests

In reply to Géza Gémes

Add support for using cirros images in raisin tests

---
 lib/common-functions.sh            |  33 +++++++++++
 lib/common-tests.sh                | 109 +++++++++++++++++++++++++++++++++++++
 tests-configs/config-cirros_x86_32 |  13 +++++
 tests-configs/config-cirros_x86_64 |  13 +++++
 4 files changed, 168 insertions(+)
 create mode 100644 tests-configs/config-cirros_x86_32
 create mode 100644 tests-configs/config-cirros_x86_64
lib/common-functions.sh +33 -0
index d4476f3..efc92ff 100644
@@ -439,3 +439,36 @@ function uninstall_package() {
         error_echo "Don't know how to uninstall packages on $DISTRO"
     fi
 }
+
+function get-qemu-img() {
+    set +e
+    QEMU_IMG=`which qemu-img`
+    set -e
+    if [[ -z "$QEMU_IMG" ]]
+    then
+        QEMU_IMG="/usr/lib/xen/bin/qemu-img"
+    fi
+    if [[ -x $QEMU_IMG ]]
+    then
+        export QEMU_IMG
+    else
+        error_echo "No working qemu-img found! Some tests may fail!"
+    fi
+}
+
+function get-pvgrub() {
+    local arch=$1
+    set +e
+    PVGRUB=`which grub-${arch}-xen`
+    set -e
+    if [[ -z "$PVGRUB" ]]
+    then
+        PVGRUB="/usr/lib/xen/boot/grub-${arch}-xen"
+    fi
+    if [[ -f $PVGRUB ]]
+    then
+        export PVGRUB
+    else
+        error_echo "No working pvgrub found! Some tests may fail!"
+    fi
+}
lib/common-tests.sh +109 -0

112 lines not on this page · raw message

tests-configs/config-cirros_x86_32 new file +13 -0
new file mode 100644
index 0000000..628e568
@@ -0,0 +1,13 @@
+CIRROS_ARCH=i386
+CIRROS_BASE_URL="https://download.cirros-cloud.net/"
+CIRROS_VERSION="0.3.5"
+CIRROS_DOWNLOADS=$BASEDIR/downloads
+CIRROS_KERNEL_FILE=cirros-$CIRROS_VERSION-$CIRROS_ARCH-kernel
+CIRROS_INITRD_FILE=cirros-$CIRROS_VERSION-$CIRROS_ARCH-initramfs
+CIRROS_ROOTFS_FILE=cirros-$CIRROS_VERSION-$CIRROS_ARCH-rootfs.img
+CIRROS_DISK_FILE=cirros-$CIRROS_VERSION-$CIRROS_ARCH-disk.img
+CIRROS_KERNEL_URL=$CIRROS_BASE_URL/$CIRROS_VERSION/$CIRROS_KERNEL_FILE
+CIRROS_INITRD_URL=$CIRROS_BASE_URL/$CIRROS_VERSION/$CIRROS_INITRD_FILE
+CIRROS_ROOTFS_URL=$CIRROS_BASE_URL/$CIRROS_VERSION/$CIRROS_ROOTFS_FILE.gz
+CIRROS_DISK_URL=$CIRROS_BASE_URL/$CIRROS_VERSION/$CIRROS_DISK_FILE
+CIRROS_GRUB_CFG="(xen/xvda,msdos1)/boot/grub/grub.cfg"
tests-configs/config-cirros_x86_64 new file +13 -0
new file mode 100644
index 0000000..7b78316
@@ -0,0 +1,13 @@
+CIRROS_ARCH=x86_64
+CIRROS_BASE_URL="https://download.cirros-cloud.net/"
+CIRROS_VERSION="0.3.5"
+CIRROS_DOWNLOADS=$BASEDIR/downloads
+CIRROS_KERNEL_FILE=cirros-$CIRROS_VERSION-$CIRROS_ARCH-kernel
+CIRROS_INITRD_FILE=cirros-$CIRROS_VERSION-$CIRROS_ARCH-initramfs
+CIRROS_ROOTFS_FILE=cirros-$CIRROS_VERSION-$CIRROS_ARCH-rootfs.img
+CIRROS_DISK_FILE=cirros-$CIRROS_VERSION-$CIRROS_ARCH-disk.img
+CIRROS_KERNEL_URL=$CIRROS_BASE_URL/$CIRROS_VERSION/$CIRROS_KERNEL_FILE
+CIRROS_INITRD_URL=$CIRROS_BASE_URL/$CIRROS_VERSION/$CIRROS_INITRD_FILE
+CIRROS_ROOTFS_URL=$CIRROS_BASE_URL/$CIRROS_VERSION/$CIRROS_ROOTFS_FILE.gz
+CIRROS_DISK_URL=$CIRROS_BASE_URL/$CIRROS_VERSION/$CIRROS_DISK_FILE
+CIRROS_GRUB_CFG="(xen/xvda,msdos1)/boot/grub/grub.cfg"
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#5 lore raw

PATCH 3/10 Introduce cirros-separate-kernel-pv test

In reply to Géza Gémes

This test is the cirros equivalent of the busybox-pv test

---
 tests/cirros-separate-kernel-pv | 28 ++++++++++++++++++++++++++++
 tests/series                    |  1 +
 2 files changed, 29 insertions(+)
 create mode 100644 tests/cirros-separate-kernel-pv
tests/cirros-separate-kernel-pv new file +28 -0
new file mode 100644
index 0000000..fab5856
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+set -e
+
+function cirros-separate-kernel-pv-cleanup() {
+    tear_down_cirros_test $testdir
+}
+
+function cirros-separate-kernel-pv-test() {
+    download_cirros_components
+    testdir=`mktemp -d`
+    cp $CIRROS_DOWNLOADS/$CIRROS_KERNEL_FILE $testdir
+    cp $CIRROS_DOWNLOADS/$CIRROS_INITRD_FILE $testdir
+    cp $CIRROS_DOWNLOADS/$CIRROS_ROOTFS_FILE $testdir
+    cat >$testdir/cirros-separate-kernel-pv.cfg <<EOF
+name = "raisin-test"
+memory = 128
+vcpus = 2
+kernel = "$testdir/$CIRROS_KERNEL_FILE"
+ramdisk = "$testdir/$CIRROS_INITRD_FILE"
+disk = [ '$testdir/$CIRROS_ROOTFS_FILE,raw,xvda,rw' ]
+extra = "root=/dev/xvda"
+vif = [ 'bridge=xenbr1' ]
+EOF
+
+    $SUDO xl create $testdir/cirros-separate-kernel-pv.cfg
+    check_guest_alive
+}
tests/series +1 -0
index a2f4b34..38ee35a 100644
@@ -1,3 +1,4 @@
 busybox-pv
 busybox-hvm
 busybox-hvm-migrate
+cirros-separate-kernel-pv
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#7 lore raw

PATCH 4/10 Introduce cirros-pygrub-pv test

In reply to Géza Gémes

This test verifies booting the cirros image using pygrub

---
 tests/cirros-pygrub-pv | 25 +++++++++++++++++++++++++
 tests/series           |  1 +
 2 files changed, 26 insertions(+)
 create mode 100644 tests/cirros-pygrub-pv
tests/cirros-pygrub-pv new file +25 -0
new file mode 100644
index 0000000..37e288c
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+set -e
+
+function cirros-pygrub-pv-cleanup() {
+    tear_down_cirros_test $testdir
+}
+
+function cirros-pygrub-pv-test() {
+    download_cirros_components
+    testdir=`mktemp -d`
+    cp $CIRROS_DOWNLOADS/$CIRROS_DISK_FILE $testdir
+    cat >$testdir/cirros-pygrub-pv.cfg <<EOF
+name = "raisin-test"
+memory = 128
+vcpus = 2
+bootloader = "pygrub"
+disk = [ '$testdir/$CIRROS_DISK_FILE,raw,xvda,rw' ]
+extra = "root=/dev/xvda1"
+vif = [ 'bridge=xenbr1' ]
+EOF
+
+    $SUDO xl create $testdir/cirros-pygrub-pv.cfg
+    check_guest_alive
+}
tests/series +1 -0
index 38ee35a..372fafb 100644
@@ -2,3 +2,4 @@ busybox-pv
 busybox-hvm
 busybox-hvm-migrate
 cirros-separate-kernel-pv
+cirros-pygrub-pv
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#9 lore raw

PATCH 5/10 Introduce cirros-pvgrub2-pv test

In reply to Géza Gémes

This test verifies booting the cirros image using pvgrub2

---
 tests/cirros-pvgrub2-pv | 33 +++++++++++++++++++++++++++++++++
 tests/series            |  1 +
 2 files changed, 34 insertions(+)
 create mode 100644 tests/cirros-pvgrub2-pv
tests/cirros-pvgrub2-pv new file +33 -0
new file mode 100644
index 0000000..4994ea9
@@ -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
+    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
+}
tests/series +1 -0
index 372fafb..1fec245 100644
@@ -3,3 +3,4 @@ busybox-hvm
 busybox-hvm-migrate
 cirros-separate-kernel-pv
 cirros-pygrub-pv
+cirros-pvgrub2-pv
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#14 lore raw

PATCH 6/10 Introduce cirros-qemu-hvm test

In reply to Géza Gémes

This test is the cirros equivalent of the busybox-hvm test

---
 tests/cirros-qemu-hvm | 26 ++++++++++++++++++++++++++
 tests/series          |  1 +
 2 files changed, 27 insertions(+)
 create mode 100644 tests/cirros-qemu-hvm
tests/cirros-qemu-hvm new file +26 -0
new file mode 100644
index 0000000..2e4ec2a
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+set -e
+
+function cirros-qemu-hvm-cleanup() {
+    tear_down_cirros_test $testdir
+}
+
+function cirros-qemu-hvm-test() {
+    download_cirros_components
+    testdir=`mktemp -d`
+    cp $CIRROS_DOWNLOADS/$CIRROS_DISK_FILE $testdir
+    cat >$testdir/cirros-qemu-hvm.cfg <<EOF
+name = "raisin-test"
+builder = "hvm"
+memory = 128
+vcpus = 2
+disk = [ '$testdir/$CIRROS_DISK_FILE,raw,hda,rw' ]
+vif = [ 'bridge=xenbr1' ]
+serial="pty"
+boot="c"
+EOF
+
+    $SUDO xl create $testdir/cirros-qemu-hvm.cfg
+    check_guest_alive
+}
tests/series +1 -0
index 1fec245..49a9257 100644
@@ -4,3 +4,4 @@ busybox-hvm-migrate
 cirros-separate-kernel-pv
 cirros-pygrub-pv
 cirros-pvgrub2-pv
+cirros-qemu-hvm
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#16 lore raw

PATCH 7/10 Introduce cirros-minios-stubdom-hvm test

In reply to Géza Gémes

This test verifies a cirros based hvm domain using a minios based stubdom as its device model

---
 tests/cirros-minios-stubdom-hvm | 27 +++++++++++++++++++++++++++
 tests/series                    |  1 +
 2 files changed, 28 insertions(+)
 create mode 100644 tests/cirros-minios-stubdom-hvm
tests/cirros-minios-stubdom-hvm new file +27 -0
new file mode 100644
index 0000000..43dc568
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+
+set -e
+
+function cirros-minios-stubdom-hvm-cleanup() {
+    tear_down_cirros_test $testdir
+}
+
+function cirros-minios-stubdom-hvm-test() {
+    download_cirros_components
+    testdir=`mktemp -d`
+    cp $CIRROS_DOWNLOADS/$CIRROS_DISK_FILE $testdir
+    cat >$testdir/cirros-minios-stubdom-hvm.cfg <<EOF
+name = "raisin-test"
+builder = "hvm"
+device_model_stubdomain_override = 1
+memory = 128
+vcpus = 2
+disk = [ '$testdir/$CIRROS_DISK_FILE,raw,hda,rw' ]
+vif = [ 'bridge=xenbr1' ]
+serial="pty"
+boot="c"
+EOF
+
+    $SUDO xl create $testdir/cirros-minios-stubdom-hvm.cfg
+    check_guest_alive
+}
tests/series +1 -0
index 49a9257..7b1ad8e 100644
@@ -5,3 +5,4 @@ cirros-separate-kernel-pv
 cirros-pygrub-pv
 cirros-pvgrub2-pv
 cirros-qemu-hvm
+cirros-minios-stubdom-hvm
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#18 lore raw

PATCH 8/10 Introduce cirros-qemu-pvhvm test

In reply to Géza Gémes

This test is similar to cirros-qemu-hvm test, differing by explicitly exposing the xen netfront and blockfront drivers

---
 tests/cirros-qemu-pvhvm | 27 +++++++++++++++++++++++++++
 tests/series            |  1 +
 2 files changed, 28 insertions(+)
 create mode 100644 tests/cirros-qemu-pvhvm
tests/cirros-qemu-pvhvm new file +27 -0
new file mode 100644
index 0000000..6cf33e0
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+
+set -e
+
+function cirros-qemu-pvhvm-cleanup() {
+    tear_down_cirros_test $testdir
+}
+
+function cirros-qemu-pvhvm-test() {
+    download_cirros_components
+    testdir=`mktemp -d`
+    cp $CIRROS_DOWNLOADS/$CIRROS_DISK_FILE $testdir
+    cat >$testdir/cirros-qemu-pvhvm.cfg <<EOF
+name = "raisin-test"
+builder = "hvm"
+xen_platform_pci = 1
+memory = 128
+vcpus = 2
+disk = [ '$testdir/$CIRROS_DISK_FILE,raw,xvda,rw' ]
+vif = [ 'bridge=xenbr1' ]
+serial="pty"
+boot="c"
+EOF
+
+    $SUDO xl create $testdir/cirros-qemu-pvhvm.cfg
+    check_guest_alive
+}
tests/series +1 -0
index 7b1ad8e..51dbe17 100644
@@ -6,3 +6,4 @@ cirros-pygrub-pv
 cirros-pvgrub2-pv
 cirros-qemu-hvm
 cirros-minios-stubdom-hvm
+cirros-qemu-pvhvm
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#20 lore raw

PATCH 9/10 Introduce cirros-minios-stubdom-pvhvm test

In reply to Géza Gémes

This test is similar to cirros-minios-stubdom-hvm test, differing by explicitly exposing the xen netfront and blockfront drivers

---
 tests/cirros-minios-stubdom-pvhvm | 28 ++++++++++++++++++++++++++++
 tests/series                      |  1 +
 2 files changed, 29 insertions(+)
 create mode 100644 tests/cirros-minios-stubdom-pvhvm
tests/cirros-minios-stubdom-pvhvm new file +28 -0
new file mode 100644
index 0000000..719b78d
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+set -e
+
+function cirros-minios-stubdom-pvhvm-cleanup() {
+    tear_down_cirros_test $testdir
+}
+
+function cirros-minios-stubdom-pvhvm-test() {
+    download_cirros_components
+    testdir=`mktemp -d`
+    cp $CIRROS_DOWNLOADS/$CIRROS_DISK_FILE $testdir
+    cat >$testdir/cirros-minios-stubdom-pvhvm.cfg <<EOF
+name = "raisin-test"
+builder = "hvm"
+device_model_stubdomain_override = 1
+xen_platform_pci = 1
+memory = 128
+vcpus = 2
+disk = [ '$testdir/$CIRROS_DISK_FILE,raw,xvda,rw' ]
+vif = [ 'bridge=xenbr1' ]
+serial="pty"
+boot="c"
+EOF
+
+    $SUDO xl create $testdir/cirros-minios-stubdom-pvhvm.cfg
+    check_guest_alive
+}
tests/series +1 -0
index 51dbe17..ffa8e69 100644
@@ -7,3 +7,4 @@ cirros-pvgrub2-pv
 cirros-qemu-hvm
 cirros-minios-stubdom-hvm
 cirros-qemu-pvhvm
+cirros-minios-stubdom-pvhvm
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#22 lore raw

PATCH 10/10 Enable cirros tests in the default config

In reply to Géza Gémes

The existing cirros tests are enabled, with the following exceptions:
cirros-minios-stubdom-hvm and cirros-minios-stubdom-pvhvm are skipped as raisin does not install the stubdom

---
 defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
defconfig +1 -1
index f8ef398..bdacc7e 100644
@@ -31,4 +31,4 @@ GIT_TRANSPORT="git"
 # Tests
 ## All tests: busybox-pv busybox-hvm
 ## ENABLED_TESTS is the list of test run by raise test
-ENABLED_TESTS="busybox-pv busybox-hvm"
+ENABLED_TESTS="busybox-pv busybox-hvm cirros-separate-kernel-pv cirros-pygrub-pv cirros-pvgrub2-pv cirros-qemu-hvm cirros-qemu-pvhvm"
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 1/10
#2 lore raw

Re: [PATCH 01/10] Fix installation of python libs

In reply to Géza Gémes
Quoted 5 lines · Géza Gémes

Change deb package build in order to move content of the site-packages folder to dist-packages in this way having the libs inluded in the default PYTHONPATH

Quoted 22 lines
---
 scripts/mkdeb | 4 ++++
 1 file changed, 4 insertions(+)
scripts/mkdeb +4 -0
index 3796300..d7ddace 100755
@@ -46,6 +46,10 @@ then
     rm -rf deb/usr/lib64
 fi
 
+# Make sure that python libs will be in the path
+mkdir -p deb/usr/lib/python2.7/dist-packages
+mv deb/usr/lib/python2.7/site-packages/* deb/usr/lib/python2.7/dist-packages
+
 # Fill in the debian boilerplate
 mkdir -p deb/DEBIAN
 cat >deb/DEBIAN/control <<EOF
Signature · 1 line
2.7.4

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by on v1 2/10
#4 lore raw

Re: [PATCH 02/10] Introduce cirros tests

In reply to Géza Gémes
Quoted 3 lines · Géza Gémes

Add support for using cirros images in raisin tests

It looks good to me, thanks!

Quoted 208 lines
---
 lib/common-functions.sh            |  33 +++++++++++
 lib/common-tests.sh                | 109 +++++++++++++++++++++++++++++++++++++
 tests-configs/config-cirros_x86_32 |  13 +++++
 tests-configs/config-cirros_x86_64 |  13 +++++
 4 files changed, 168 insertions(+)
 create mode 100644 tests-configs/config-cirros_x86_32
 create mode 100644 tests-configs/config-cirros_x86_64
lib/common-functions.sh +33 -0
index d4476f3..efc92ff 100644
@@ -439,3 +439,36 @@ function uninstall_package() {
         error_echo "Don't know how to uninstall packages on $DISTRO"
     fi
 }
+
+function get-qemu-img() {
+    set +e
+    QEMU_IMG=`which qemu-img`
+    set -e
+    if [[ -z "$QEMU_IMG" ]]
+    then
+        QEMU_IMG="/usr/lib/xen/bin/qemu-img"
+    fi
+    if [[ -x $QEMU_IMG ]]
+    then
+        export QEMU_IMG
+    else
+        error_echo "No working qemu-img found! Some tests may fail!"
+    fi
+}
+
+function get-pvgrub() {
+    local arch=$1
+    set +e
+    PVGRUB=`which grub-${arch}-xen`
+    set -e
+    if [[ -z "$PVGRUB" ]]
+    then
+        PVGRUB="/usr/lib/xen/boot/grub-${arch}-xen"
+    fi
+    if [[ -f $PVGRUB ]]
+    then
+        export PVGRUB
+    else
+        error_echo "No working pvgrub found! Some tests may fail!"
+    fi
+}
lib/common-tests.sh +109 -0
index d346af4..c07bb18 100644
@@ -178,3 +178,112 @@ function get_host_initrd() {
         exit 1
     fi
 }
+
+function cirros_network_init() {
+    rootdir=$1
+    ifile=`mktemp`
+    # Create static network config
+    cat >$ifile <<EOF
+auto lo
+iface lo inet loopback
+
+auto eth0
+iface eth0 inet static
+    address 169.254.0.2
+    network 169.254.0.0
+    broadcast 169.254.0.255
+    netmask 255.255.255.0
+EOF
+    $SUDO mv -f $ifile $rootdir/etc/network/interfaces
+    # Disable cloud-init
+    $SUDO rm -f ${rootdir}/etc/rc3.d/S*cirros*ds*
+    $SUDO rm -f ${rootdir}/etc/rc3.d/S*-cirros-userdata
+}
+
+function get_cirros_kernel() {
+    bootdir=$1
+    basename `find $bootdir -name vmlinuz* 2>/dev/null | head -1`
+}
+
+function get_cirros_initrd() {
+    bootdir=$1
+    basename `find $bootdir -name initrd* 2>/dev/null | head -1`
+}
+
+function cirros_grub_cfg() {
+    rootdir=$1
+    get-pvgrub $CIRROS_ARCH
+    grubroot="`echo $CIRROS_GRUB_CFG | cut -d ')' -f 1`)"
+    grubcfg="`echo $CIRROS_GRUB_CFG | cut -d ')' -f 2`"
+    grubdir=`dirname $grubcfg`
+    bootdir=`dirname $grubdir`
+    tmpgrubcfg=`mktemp`
+    cat > $tmpgrubcfg <<EOF
+root="$grubroot"
+insmod xzio
+insmod gzio
+insmod btrfs
+insmod ext2
+set timeout=1
+set default=0
+menuentry Cirros {
+    linux `echo $bootdir`/`get_cirros_kernel ${rootdir}/${bootdir}` root=/dev/xvda1 ro
+    initrd `echo $bootdir`/`get_cirros_initrd ${rootdir}/${bootdir}`
+}
+EOF
+    $SUDO mv -f $tmpgrubcfg ${rootdir}/${grubcfg}
+}
+
+function download_cirros_components() {
+    . tests-configs/config-cirros_$RAISIN_ARCH
+    mkdir -p $CIRROS_DOWNLOADS
+    if [[ ! -f $CIRROS_DOWNLOADS/$CIRROS_KERNEL_FILE ]]
+    then
+        verbose_echo "Downloading cirros kernel"
+        wget -q $CIRROS_KERNEL_URL -P $CIRROS_DOWNLOADS
+    fi
+    if [[ ! -f $CIRROS_DOWNLOADS/$CIRROS_INITRD_FILE ]]
+    then
+        verbose_echo "Downloading cirros initrd"
+        wget -q $CIRROS_INITRD_URL -P $CIRROS_DOWNLOADS
+    fi
+    if [[ ! -f $CIRROS_DOWNLOADS/$CIRROS_ROOTFS_FILE ]]
+    then
+        verbose_echo "Downloading cirros rootfs"
+        wget -q $CIRROS_ROOTFS_URL -P $CIRROS_DOWNLOADS
+        gunzip $CIRROS_DOWNLOADS/$CIRROS_ROOTFS_FILE.gz
+        local cirros_rootfs_loop=`create_loop $CIRROS_DOWNLOADS/$CIRROS_ROOTFS_FILE`
+        local cirros_rootfs_mntpt=`mktemp -d`
+        $SUDO mount $cirros_rootfs_loop $cirros_rootfs_mntpt
+        cirros_network_init $cirros_rootfs_mntpt
+        $SUDO umount $cirros_rootfs_mntpt
+        $SUDO rmdir $cirros_rootfs_mntpt
+        $SUDO losetup -d $cirros_rootfs_loop
+    fi
+    if [[ ! -f $CIRROS_DOWNLOADS/$CIRROS_DISK_FILE ]]
+    then
+        verbose_echo "Downloading cirros disk"
+        wget -q $CIRROS_DISK_URL -P $CIRROS_DOWNLOADS
+        mv $CIRROS_DOWNLOADS/$CIRROS_DISK_FILE $CIRROS_DOWNLOADS/$CIRROS_DISK_FILE.qcow2
+        get-qemu-img
+        $QEMU_IMG convert -f qcow2 -O raw $CIRROS_DOWNLOADS/$CIRROS_DISK_FILE.qcow2 $CIRROS_DOWNLOADS/$CIRROS_DISK_FILE
+        local cirros_disk_loop=`$SUDO $BASEDIR/scripts/lopartsetup $CIRROS_DOWNLOADS/$CIRROS_DISK_FILE | head -1 |
+                                cut -d ":" -f 1`
+        local cirros_disk_mntpt=`mktemp -d`
+        $SUDO mount $cirros_disk_loop $cirros_disk_mntpt
+        cirros_network_init $cirros_disk_mntpt
+        $SUDO umount $cirros_disk_mntpt
+        $SUDO rmdir $cirros_disk_mntpt
+        $SUDO losetup -d $cirros_disk_loop
+    fi
+}
+
+function tear_down_cirros_test() {
+    testdir=$1
+    if [[ `$SUDO xl vm-list | grep "raisin-test" | wc -l` -gt 0 ]]
+    then
+        $SUDO xl destroy "raisin-test"
+    fi
+    verbose_echo "$PREPEND deleting environment of cirros test"
+    $SUDO rm -rf $testdir
+}
tests-configs/config-cirros_x86_32 new file +13 -0
new file mode 100644
index 0000000..628e568
@@ -0,0 +1,13 @@
+CIRROS_ARCH=i386
+CIRROS_BASE_URL="https://download.cirros-cloud.net/"
+CIRROS_VERSION="0.3.5"
+CIRROS_DOWNLOADS=$BASEDIR/downloads
+CIRROS_KERNEL_FILE=cirros-$CIRROS_VERSION-$CIRROS_ARCH-kernel
+CIRROS_INITRD_FILE=cirros-$CIRROS_VERSION-$CIRROS_ARCH-initramfs
+CIRROS_ROOTFS_FILE=cirros-$CIRROS_VERSION-$CIRROS_ARCH-rootfs.img
+CIRROS_DISK_FILE=cirros-$CIRROS_VERSION-$CIRROS_ARCH-disk.img
+CIRROS_KERNEL_URL=$CIRROS_BASE_URL/$CIRROS_VERSION/$CIRROS_KERNEL_FILE
+CIRROS_INITRD_URL=$CIRROS_BASE_URL/$CIRROS_VERSION/$CIRROS_INITRD_FILE
+CIRROS_ROOTFS_URL=$CIRROS_BASE_URL/$CIRROS_VERSION/$CIRROS_ROOTFS_FILE.gz
+CIRROS_DISK_URL=$CIRROS_BASE_URL/$CIRROS_VERSION/$CIRROS_DISK_FILE
+CIRROS_GRUB_CFG="(xen/xvda,msdos1)/boot/grub/grub.cfg"
tests-configs/config-cirros_x86_64 new file +13 -0
new file mode 100644
index 0000000..7b78316
@@ -0,0 +1,13 @@
+CIRROS_ARCH=x86_64
+CIRROS_BASE_URL="https://download.cirros-cloud.net/"
+CIRROS_VERSION="0.3.5"
+CIRROS_DOWNLOADS=$BASEDIR/downloads
+CIRROS_KERNEL_FILE=cirros-$CIRROS_VERSION-$CIRROS_ARCH-kernel
+CIRROS_INITRD_FILE=cirros-$CIRROS_VERSION-$CIRROS_ARCH-initramfs
+CIRROS_ROOTFS_FILE=cirros-$CIRROS_VERSION-$CIRROS_ARCH-rootfs.img
+CIRROS_DISK_FILE=cirros-$CIRROS_VERSION-$CIRROS_ARCH-disk.img
+CIRROS_KERNEL_URL=$CIRROS_BASE_URL/$CIRROS_VERSION/$CIRROS_KERNEL_FILE
+CIRROS_INITRD_URL=$CIRROS_BASE_URL/$CIRROS_VERSION/$CIRROS_INITRD_FILE
+CIRROS_ROOTFS_URL=$CIRROS_BASE_URL/$CIRROS_VERSION/$CIRROS_ROOTFS_FILE.gz
+CIRROS_DISK_URL=$CIRROS_BASE_URL/$CIRROS_VERSION/$CIRROS_DISK_FILE
+CIRROS_GRUB_CFG="(xen/xvda,msdos1)/boot/grub/grub.cfg"
Signature · 1 line
2.7.4

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by on v1 3/10
#6 lore raw

Re: [PATCH 03/10] Introduce cirros-separate-kernel-pv test

In reply to Géza Gémes
Quoted 3 lines · Géza Gémes

This test is the cirros equivalent of the busybox-pv test

Quoted 52 lines
---
 tests/cirros-separate-kernel-pv | 28 ++++++++++++++++++++++++++++
 tests/series                    |  1 +
 2 files changed, 29 insertions(+)
 create mode 100644 tests/cirros-separate-kernel-pv
tests/cirros-separate-kernel-pv new file +28 -0
new file mode 100644
index 0000000..fab5856
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+set -e
+
+function cirros-separate-kernel-pv-cleanup() {
+    tear_down_cirros_test $testdir
+}
+
+function cirros-separate-kernel-pv-test() {
+    download_cirros_components
+    testdir=`mktemp -d`
+    cp $CIRROS_DOWNLOADS/$CIRROS_KERNEL_FILE $testdir
+    cp $CIRROS_DOWNLOADS/$CIRROS_INITRD_FILE $testdir
+    cp $CIRROS_DOWNLOADS/$CIRROS_ROOTFS_FILE $testdir
+    cat >$testdir/cirros-separate-kernel-pv.cfg <<EOF
+name = "raisin-test"
+memory = 128
+vcpus = 2
+kernel = "$testdir/$CIRROS_KERNEL_FILE"
+ramdisk = "$testdir/$CIRROS_INITRD_FILE"
+disk = [ '$testdir/$CIRROS_ROOTFS_FILE,raw,xvda,rw' ]
+extra = "root=/dev/xvda"
+vif = [ 'bridge=xenbr1' ]
+EOF
+
+    $SUDO xl create $testdir/cirros-separate-kernel-pv.cfg
+    check_guest_alive
+}
tests/series +1 -0
index a2f4b34..38ee35a 100644
@@ -1,3 +1,4 @@
 busybox-pv
 busybox-hvm
 busybox-hvm-migrate
+cirros-separate-kernel-pv
Signature · 1 line
2.7.4

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by on v1 4/10
#8 lore raw

Re: [PATCH 04/10] Introduce cirros-pygrub-pv test

In reply to Géza Gémes
Quoted 3 lines · Géza Gémes

This test verifies booting the cirros image using pygrub

Quoted 49 lines
---
 tests/cirros-pygrub-pv | 25 +++++++++++++++++++++++++
 tests/series           |  1 +
 2 files changed, 26 insertions(+)
 create mode 100644 tests/cirros-pygrub-pv
tests/cirros-pygrub-pv new file +25 -0
new file mode 100644
index 0000000..37e288c
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+set -e
+
+function cirros-pygrub-pv-cleanup() {
+    tear_down_cirros_test $testdir
+}
+
+function cirros-pygrub-pv-test() {
+    download_cirros_components
+    testdir=`mktemp -d`
+    cp $CIRROS_DOWNLOADS/$CIRROS_DISK_FILE $testdir
+    cat >$testdir/cirros-pygrub-pv.cfg <<EOF
+name = "raisin-test"
+memory = 128
+vcpus = 2
+bootloader = "pygrub"
+disk = [ '$testdir/$CIRROS_DISK_FILE,raw,xvda,rw' ]
+extra = "root=/dev/xvda1"
+vif = [ 'bridge=xenbr1' ]
+EOF
+
+    $SUDO xl create $testdir/cirros-pygrub-pv.cfg
+    check_guest_alive
+}
tests/series +1 -0
index 38ee35a..372fafb 100644
@@ -2,3 +2,4 @@ busybox-pv
 busybox-hvm
 busybox-hvm-migrate
 cirros-separate-kernel-pv
+cirros-pygrub-pv
Signature · 1 line
2.7.4

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by on v1 5/10
#10 lore raw

Re: [PATCH 05/10] Introduce cirros-pvgrub2-pv test

In reply to Géza Gémes
Quoted 3 lines · Géza Gémes

This test verifies booting the cirros image using pvgrub2

Quoted 57 lines
---
 tests/cirros-pvgrub2-pv | 33 +++++++++++++++++++++++++++++++++
 tests/series            |  1 +
 2 files changed, 34 insertions(+)
 create mode 100644 tests/cirros-pvgrub2-pv
tests/cirros-pvgrub2-pv new file +33 -0
new file mode 100644
index 0000000..4994ea9
@@ -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
+    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
+}
tests/series +1 -0
index 372fafb..1fec245 100644
@@ -3,3 +3,4 @@ busybox-hvm
 busybox-hvm-migrate
 cirros-separate-kernel-pv
 cirros-pygrub-pv
+cirros-pvgrub2-pv
Signature · 1 line
2.7.4

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by on v1 6/10
#15 lore raw

Re: [PATCH 06/10] Introduce cirros-qemu-hvm test

In reply to Géza Gémes
Quoted 3 lines · Géza Gémes

This test is the cirros equivalent of the busybox-hvm test

Quoted 50 lines
---
 tests/cirros-qemu-hvm | 26 ++++++++++++++++++++++++++
 tests/series          |  1 +
 2 files changed, 27 insertions(+)
 create mode 100644 tests/cirros-qemu-hvm
tests/cirros-qemu-hvm new file +26 -0
new file mode 100644
index 0000000..2e4ec2a
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+set -e
+
+function cirros-qemu-hvm-cleanup() {
+    tear_down_cirros_test $testdir
+}
+
+function cirros-qemu-hvm-test() {
+    download_cirros_components
+    testdir=`mktemp -d`
+    cp $CIRROS_DOWNLOADS/$CIRROS_DISK_FILE $testdir
+    cat >$testdir/cirros-qemu-hvm.cfg <<EOF
+name = "raisin-test"
+builder = "hvm"
+memory = 128
+vcpus = 2
+disk = [ '$testdir/$CIRROS_DISK_FILE,raw,hda,rw' ]
+vif = [ 'bridge=xenbr1' ]
+serial="pty"
+boot="c"
+EOF
+
+    $SUDO xl create $testdir/cirros-qemu-hvm.cfg
+    check_guest_alive
+}
tests/series +1 -0
index 1fec245..49a9257 100644
@@ -4,3 +4,4 @@ busybox-hvm-migrate
 cirros-separate-kernel-pv
 cirros-pygrub-pv
 cirros-pvgrub2-pv
+cirros-qemu-hvm
Signature · 1 line
2.7.4

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by on v1 7/10
#17 lore raw

Re: [PATCH 07/10] Introduce cirros-minios-stubdom-hvm test

In reply to Géza Gémes
Quoted 4 lines · Géza Gémes

This test verifies a cirros based hvm domain using a minios based stubdom as its device model

Quoted 51 lines
---
 tests/cirros-minios-stubdom-hvm | 27 +++++++++++++++++++++++++++
 tests/series                    |  1 +
 2 files changed, 28 insertions(+)
 create mode 100644 tests/cirros-minios-stubdom-hvm
tests/cirros-minios-stubdom-hvm new file +27 -0
new file mode 100644
index 0000000..43dc568
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+
+set -e
+
+function cirros-minios-stubdom-hvm-cleanup() {
+    tear_down_cirros_test $testdir
+}
+
+function cirros-minios-stubdom-hvm-test() {
+    download_cirros_components
+    testdir=`mktemp -d`
+    cp $CIRROS_DOWNLOADS/$CIRROS_DISK_FILE $testdir
+    cat >$testdir/cirros-minios-stubdom-hvm.cfg <<EOF
+name = "raisin-test"
+builder = "hvm"
+device_model_stubdomain_override = 1
+memory = 128
+vcpus = 2
+disk = [ '$testdir/$CIRROS_DISK_FILE,raw,hda,rw' ]
+vif = [ 'bridge=xenbr1' ]
+serial="pty"
+boot="c"
+EOF
+
+    $SUDO xl create $testdir/cirros-minios-stubdom-hvm.cfg
+    check_guest_alive
+}
tests/series +1 -0
index 49a9257..7b1ad8e 100644
@@ -5,3 +5,4 @@ cirros-separate-kernel-pv
 cirros-pygrub-pv
 cirros-pvgrub2-pv
 cirros-qemu-hvm
+cirros-minios-stubdom-hvm
Signature · 1 line
2.7.4

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by on v1 8/10
#19 lore raw

Re: [PATCH 08/10] Introduce cirros-qemu-pvhvm test

In reply to Géza Gémes
Quoted 4 lines · Géza Gémes

This test is similar to cirros-qemu-hvm test, differing by explicitly exposing the xen netfront and blockfront drivers

Quoted 51 lines
---
 tests/cirros-qemu-pvhvm | 27 +++++++++++++++++++++++++++
 tests/series            |  1 +
 2 files changed, 28 insertions(+)
 create mode 100644 tests/cirros-qemu-pvhvm
tests/cirros-qemu-pvhvm new file +27 -0
new file mode 100644
index 0000000..6cf33e0
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+
+set -e
+
+function cirros-qemu-pvhvm-cleanup() {
+    tear_down_cirros_test $testdir
+}
+
+function cirros-qemu-pvhvm-test() {
+    download_cirros_components
+    testdir=`mktemp -d`
+    cp $CIRROS_DOWNLOADS/$CIRROS_DISK_FILE $testdir
+    cat >$testdir/cirros-qemu-pvhvm.cfg <<EOF
+name = "raisin-test"
+builder = "hvm"
+xen_platform_pci = 1
+memory = 128
+vcpus = 2
+disk = [ '$testdir/$CIRROS_DISK_FILE,raw,xvda,rw' ]
+vif = [ 'bridge=xenbr1' ]
+serial="pty"
+boot="c"
+EOF
+
+    $SUDO xl create $testdir/cirros-qemu-pvhvm.cfg
+    check_guest_alive
+}
tests/series +1 -0
index 7b1ad8e..51dbe17 100644
@@ -6,3 +6,4 @@ cirros-pygrub-pv
 cirros-pvgrub2-pv
 cirros-qemu-hvm
 cirros-minios-stubdom-hvm
+cirros-qemu-pvhvm
Signature · 1 line
2.7.4

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by on v1 9/10
#21 lore raw

Re: [PATCH 09/10] Introduce cirros-minios-stubdom-pvhvm test

In reply to Géza Gémes
Quoted 4 lines · Géza Gémes

This test is similar to cirros-minios-stubdom-hvm test, differing by explicitly exposing the xen netfront and blockfront drivers

Quoted 52 lines
---
 tests/cirros-minios-stubdom-pvhvm | 28 ++++++++++++++++++++++++++++
 tests/series                      |  1 +
 2 files changed, 29 insertions(+)
 create mode 100644 tests/cirros-minios-stubdom-pvhvm
tests/cirros-minios-stubdom-pvhvm new file +28 -0
new file mode 100644
index 0000000..719b78d
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+set -e
+
+function cirros-minios-stubdom-pvhvm-cleanup() {
+    tear_down_cirros_test $testdir
+}
+
+function cirros-minios-stubdom-pvhvm-test() {
+    download_cirros_components
+    testdir=`mktemp -d`
+    cp $CIRROS_DOWNLOADS/$CIRROS_DISK_FILE $testdir
+    cat >$testdir/cirros-minios-stubdom-pvhvm.cfg <<EOF
+name = "raisin-test"
+builder = "hvm"
+device_model_stubdomain_override = 1
+xen_platform_pci = 1
+memory = 128
+vcpus = 2
+disk = [ '$testdir/$CIRROS_DISK_FILE,raw,xvda,rw' ]
+vif = [ 'bridge=xenbr1' ]
+serial="pty"
+boot="c"
+EOF
+
+    $SUDO xl create $testdir/cirros-minios-stubdom-pvhvm.cfg
+    check_guest_alive
+}
tests/series +1 -0
index 51dbe17..ffa8e69 100644
@@ -7,3 +7,4 @@ cirros-pvgrub2-pv
 cirros-qemu-hvm
 cirros-minios-stubdom-hvm
 cirros-qemu-pvhvm
+cirros-minios-stubdom-pvhvm
Signature · 1 line
2.7.4

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#11 lore raw

Re: [PATCH 05/10] Introduce cirros-pvgrub2-pv test

In reply to Stefano Stabellini
Quoted 32 lines · Stefano Stabellini
Quoted 3 lines · Géza Gémes

This test verifies booting the cirros image using pvgrub2

Quoted 24 lines
---
 tests/cirros-pvgrub2-pv | 33 +++++++++++++++++++++++++++++++++
 tests/series            |  1 +
 2 files changed, 34 insertions(+)
 create mode 100644 tests/cirros-pvgrub2-pv
tests/cirros-pvgrub2-pv new file +12 -0
new file mode 100644
index 0000000..4994ea9
@@ -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
Quoted 8 lines

tests/cirros-pvgrub2-pv line 20

Quoted 8 lines
tests/cirros-pvgrub2-pv new file +8 -0
+    # 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.

Quoted 17 lines
Quoted 17 lines
tests/cirros-pvgrub2-pv new file +13 -0
+    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
+}
tests/series +0 -0
index 372fafb..1fec245 100644
Quoted 8 lines
Quoted 8 lines
tests/series +1 -0
@@ -3,3 +3,4 @@ busybox-hvm
 busybox-hvm-migrate
 cirros-separate-kernel-pv
 cirros-pygrub-pv
+cirros-pvgrub2-pv
Signature · 1 line
2.7.4

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#12 lore raw

Re: [PATCH 05/10] Introduce cirros-pvgrub2-pv test

2017-03-27 19:24 keltezéssel, Stefano Stabellini írta:

Quoted 44 lines · Stefano Stabellini
Quoted 31 lines · Géza Gémes
Quoted 3 lines

This test verifies booting the cirros image using pvgrub2

Quoted 24 lines
---
  tests/cirros-pvgrub2-pv | 33 +++++++++++++++++++++++++++++++++
  tests/series            |  1 +
  2 files changed, 34 insertions(+)

create mode 100644 tests/cirros-pvgrub2-pv

tests/cirros-pvgrub2-pv new file +12 -0
new file mode 100644
index 0000000..4994ea9
@@ -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
Quoted 8 lines

tests/cirros-pvgrub2-pv line 20

Quoted 8 lines
tests/cirros-pvgrub2-pv new file +8 -0
+    # 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?

Quoted 6 lines

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.

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
tests/cirros-pvgrub2-pv new file +13 -0
+    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
+}
tests/series +0 -1
index 372fafb..1fec245 100644
--- a/tests/series
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

+++ b/tests/series

tests/series +1 -0
@@ -3,3 +3,4 @@ busybox-hvm
  busybox-hvm-migrate
  cirros-separate-kernel-pv
  cirros-pygrub-pv
+cirros-pvgrub2-pv
Signature · 1 line
2.7.4

Cheers,

Geza

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#13 lore raw

Re: [PATCH 05/10] Introduce cirros-pvgrub2-pv test

Quoted 52 lines · Gémes Géza

2017-03-27 19:24 keltezéssel, Stefano Stabellini írta:

Quoted 45 lines · Stefano Stabellini
Quoted 32 lines · Géza Gémes
Quoted 3 lines

This test verifies booting the cirros image using pvgrub2

Quoted 25 lines
---
  tests/cirros-pvgrub2-pv | 33 +++++++++++++++++++++++++++++++++
  tests/series            |  1 +
  2 files changed, 34 insertions(+)

create mode 100644 tests/cirros-pvgrub2-pv

tests/cirros-pvgrub2-pv new file +13 -0
new file mode 100644
index 0000000..4994ea9
@@ -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
Quoted 8 lines

tests/cirros-pvgrub2-pv line 20

Quoted 8 lines
tests/cirros-pvgrub2-pv new file +1 -0
+    local cirros_disk_loop=`$SUDO $BASEDIR/scripts/lopartsetup

$testdir/$CIRROS_DISK_FILE | head -1 | cut -d ":" -f 1`

tests/cirros-pvgrub2-pv new file +6 -0
+    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?

Quoted 6 lines

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.

Quoted 9 lines

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.

OK, I think you made the right choice. I'll commit shortly.

Quoted 27 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
tests/cirros-pvgrub2-pv new file +13 -0
+    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
+}
tests/series +0 -1
index 372fafb..1fec245 100644
--- a/tests/series
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

+++ b/tests/series

tests/series +1 -0
@@ -3,3 +3,4 @@ busybox-hvm
  busybox-hvm-migrate
  cirros-separate-kernel-pv
  cirros-pygrub-pv
+cirros-pvgrub2-pv
Signature · 1 line
2.7.4

Cheers,

Quoted 2 lines

Geza

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel