From: Victor Lowther Date: Sun, 8 Mar 2009 15:49:44 +0000 (-0500) Subject: Modify Makefile to use new test harness X-Git-Tag: 0.1~294 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=32d6bc5d75c41958a04b02710660067ccdfa1ffc;p=thirdparty%2Fdracut.git Modify Makefile to use new test harness --- diff --git a/Makefile b/Makefile index a40b8ee48..45ad1a514 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,8 @@ modules.d/99base/switch_root: switch_root.c all: modules.d/99base/switch_root +.PHONY: install clean archive rpm testimage test + install: mkdir -p $(DESTDIR)/usr/lib/dracut mkdir -p $(DESTDIR)/sbin @@ -30,6 +32,12 @@ rpm: dracut-$(VERSION)-$(GITVERSION).tar.bz2 rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" --define "_rpmdir $$PWD" --define "gittag $(GITVERSION)" -ba dracut.spec rm -fr BUILD BUILDROOT +test: test/root.ext2 all + sudo test/test-initramfs + +test/root.ext2: test/test-init test/make-test-root all + sudo test/make-test-root + testimage: all ./dracut -l -f test-$(shell uname -r).img $(shell uname -r) @echo wrote test-$(shell uname -r).img diff --git a/test/make-test-root b/test/make-test-root new file mode 100755 index 000000000..474c9af12 --- /dev/null +++ b/test/make-test-root @@ -0,0 +1,15 @@ +#!/bin/bash +. ./dracut-functions +readonly initdir=$(mktemp -d -t initramfs-test-XXXXXXXX) +readonly mnttarget=$(mktemp -d -t initramfs-test-target-XXXXXXXX) +trap 'rm -rf "$initdir"' 0 +dracut_install sh df free ls shutdown poweroff stty cat ps ln \ + /lib/terminfo/l/linux mount dmesg +inst test/test-init /sbin/init +dd if=/dev/zero of=test/root.ext2 bs=1M count=10 +mke2fs -F test/root.ext2 +mount -o loop -t ext2 test/root.ext2 "$mnttarget" +cp -a -t "$mnttarget" "$initdir"/* +(cd "$mnttarget"; mkdir -p dev sys proc etc) +umount -l "$mnttarget" +rm -rf "$mnttarget" "$initdir" \ No newline at end of file diff --git a/test/test-initramfs b/test/test-initramfs index f27f9db9f..2fde6e39c 100755 --- a/test/test-initramfs +++ b/test/test-initramfs @@ -1,24 +1,9 @@ #!/bin/bash -. ./dracut-functions kernel=$(uname -r) -[[ -f root.ext2 ]] || { - readonly initdir=$(mktemp -d -t initramfs-test-XXXXXXXX) - readonly mnttarget=$(mktemp -d -t initramfs-test-target-XXXXXXXX) - trap 'rm -rf "$initdir"' 0 - dracut_install sh df free ls shutdown poweroff stty cat ps ln \ - /lib/terminfo/l/linux mount dmesg - inst test-init /sbin/init - dd if=/dev/zero of=root.ext2 bs=1M count=10 - mke2fs -F root.ext2 - mount -o loop -t ext2 root.ext2 "$mnttarget" - cp -a -t "$mnttarget" "$initdir"/* - (cd "$mnttarget"; mkdir -p dev sys proc etc) - umount -l "$mnttarget" - rm -rf "$mnttarget" "$initdir" -} -./dracut -c dracut.conf.test -l -f initramfs.testing +[[ -f test/root.ext2 ]] || test/make-test-root +./dracut -c test/dracut.conf.test -l -f test/initramfs.testing || exit -exec qemu-kvm -hda root.ext2 -nographic -net none \ +exec qemu-kvm -hda test/root.ext2 -nographic -net none \ -kernel /boot/vmlinuz-$kernel \ -append "root=/dev/sda rw rootfstype=ext2 console=ttyS0,115200n81 quiet" \ - -initrd initramfs.testing \ No newline at end of file + -initrd test/initramfs.testing \ No newline at end of file