All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: george.dunlap@citrix.com
Cc: sstabellini@kernel.org, xen-devel@lists.xensource.com
Subject: [PATCH 1/3] raisin: introduce TEST_KERNEL and TEST_INITRD
Date: Tue, 23 May 2017 14:43:01 -0700	[thread overview]
Message-ID: <1495575783-23675-1-git-send-email-sstabellini@kernel.org> (raw)
In-Reply-To: <alpine.DEB.2.10.1705231440270.18759@sstabellini-ThinkPad-X260>

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@kernel.org>
---
 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@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-05-23 21:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-23 21:42 [PATCH 0/3] raisin test fixes Stefano Stabellini
2017-05-23 21:43 ` Stefano Stabellini [this message]
2017-05-23 21:43   ` [PATCH 2/3] raisin: check for invalid initrds Stefano Stabellini
2017-05-23 21:43   ` [PATCH 3/3] raisin/arm: properly ignore tests that don't work on ARM Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1495575783-23675-1-git-send-email-sstabellini@kernel.org \
    --to=sstabellini@kernel.org \
    --cc=george.dunlap@citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.