summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Vereshchagin <evvers@ya.ru>2016-11-11 13:45:38 +1100
committerEvgeny Vereshchagin <evvers@ya.ru>2016-11-11 13:47:44 +1100
commite1a2731868cdf72cbc54129bf5dd60554e9df7c6 (patch)
treee78f5d6c08fbc86b8c5c8160245fdb1dc33b4c0a
parent843d5baf6aad6c53fc00ea8d95d83209a4f92de1 (diff)
tests: fix kernel/initrd searching (Arch)
We can run sudo make run instead of the sudo make run KERNEL_BIN=/boot/vmlinuz-linux INITRD=/boot/initramfs-linux.img See https://github.com/systemd/systemd/issues/4607
-rw-r--r--test/test-functions23
1 files changed, 20 insertions, 3 deletions
diff --git a/test/test-functions b/test/test-functions
index 2a21a64c5c..9845b2e5dd 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -5,6 +5,7 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
LOOKS_LIKE_DEBIAN=$(source /etc/os-release && [[ "$ID" = "debian" || "$ID_LIKE" = "debian" ]] && echo yes)
+LOOKS_LIKE_ARCH=$(source /etc/os-release && [[ "$ID" = "arch" ]] && echo yes)
KERNEL_VER=${KERNEL_VER-$(uname -r)}
KERNEL_MODS="/lib/modules/$KERNEL_VER/"
QEMU_TIMEOUT="${QEMU_TIMEOUT:-infinity}"
@@ -58,11 +59,27 @@ run_qemu() {
&& KERNEL_BIN="/boot/$MACHINE_ID/$KERNEL_VER/linux"
fi
+ if [[ ! "$KERNEL_BIN" ]]; then
+ if [[ "$LOOKS_LIKE_ARCH" ]]; then
+ KERNEL_BIN=/boot/vmlinuz-linux
+ else
+ KERNEL_BIN=/boot/vmlinuz-$KERNEL_VER
+ fi
+ fi
+
default_fedora_initrd=/boot/initramfs-${KERNEL_VER}.img
default_debian_initrd=/boot/initrd.img-${KERNEL_VER}
- [ "$KERNEL_BIN" ] || KERNEL_BIN=/boot/vmlinuz-$KERNEL_VER
- [ "$INITRD" ] || { [ -e "$default_fedora_initrd" ] && INITRD=$default_fedora_initrd; }
- [ "$INITRD" ] || { [ "$LOOKS_LIKE_DEBIAN" ] && [ -e "$default_debian_initrd" ] && INITRD=$default_debian_initrd; }
+ default_arch_initrd=/boot/initramfs-linux.img
+ if [[ ! "$INITRD" ]]; then
+ if [[ -e "$default_fedora_initrd" ]]; then
+ INITRD="$default_fedora_initrd"
+ elif [[ "$LOOKS_LIKE_DEBIAN" && -e "$default_debian_initrd" ]]; then
+ INITRD="$default_debian_initrd"
+ elif [[ "$LOOKS_LIKE_ARCH" && -e "$default_arch_initrd" ]]; then
+ INITRD="$default_arch_initrd"
+ fi
+ fi
+
[ "$QEMU_SMP" ] || QEMU_SMP=1
find_qemu_bin || return 1