From e1a2731868cdf72cbc54129bf5dd60554e9df7c6 Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Fri, 11 Nov 2016 13:45:38 +1100 Subject: 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 --- test/test-functions | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'test') 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 -- cgit v1.2.3-54-g00ecf