[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 1/3] raisin: introduce TEST_KERNEL and TEST_INITRD



We don't necessarely always want to guess and use the dom0 kernel and
initrd for tests. Introduce two options, TEST_KERNEL and TEST_INITRD,
that allow a user to manually specify which kernel and initrd to use.

Signed-off-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 defconfig               |  8 ++++++++
 lib/common-functions.sh | 30 ++++++++++++++++++++++++++++++
 lib/common-tests.sh     | 13 ++-----------
 3 files changed, 40 insertions(+), 11 deletions(-)

diff --git a/defconfig b/defconfig
index bdacc7e..2e2dc50 100644
--- a/defconfig
+++ b/defconfig
@@ -32,3 +32,11 @@ GIT_TRANSPORT="git"
 ## All tests: busybox-pv busybox-hvm
 ## ENABLED_TESTS is the list of test run by raise test
 ENABLED_TESTS="busybox-pv busybox-hvm cirros-separate-kernel-pv 
cirros-pygrub-pv cirros-pvgrub2-pv cirros-qemu-hvm cirros-qemu-pvhvm"
+
+# Kernel to use for tests. If not specified, raisin will try to use your
+# Dom0 kernel.
+#TEST_KERNEL=/boot/kernel
+
+# Initrd to use for tests. If not specified, raisin will try to use your
+# Dom0 initrd. If you don't need an initrd, please specify:
+#TEST_INITRD="none"
diff --git a/lib/common-functions.sh b/lib/common-functions.sh
index efc92ff..56e9bdf 100644
--- a/lib/common-functions.sh
+++ b/lib/common-functions.sh
@@ -402,6 +402,36 @@ function init_tests() {
         $SUDO brctl addbr xenbr1
         $SUDO ifconfig xenbr1 169.254.0.1 up
     fi
+
+    if [[ -z "$TEST_KERNEL" ]]
+    then
+        TEST_KERNEL="/boot/vmlinuz-`uname -r`"
+    fi
+    if [[ -e "$TEST_KERNEL" ]]
+    then
+        export TEST_KERNEL="$TEST_KERNEL"
+    else
+        echo "Could not find kernel to use for tests, please specify 
TEST_KERNEL"
+        exit 1
+    fi
+
+    if [[ -z "$TEST_INITRD" ]]
+    then
+        if [[ $DISTRO = "Debian" ]]
+        then
+            TEST_INITRD="/boot/initrd.img-`uname -r`"
+        elif [[ $DISTRO = "Fedora" ]]
+        then
+            TEST_INITRD="/boot/initramfs-`uname -r`".img
+        fi
+    fi
+    if [[ -e "$TEST_INITRD" || "$TEST_INITRD" = "none" ]]
+    then
+        export TEST_INITRD="$TEST_INITRD"
+    else
+        echo "Could not find initrd to use for tests, please specify 
TEST_INITRD"
+        exit 1
+    fi
 }
 
 function _build_package_deb() {
diff --git a/lib/common-tests.sh b/lib/common-tests.sh
index c07bb18..dfe01bd 100644
--- a/lib/common-tests.sh
+++ b/lib/common-tests.sh
@@ -163,20 +163,11 @@ function check_guest_alive() {
 }
 
 function get_host_kernel() {
-    echo "/boot/vmlinuz-`uname -r`"
+    echo "$TEST_KERNEL"
 }
 
 function get_host_initrd() {
-    if [[ $DISTRO = "Debian" ]]
-    then
-        echo "/boot/initrd.img-`uname -r`"
-    elif [[ $DISTRO = "Fedora" ]]
-    then
-        echo "/boot/initramfs-`uname -r`".img
-    else
-        echo "$PREPEND I don't know how to find the initrd" >&2
-        exit 1
-    fi
+    echo "$TEST_INITRD"
 }
 
 function cirros_network_init() {
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.