]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Make running qemu a little more generic
authorVictor Lowther <victor.lowther@gmail.com>
Thu, 21 May 2009 02:55:04 +0000 (19:55 -0700)
committerHarald Hoyer <harald@redhat.com>
Mon, 25 May 2009 09:24:26 +0000 (11:24 +0200)
Also create the root filesystem from within the virtual env, this way there
will be no nasty suprises w.r.t interactions with the host machine.  This
is important when we test booting to LVM, LUKS, and mdraid.

test/make-test-root
test/run-qemu [new file with mode: 0644]
test/test-initramfs

index de0376211ee21330197a0681cb754396785aebfb..d79153df6ff98ca3dda0942908e4780a69d0a2c9 100755 (executable)
@@ -1,9 +1,6 @@
 #!/bin/bash
 
 dd if=/dev/zero of=test/root.ext2 bs=1M count=20
-mke2fs -F test/root.ext2
-mkdir test/mnt
-mount -o loop test/root.ext2 test/mnt
 
 initdir=test/mnt
 kernel=$(uname -r)
@@ -21,6 +18,12 @@ kernel=$(uname -r)
 targetfs="$initdir"
 unset initdir
 
+./dracut -l -i "$targetfs" /source \
+    -m "dash kernel-modules test crypt lvm udev-rules base rootfs-block" \
+    -d "ata_piix ext2 sd_mod" \
+    -f test/initramfs.makeroot
 
-umount test/mnt
-rm -fr test/mnt
+test/run-qemu -hda test/root.ext2 -m 512M -nographic -net none \
+    -kernel "/boot/vmlinuz-$kernel" \
+    -append "root=/dev/dracut/root rw rootfstype=ext2 quiet console=ttyS0,115200n81" \
+    -initrd test/initramfs.makeroot
diff --git a/test/run-qemu b/test/run-qemu
new file mode 100644 (file)
index 0000000..c1068e5
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+for f in kvm qemu-kvm qemu; do
+    type $f >/dev/null 2>&1 || continue
+    $f "$@"
+    exit
+done
+echo "Could not find a working KVM or QEMU to test with!"
+echo "Please install kvm or qemu."
+exit 1
\ No newline at end of file
index f82830775b3af93fe67cf4c56c166d77ae80a631..3c75553fa233e0a4810b9ee98ef596be663cf6fd 100755 (executable)
@@ -1,11 +1,8 @@
 #!/bin/bash
 [[ -f test/root.ext2 ]] || test/make-test-root
 
-./dracut $DRACUTOPTS -c test/dracut.conf.test -l -f test/initramfs.testing || exit
-
-qemu-kvm -hda test/root.ext2 -m 512M -nographic  \
-       -net nic,macaddr=52:54:00:12:34:57 -net socket,mcast=230.0.0.1:1234 \
-       -kernel /boot/vmlinuz-$(uname -r) \
-       -initrd test/initramfs.testing \
-       -append "root=/dev/sda rw console=ttyS0,115200n81 $APPEND"   
-
+test/run-qemu -hda test/root.ext2 -m 512M -nographic \
+    -net nic,macaddr=52:54:00:12:34:57 -net socket,mcast=230.0.0.1:1234 \
+    -kernel /boot/vmlinuz-$(uname -r) \
+    -append "root=/dev/sda rw console=ttyS0,115200n81 $APPEND" \
+    -initrd test/initramfs.testing