From cd077b8229731e292798f34dd56892cbfa6f1e0e Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 22 Dec 2011 12:15:06 +0000 Subject: tests: Split images -> tests/data + tests/guests --- .gitignore | 40 ++--- .x-sc_TAB_in_indentation | 2 +- .x-sc_trailing_blank | 2 +- Makefile.am | 2 +- cat/test-virt-cat.sh | 4 +- cat/test-virt-filesystems.sh | 4 +- cat/test-virt-ls.sh | 4 +- clone/test-virt-sysprep.sh | 2 +- configure.ac | 3 +- df/test-virt-df.sh | 2 +- edit/test-virt-edit.sh | 2 +- fish/test-copy.sh | 6 +- fish/test-find0.sh | 2 +- fish/test-read_file.sh | 4 +- fish/test-upload-to-dir.sh | 2 +- generator/generator_actions.ml | 10 +- generator/generator_tests_c_api.ml | 4 +- images/Makefile.am | 233 -------------------------- images/README-binfiles | 13 -- images/bin-i586-dynamic | Bin 4616 -> 0 bytes images/bin-sparc-dynamic | Bin 5060 -> 0 bytes images/bin-win32.exe | Bin 21617 -> 0 bytes images/bin-win64.exe | Bin 44557 -> 0 bytes images/bin-x86_64-dynamic | Bin 6484 -> 0 bytes images/empty | 0 images/guest-aux/debian-packages | 48 ------ images/guest-aux/fedora-name.db.txt | 13 -- images/guest-aux/fedora-packages.db.txt | 13 -- images/guest-aux/make-debian-img.sh | 92 ---------- images/guest-aux/make-fedora-img.pl | 195 --------------------- images/guest-aux/make-ubuntu-img.sh | 81 --------- images/guest-aux/make-windows-img.sh | 71 -------- images/guest-aux/minimal-hive | Bin 8192 -> 0 bytes images/guest-aux/windows-software | Bin 12288 -> 0 bytes images/guest-aux/windows-software.reg | 49 ------ images/guest-aux/windows-system | Bin 12288 -> 0 bytes images/guest-aux/windows-system.reg | 17 -- images/helloworld.tar | Bin 10240 -> 0 bytes images/helloworld.tar.gz | Bin 190 -> 0 bytes images/helloworld.tar.xz | Bin 216 -> 0 bytes images/known-1 | 1 - images/known-2 | 1 - images/known-3 | 27 --- images/known-4 | 3 - images/known-5 | 2 - images/lib-i586.so | Bin 3834 -> 0 bytes images/lib-sparc.so | Bin 4536 -> 0 bytes images/lib-win32.dll | Bin 16402 -> 0 bytes images/lib-win64.dll | Bin 34777 -> 0 bytes images/lib-x86_64.so | Bin 5467 -> 0 bytes images/mbr-ext2-empty.img.gz | Bin 1856 -> 0 bytes images/test-grep.txt | 7 - inspector/Makefile.am | 8 +- perl/Makefile.am | 2 +- po/POTFILES.in | 4 - src/guestfs.pod | 6 - tests/data/Makefile.am | 152 +++++++++++++++++ tests/data/README-binfiles | 13 ++ tests/data/bin-i586-dynamic | Bin 0 -> 4616 bytes tests/data/bin-sparc-dynamic | Bin 0 -> 5060 bytes tests/data/bin-win32.exe | Bin 0 -> 21617 bytes tests/data/bin-win64.exe | Bin 0 -> 44557 bytes tests/data/bin-x86_64-dynamic | Bin 0 -> 6484 bytes tests/data/empty | 0 tests/data/helloworld.tar | Bin 0 -> 10240 bytes tests/data/helloworld.tar.gz | Bin 0 -> 190 bytes tests/data/helloworld.tar.xz | Bin 0 -> 216 bytes tests/data/known-1 | 1 + tests/data/known-2 | 1 + tests/data/known-3 | 27 +++ tests/data/known-4 | 3 + tests/data/known-5 | 2 + tests/data/lib-i586.so | Bin 0 -> 3834 bytes tests/data/lib-sparc.so | Bin 0 -> 4536 bytes tests/data/lib-win32.dll | Bin 0 -> 16402 bytes tests/data/lib-win64.dll | Bin 0 -> 34777 bytes tests/data/lib-x86_64.so | Bin 0 -> 5467 bytes tests/data/mbr-ext2-empty.img.gz | Bin 0 -> 1856 bytes tests/data/test-grep.txt | 7 + tests/extra/Makefile.am | 32 ++-- tests/guests/Makefile.am | 106 ++++++++++++ tests/guests/guest-aux/debian-packages | 48 ++++++ tests/guests/guest-aux/fedora-name.db.txt | 13 ++ tests/guests/guest-aux/fedora-packages.db.txt | 13 ++ tests/guests/guest-aux/make-debian-img.sh | 92 ++++++++++ tests/guests/guest-aux/make-fedora-img.pl | 195 +++++++++++++++++++++ tests/guests/guest-aux/make-ubuntu-img.sh | 81 +++++++++ tests/guests/guest-aux/make-windows-img.sh | 71 ++++++++ tests/guests/guest-aux/minimal-hive | Bin 0 -> 8192 bytes tests/guests/guest-aux/windows-software | Bin 0 -> 12288 bytes tests/guests/guest-aux/windows-software.reg | 49 ++++++ tests/guests/guest-aux/windows-system | Bin 0 -> 12288 bytes tests/guests/guest-aux/windows-system.reg | 17 ++ tests/md/test-inspect-fstab-md.sh | 4 +- tests/md/test-inspect-fstab.sh | 2 +- tools/test-virt-list-filesystems.sh | 2 +- tools/test-virt-tar.sh | 2 +- 97 files changed, 965 insertions(+), 949 deletions(-) delete mode 100644 images/Makefile.am delete mode 100644 images/README-binfiles delete mode 100755 images/bin-i586-dynamic delete mode 100755 images/bin-sparc-dynamic delete mode 100755 images/bin-win32.exe delete mode 100755 images/bin-win64.exe delete mode 100755 images/bin-x86_64-dynamic delete mode 100644 images/empty delete mode 100644 images/guest-aux/debian-packages delete mode 100644 images/guest-aux/fedora-name.db.txt delete mode 100644 images/guest-aux/fedora-packages.db.txt delete mode 100755 images/guest-aux/make-debian-img.sh delete mode 100755 images/guest-aux/make-fedora-img.pl delete mode 100755 images/guest-aux/make-ubuntu-img.sh delete mode 100755 images/guest-aux/make-windows-img.sh delete mode 100755 images/guest-aux/minimal-hive delete mode 100755 images/guest-aux/windows-software delete mode 100644 images/guest-aux/windows-software.reg delete mode 100755 images/guest-aux/windows-system delete mode 100644 images/guest-aux/windows-system.reg delete mode 100644 images/helloworld.tar delete mode 100644 images/helloworld.tar.gz delete mode 100644 images/helloworld.tar.xz delete mode 100644 images/known-1 delete mode 100644 images/known-2 delete mode 100644 images/known-3 delete mode 100644 images/known-4 delete mode 100644 images/known-5 delete mode 100755 images/lib-i586.so delete mode 100755 images/lib-sparc.so delete mode 100755 images/lib-win32.dll delete mode 100755 images/lib-win64.dll delete mode 100755 images/lib-x86_64.so delete mode 100644 images/mbr-ext2-empty.img.gz delete mode 100644 images/test-grep.txt create mode 100644 tests/data/Makefile.am create mode 100644 tests/data/README-binfiles create mode 100755 tests/data/bin-i586-dynamic create mode 100755 tests/data/bin-sparc-dynamic create mode 100755 tests/data/bin-win32.exe create mode 100755 tests/data/bin-win64.exe create mode 100755 tests/data/bin-x86_64-dynamic create mode 100644 tests/data/empty create mode 100644 tests/data/helloworld.tar create mode 100644 tests/data/helloworld.tar.gz create mode 100644 tests/data/helloworld.tar.xz create mode 100644 tests/data/known-1 create mode 100644 tests/data/known-2 create mode 100644 tests/data/known-3 create mode 100644 tests/data/known-4 create mode 100644 tests/data/known-5 create mode 100755 tests/data/lib-i586.so create mode 100755 tests/data/lib-sparc.so create mode 100755 tests/data/lib-win32.dll create mode 100755 tests/data/lib-win64.dll create mode 100755 tests/data/lib-x86_64.so create mode 100644 tests/data/mbr-ext2-empty.img.gz create mode 100644 tests/data/test-grep.txt create mode 100644 tests/guests/Makefile.am create mode 100644 tests/guests/guest-aux/debian-packages create mode 100644 tests/guests/guest-aux/fedora-name.db.txt create mode 100644 tests/guests/guest-aux/fedora-packages.db.txt create mode 100755 tests/guests/guest-aux/make-debian-img.sh create mode 100755 tests/guests/guest-aux/make-fedora-img.pl create mode 100755 tests/guests/guest-aux/make-ubuntu-img.sh create mode 100755 tests/guests/guest-aux/make-windows-img.sh create mode 100755 tests/guests/guest-aux/minimal-hive create mode 100755 tests/guests/guest-aux/windows-software create mode 100644 tests/guests/guest-aux/windows-software.reg create mode 100755 tests/guests/guest-aux/windows-system create mode 100644 tests/guests/guest-aux/windows-system.reg diff --git a/.gitignore b/.gitignore index 895227ce..dcf2af1e 100644 --- a/.gitignore +++ b/.gitignore @@ -152,26 +152,6 @@ html/virt-tar.1.html html/virt-tar-in.1.html html/virt-tar-out.1.html html/virt-win-reg.1.html -images/100kallnewlines -images/100kallspaces -images/100kallzeroes -images/100krandom -images/10klines -images/abssymlink -images/debian.img -images/fedora.img -images/fedora-md1.img -images/fedora-md2.img -images/guest-aux/fedora-name.db -images/guest-aux/fedora-packages.db -images/hello.b64 -images/initrd -images/initrd-x86_64.img -images/initrd-x86_64.img.gz -images/test.iso -images/test-grep.txt.gz -images/ubuntu.img -images/windows.img inspector/stamp-virt-inspector.pod inspector/virt-inspector inspector/virt-inspector.1 @@ -356,7 +336,27 @@ tests/c-api/test*.img tests/c-api/tests tests/c-api/tests.c tests/c-api/test*.tmp +tests/data/100kallnewlines +tests/data/100kallspaces +tests/data/100kallzeroes +tests/data/100krandom +tests/data/10klines +tests/data/abssymlink +tests/data/hello.b64 +tests/data/initrd +tests/data/initrd-x86_64.img +tests/data/initrd-x86_64.img.gz +tests/data/test.iso +tests/data/test-grep.txt.gz tests/extra/valgrind.log +tests/guests/debian.img +tests/guests/fedora.img +tests/guests/fedora-md1.img +tests/guests/fedora-md2.img +tests/guests/guest-aux/fedora-name.db +tests/guests/guest-aux/fedora-packages.db +tests/guests/ubuntu.img +tests/guests/windows.img tests/regressions/rhbz501893 tools/test.img tools/virt-*.1 diff --git a/.x-sc_TAB_in_indentation b/.x-sc_TAB_in_indentation index ef5b1b66..586e1d23 100644 --- a/.x-sc_TAB_in_indentation +++ b/.x-sc_TAB_in_indentation @@ -1,5 +1,5 @@ ^appliance/debian/modules/ -^images/ +^tests/data/ ^COPYING(.LIB)?$ ^\.gitmodules$ (^|\/)ChangeLog[^/]*$ diff --git a/.x-sc_trailing_blank b/.x-sc_trailing_blank index 502e6601..148e6aa2 100644 --- a/.x-sc_trailing_blank +++ b/.x-sc_trailing_blank @@ -1,2 +1,2 @@ -images/bin-win64.exe +tests/data/bin-win64.exe *.pod diff --git a/Makefile.am b/Makefile.am index 9ae52175..438c5228 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,7 +20,7 @@ include $(top_srcdir)/subdir-rules.mk ACLOCAL_AMFLAGS = -I m4 # Basic source for the library. -SUBDIRS = gnulib/lib images generator src examples po +SUBDIRS = gnulib/lib tests/data tests/guests generator src examples po if ENABLE_DAEMON SUBDIRS += daemon diff --git a/cat/test-virt-cat.sh b/cat/test-virt-cat.sh index 19b8d875..79844562 100755 --- a/cat/test-virt-cat.sh +++ b/cat/test-virt-cat.sh @@ -4,11 +4,11 @@ export LANG=C set -e # Read out the test files from the image using virt-cat. -if [ "$(./virt-cat ../images/fedora.img /etc/test1)" != "abcdefg" ]; then +if [ "$(./virt-cat ../tests/guests/fedora.img /etc/test1)" != "abcdefg" ]; then echo "$0: error: mismatch in file test1" exit 1 fi -if [ "$(./virt-cat ../images/fedora.img /etc/test2)" != "" ]; then +if [ "$(./virt-cat ../tests/guests/fedora.img /etc/test2)" != "" ]; then echo "$0: error: mismatch in file test2" exit 1 fi diff --git a/cat/test-virt-filesystems.sh b/cat/test-virt-filesystems.sh index f3c325c6..e664e1a2 100755 --- a/cat/test-virt-filesystems.sh +++ b/cat/test-virt-filesystems.sh @@ -3,7 +3,7 @@ export LANG=C set -e -output="$(./virt-filesystems -a ../images/fedora.img | sort)" +output="$(./virt-filesystems -a ../tests/guests/fedora.img | sort)" expected="/dev/VG/LV1 /dev/VG/LV2 /dev/VG/LV3 @@ -16,7 +16,7 @@ if [ "$output" != "$expected" ]; then exit 1 fi -output="$(./virt-filesystems -a ../images/fedora.img --all --long --uuid -h --no-title | awk '{print $1}' | sort -u)" +output="$(./virt-filesystems -a ../tests/guests/fedora.img --all --long --uuid -h --no-title | awk '{print $1}' | sort -u)" expected="/dev/VG /dev/VG/LV1 /dev/VG/LV2 diff --git a/cat/test-virt-ls.sh b/cat/test-virt-ls.sh index 3f702b7c..b7b02a34 100755 --- a/cat/test-virt-ls.sh +++ b/cat/test-virt-ls.sh @@ -4,7 +4,7 @@ export LANG=C set -e # Read out the test directory using virt-ls. -if [ "$(./virt-ls ../images/fedora.img /bin)" != "ls +if [ "$(./virt-ls ../tests/guests/fedora.img /bin)" != "ls test1 test2 test3 @@ -17,7 +17,7 @@ test7" ]; then fi # Try the -lR option. -output="$(./virt-ls -lR ../images/fedora.img /boot | awk '{print $1 $2 $4}')" +output="$(./virt-ls -lR ../tests/guests/fedora.img /boot | awk '{print $1 $2 $4}')" expected="d0755/boot d0755/boot/grub -0644/boot/grub/grub.conf diff --git a/clone/test-virt-sysprep.sh b/clone/test-virt-sysprep.sh index 1ebbde7d..32173897 100755 --- a/clone/test-virt-sysprep.sh +++ b/clone/test-virt-sysprep.sh @@ -26,7 +26,7 @@ fi rm -f test.img guestfish -qemu-img create -f qcow2 -o backing_file=../images/fedora.img test.img +qemu-img create -f qcow2 -o backing_file=../tests/guests/fedora.img test.img # Provide alternate 'virt-inspector' and 'guestmount' binaries # that run the just-built programs. diff --git a/configure.ac b/configure.ac index 6084a1b4..b0661a0d 100644 --- a/configure.ac +++ b/configure.ac @@ -1022,7 +1022,6 @@ AC_CONFIG_FILES([Makefile gnulib/lib/Makefile gnulib/tests/Makefile haskell/Makefile - images/Makefile inspector/Makefile java/Makefile java/examples/Makefile @@ -1049,7 +1048,9 @@ AC_CONFIG_FILES([Makefile src/Makefile test-tool/Makefile tests/c-api/Makefile + tests/data/Makefile tests/extra/Makefile + tests/guests/Makefile tests/luks/Makefile tests/lvm/Makefile tests/md/Makefile diff --git a/df/test-virt-df.sh b/df/test-virt-df.sh index 38884e12..af503a3e 100755 --- a/df/test-virt-df.sh +++ b/df/test-virt-df.sh @@ -4,7 +4,7 @@ export LANG=C set -e # Run virt-df. -output=$(./virt-df ../images/fedora.img) +output=$(./virt-df ../tests/guests/fedora.img) # Check title is the first line. if [[ ! $output =~ ^Filesystem.* ]]; then diff --git a/edit/test-virt-edit.sh b/edit/test-virt-edit.sh index d43851b5..7645a7f4 100755 --- a/edit/test-virt-edit.sh +++ b/edit/test-virt-edit.sh @@ -5,7 +5,7 @@ set -e # Make a copy of the Fedora image so we can write to it then # discard it. -cp ../images/fedora.img test.img +cp ../tests/guests/fedora.img test.img # Edit interactively. We have to simulate this by setting $EDITOR. # The command will be: echo newline >> /tmp/file diff --git a/fish/test-copy.sh b/fish/test-copy.sh index ea6a4cc5..b6f34226 100755 --- a/fish/test-copy.sh +++ b/fish/test-copy.sh @@ -32,13 +32,13 @@ rm -f test1.img rm -rf original copy mkdir original -cp $srcdir/../images/known* original -cp -P $srcdir/../images/abssymlink* original +cp $srcdir/../tests/data/known* original +cp -P $srcdir/../tests/data/abssymlink* original output=$( ../fish/guestfish -N fs -m /dev/sda1 < test.out -add-ro ../images/test.iso +add-ro ../tests/data/test.iso run mount-ro /dev/sda / read-file /helloworld.tar EOF -cmp ../images/helloworld.tar test.out +cmp ../tests/data/helloworld.tar test.out rm -f test.out \ No newline at end of file diff --git a/fish/test-upload-to-dir.sh b/fish/test-upload-to-dir.sh index 41ce5e5a..1ef24a01 100755 --- a/fish/test-upload-to-dir.sh +++ b/fish/test-upload-to-dir.sh @@ -24,7 +24,7 @@ set -e rm -f test1.img test.out -if ../fish/guestfish -N fs -m /dev/sda1 upload ../images/test.iso / 2>test.out +if ../fish/guestfish -N fs -m /dev/sda1 upload ../tests/data/test.iso / 2>test.out then echo "$0: expecting guestfish to return an error" exit 1 diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml index f7a6a6cf..7a5d786b 100644 --- a/generator/generator_actions.ml +++ b/generator/generator_actions.ml @@ -2818,7 +2818,7 @@ To get the checksums for many files, use C."); ("tar_in", (RErr, [FileIn "tarfile"; Pathname "directory"], []), 69, [], [InitScratchFS, Always, TestOutput ( [["mkdir"; "/tar_in"]; - ["tar_in"; "../images/helloworld.tar"; "/tar_in"]; + ["tar_in"; "../data/helloworld.tar"; "/tar_in"]; ["cat"; "/tar_in/hello"]], "hello\n")], "unpack tarfile to directory", "\ @@ -2841,7 +2841,7 @@ or C."); ("tgz_in", (RErr, [FileIn "tarball"; Pathname "directory"], []), 71, [], [InitScratchFS, Always, TestOutput ( [["mkdir"; "/tgz_in"]; - ["tgz_in"; "../images/helloworld.tar.gz"; "/tgz_in"]; + ["tgz_in"; "../data/helloworld.tar.gz"; "/tgz_in"]; ["cat"; "/tgz_in/hello"]], "hello\n")], "unpack compressed tarball to directory", "\ @@ -5385,7 +5385,7 @@ or growing unnecessarily."); ("txz_in", (RErr, [FileIn "tarball"; Pathname "directory"], []), 229, [Optional "xz"], [InitScratchFS, Always, TestOutput ( [["mkdir"; "/txz_in"]; - ["txz_in"; "../images/helloworld.tar.xz"; "/txz_in"]; + ["txz_in"; "../data/helloworld.tar.xz"; "/txz_in"]; ["cat"; "/txz_in/hello"]], "hello\n")], "unpack compressed tarball to directory", "\ @@ -5482,7 +5482,7 @@ types (see C)."); ("checksum_device", (RString "checksum", [String "csumtype"; Device "device"], []), 237, [], [InitISOFS, Always, TestOutputFileMD5 ( [["checksum_device"; "md5"; "/dev/sdd"]], - "../images/test.iso")], + "../data/test.iso")], "compute MD5, SHAx or CRC checksum of the contents of a device", "\ This call computes the MD5, SHAx or CRC checksum of the @@ -5532,7 +5532,7 @@ to find out what it is for."); ("base64_in", (RErr, [FileIn "base64file"; Pathname "filename"], []), 242, [], [InitScratchFS, Always, TestOutput ( - [["base64_in"; "../images/hello.b64"; "/base64_in"]; + [["base64_in"; "../data/hello.b64"; "/base64_in"]; ["cat"; "/base64_in"]], "hello\n")], "upload base64-encoded data to file", "\ diff --git a/generator/generator_tests_c_api.ml b/generator/generator_tests_c_api.ml index 5b4f7a80..5d2d20a7 100644 --- a/generator/generator_tests_c_api.ml +++ b/generator/generator_tests_c_api.ml @@ -257,8 +257,8 @@ int main (int argc, char *argv[]) exit (EXIT_FAILURE); } - if (guestfs_add_drive_ro (g, \"../../images/test.iso\") == -1) { - printf (\"guestfs_add_drive_ro ../../images/test.iso FAILED\\n\"); + if (guestfs_add_drive_ro (g, \"../data/test.iso\") == -1) { + printf (\"guestfs_add_drive_ro ../data/test.iso FAILED\\n\"); exit (EXIT_FAILURE); } diff --git a/images/Makefile.am b/images/Makefile.am deleted file mode 100644 index e413750d..00000000 --- a/images/Makefile.am +++ /dev/null @@ -1,233 +0,0 @@ -# libguestfs test images -# Copyright (C) 2009-2010 Red Hat Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -include $(top_srcdir)/subdir-rules.mk - -# Old RHEL 5 autoconf doesn't have builddir. -builddir ?= $(top_builddir)/images - -EXTRA_DIST = \ - helloworld.tar \ - helloworld.tar.gz \ - helloworld.tar.xz \ - mbr-ext2-empty.img.gz \ - empty known-1 known-2 known-3 known-4 known-5 \ - bin-i586-dynamic \ - bin-sparc-dynamic \ - bin-win32.exe \ - bin-win64.exe \ - bin-x86_64-dynamic \ - lib-i586.so \ - lib-sparc.so \ - lib-win32.dll \ - lib-win64.dll \ - lib-x86_64.so \ - test-grep.txt \ - guest-aux/make-debian-img.sh \ - guest-aux/debian-packages \ - guest-aux/make-fedora-img.pl \ - guest-aux/fedora-name.db.txt \ - guest-aux/fedora-name.db \ - guest-aux/fedora-packages.db.txt \ - guest-aux/fedora-packages.db \ - guest-aux/make-ubuntu-img.sh \ - guest-aux/make-windows-img.sh \ - guest-aux/windows-software \ - guest-aux/windows-software.reg \ - guest-aux/windows-system \ - guest-aux/windows-system.reg \ - guest-aux/minimal-hive - -noinst_DATA = test.iso - -# This is 'check_DATA' because we don't need it until 'make check' -# time and we need the tools we have built in order to make it. -check_DATA = debian.img fedora.img fedora-md1.img fedora-md2.img ubuntu.img windows.img - -CLEANFILES = \ - test.iso test.sqsh \ - 100kallzeroes 100kallnewlines 100kallspaces 100krandom 10klines \ - initrd $(check_DATA) - -images_files_src = \ - $(srcdir)/helloworld.tar \ - $(srcdir)/helloworld.tar.gz \ - $(srcdir)/helloworld.tar.xz \ - $(srcdir)/empty \ - $(srcdir)/known-1 \ - $(srcdir)/known-2 \ - $(srcdir)/known-3 \ - $(srcdir)/known-4 \ - $(srcdir)/known-5 \ - $(srcdir)/bin-i586-dynamic \ - $(srcdir)/bin-sparc-dynamic \ - $(srcdir)/bin-win32.exe \ - $(srcdir)/bin-win64.exe \ - $(srcdir)/bin-x86_64-dynamic \ - $(srcdir)/lib-i586.so \ - $(srcdir)/lib-sparc.so \ - $(srcdir)/lib-win32.dll \ - $(srcdir)/lib-win64.dll \ - $(srcdir)/lib-x86_64.so \ - $(srcdir)/test-grep.txt - -images_files_build = \ - $(builddir)/100kallzeroes \ - $(builddir)/100kallnewlines \ - $(builddir)/100kallspaces \ - $(builddir)/100krandom \ - $(builddir)/10klines \ - $(builddir)/abssymlink \ - $(builddir)/hello.b64 \ - $(builddir)/initrd \ - $(builddir)/initrd-x86_64.img \ - $(builddir)/initrd-x86_64.img.gz \ - $(builddir)/test-grep.txt.gz - -images_files = $(images_files_src) $(images_files_build) - -test.iso: $(images_files) - rm -f $@ $@-t - mkdir -p directory - $(GENISOIMAGE) -J -r -graft-points \ - -o $@-t \ - $(images_files) /directory=directory - rmdir directory - mv $@-t $@ - -$(builddir)/100kallzeroes: - rm -f $@ $@-t - dd if=/dev/zero of=$@-t bs=1024 count=100 - mv $@-t $@ - -$(builddir)/100kallnewlines: $(builddir)/100kallzeroes - rm -f $@ $@-t - tr '\0' '\n' < $< > $@-t - mv $@-t $@ - -$(builddir)/100kallspaces: $(builddir)/100kallzeroes - rm -f $@ $@-t - tr '\0' ' ' < $< > $@-t - mv $@-t $@ - -$(builddir)/100krandom: - rm -f $@ $@-t - dd if=/dev/urandom of=$@-t bs=1024 count=100 - mv $@-t $@ - -$(builddir)/10klines: - rm -f $@ $@-t - i=0; \ - while [ $$i -lt 10000 ]; do \ - echo "$${i}abcdefghijklmnopqrstuvwxyz"; \ - i=$$(($$i+1)); \ - done > $@-t - mv $@-t $@ - -$(builddir)/abssymlink: - ln -sf /10klines $@ - -$(builddir)/hello.b64: - echo "hello" | base64 > $@ - -$(builddir)/initrd: empty known-1 known-2 known-3 known-4 known-5 - rm -f $@ $@-t - for f in $^; do echo $$f; done | cpio -o -H newc | gzip --best > $@-t - mv $@-t $@ - -# Create a dummy initrd with a single file called 'bin/nash' which -# is used to test the Sys::Guestfs::Lib::file_architecture function. -$(builddir)/initrd-x86_64.img: bin-x86_64-dynamic - rm -rf bin $@ $@-t - mkdir bin - cp $< bin/nash - echo bin/nash | cpio -o -H newc > $@-t - mv $@-t $@ - rm -rf bin $@-t - -$(builddir)/initrd-x86_64.img.gz: initrd-x86_64.img - rm -f $@ $@-t - gzip --best -c $< > $@-t - mv $@-t $@ - -$(builddir)/test-grep.txt.gz: test-grep.txt - rm -f $@ $@-t - gzip --best -c $< > $@-t - mv $@-t $@ - -# Make a (dummy) Fedora image. -fedora.img: guest-aux/make-fedora-img.pl \ - guest-aux/fedora-name.db \ - guest-aux/fedora-packages.db - TMPDIR=$(top_builddir) \ - SRCDIR=$(srcdir) \ - LAYOUT=partitions \ - ../run $< - -# Make a (dummy) Fedora image using md devices -fedora-md1.img fedora-md2.img: guest-aux/make-fedora-img.pl \ - guest-aux/fedora-name.db \ - guest-aux/fedora-packages.db - TMPDIR=$(top_builddir) \ - SRCDIR=$(srcdir) \ - LAYOUT=partitions-md \ - ../run $< - -guest-aux/fedora-name.db: guest-aux/fedora-name.db.txt - rm -f $@ $@-t - mkdir -p guest-aux - $(DB_LOAD) $@-t < $< - mv $@-t $@ - -guest-aux/fedora-packages.db: guest-aux/fedora-packages.db.txt - rm -f $@ $@-t - mkdir -p guest-aux - $(DB_LOAD) $@-t < $< - mv $@-t $@ - -# Make a (dummy) Debian image. -debian.img: guest-aux/make-debian-img.sh - TMPDIR=$(top_builddir) \ - SRCDIR=$(srcdir) \ - bash $< - -# Make a (dummy) Ubuntu image. -ubuntu.img: guest-aux/make-ubuntu-img.sh - TMPDIR=$(top_builddir) \ - SRCDIR=$(srcdir) \ - bash $< - -# Make a (dummy) Windows image. -windows.img: guest-aux/make-windows-img.sh \ - guest-aux/windows-software guest-aux/windows-system - TMPDIR=$(top_builddir) \ - SRCDIR=$(srcdir) \ - bash $< - -# Since users might not have the tools needed to create this, we -# also distribute these files. -guest-aux/windows-software: guest-aux/windows-software.reg - rm -f $@ $@-t - cp guest-aux/minimal-hive $@-t - hivexregedit --merge $@-t --prefix 'HKEY_LOCAL_MACHINE\SOFTWARE' $< - mv $@-t $@ - -guest-aux/windows-system: guest-aux/windows-system.reg - rm -f $@ $@-t - cp guest-aux/minimal-hive $@-t - hivexregedit --merge $@-t --prefix 'HKEY_LOCAL_MACHINE\SYSTEM' $< - mv $@-t $@ diff --git a/images/README-binfiles b/images/README-binfiles deleted file mode 100644 index f99fc847..00000000 --- a/images/README-binfiles +++ /dev/null @@ -1,13 +0,0 @@ -The bin-* and lib-* files are used for testing the -Sys::Guestfs::Lib::file_architecture API. - -The bin-* files are generated from empty source files (ie. -"main(){}") on the respective architectures. - -The lib-* files are generated from a (really) empty source file called -lib.c which is linked into a library using gcc -shared on the -respective architectures. - -If you are concerned that these binary files "lack source" then you -can just remove them, but you may need to patch out tests in the perl/ -directory. diff --git a/images/bin-i586-dynamic b/images/bin-i586-dynamic deleted file mode 100755 index 4f770633..00000000 Binary files a/images/bin-i586-dynamic and /dev/null differ diff --git a/images/bin-sparc-dynamic b/images/bin-sparc-dynamic deleted file mode 100755 index 138839af..00000000 Binary files a/images/bin-sparc-dynamic and /dev/null differ diff --git a/images/bin-win32.exe b/images/bin-win32.exe deleted file mode 100755 index db6d5758..00000000 Binary files a/images/bin-win32.exe and /dev/null differ diff --git a/images/bin-win64.exe b/images/bin-win64.exe deleted file mode 100755 index 98bddc02..00000000 Binary files a/images/bin-win64.exe and /dev/null differ diff --git a/images/bin-x86_64-dynamic b/images/bin-x86_64-dynamic deleted file mode 100755 index 033ac759..00000000 Binary files a/images/bin-x86_64-dynamic and /dev/null differ diff --git a/images/empty b/images/empty deleted file mode 100644 index e69de29b..00000000 diff --git a/images/guest-aux/debian-packages b/images/guest-aux/debian-packages deleted file mode 100644 index 38afc975..00000000 --- a/images/guest-aux/debian-packages +++ /dev/null @@ -1,48 +0,0 @@ -Package: test1 -Status: installed ok -Priority: optional -Section: libs -Installed-Size: 123 -Architecture: amd64 -Source: test -Version: 1.2.3-1 -Config-Version: 1.2.3-1 -Depends: libc6 (>= 2.3) -Description: this is a test package - This is a test package. - . - Don't confuse it with a real package. -Homepage: http://libguestfs.org/ - -Package: test2 -Status: installed ok -Priority: optional -Section: libs -Installed-Size: 123 -Architecture: amd64 -Source: test -Version: 1.2.3-1 -Config-Version: 1.2.3-1 -Depends: libc6 (>= 2.3) -Description: this is a test package - This is a test package. - . - Don't confuse it with a real package. -Homepage: http://libguestfs.org/ - -Package: test3 -Status: installed ok -Priority: optional -Section: libs -Installed-Size: 123 -Architecture: amd64 -Source: test -Version: 1.2.3-1 -Config-Version: 1.2.3-1 -Depends: libc6 (>= 2.3) -Description: this is a test package - This is a test package. - . - Don't confuse it with a real package. -Homepage: http://libguestfs.org/ - diff --git a/images/guest-aux/fedora-name.db.txt b/images/guest-aux/fedora-name.db.txt deleted file mode 100644 index 105b0fec..00000000 --- a/images/guest-aux/fedora-name.db.txt +++ /dev/null @@ -1,13 +0,0 @@ -VERSION=3 -format=print -type=hash -h_nelem=3 -db_pagesize=4096 -HEADER=END - test1 - !\0b\00\00\00\00\00\00 - test2 - 7\0b\00\00\00\00\00\00 - test3 - \dd\0c\00\00\00\00\00\00 -DATA=END diff --git a/images/guest-aux/fedora-packages.db.txt b/images/guest-aux/fedora-packages.db.txt deleted file mode 100644 index 3939d6bd..00000000 --- a/images/guest-aux/fedora-packages.db.txt +++ /dev/null @@ -1,13 +0,0 @@ -VERSION=3 -format=print -type=hash -h_nelem=3 -db_pagesize=4096 -HEADER=END - !\0b\00\00 - \00test1\001.0\001.fc14\00 - 7\0b\00\00 - \00test2\002.0\002.fc14\00 - \dd\0c\00\00 - \00test3\003.0\003.fc14\00 -DATA=END diff --git a/images/guest-aux/make-debian-img.sh b/images/guest-aux/make-debian-img.sh deleted file mode 100755 index ade23311..00000000 --- a/images/guest-aux/make-debian-img.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/bash - -# libguestfs -# Copyright (C) 2010 Red Hat Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -# Make a Debian image which is enough to fool the inspection heuristics. - -export LANG=C -set -e - -# fstab file. -cat > fstab.tmp <new(); - -my $bootdev; -my $rootdev; - -foreach ('LAYOUT', 'SRCDIR') { - defined($ENV{$_}) or die "Missing environment variable: $_"; -} - -if ($ENV{LAYOUT} eq 'partitions') { - push (@images, 'fedora.img.tmp'); - - open(my $fstab, '>', 'fstab.tmp') or die; - print $fstab <', 'fedora.img.tmp') or die; - truncate($img, 512*1024*1024) or die; - close($img) or die; - - $g->add_drive('fedora.img.tmp'); - $g->launch(); - - $g->part_init('/dev/sda', 'mbr'); - $g->part_add('/dev/sda', 'p', 64, 524287); - $g->part_add('/dev/sda', 'p', 524288, -64); -} - -elsif ($ENV{LAYOUT} eq 'partitions-md') { - push(@images, 'fedora-md1.img.tmp', 'fedora-md2.img.tmp'); - - open(my $fstab, '>', 'fstab.tmp') or die; - print $fstab <', $img) or die; - truncate($fh, 512*1024*1024) or die; - close($fh) or die; - - $g->add_drive($img); - } - - $g->launch(); - - # Format the disks. - foreach ('a', 'b') { - $g->part_init("/dev/sd$_", 'mbr'); - $g->part_add("/dev/sd$_", 'p', 64, 524287); - $g->part_add("/dev/sd$_", 'p', 524288, -64); - } - - $g->md_create('boot', ['/dev/sda1', '/dev/sdb1']); - $g->md_create('root', ['/dev/sda2', '/dev/sdb2']); - - open(my $mdadm, '>', 'mdadm.tmp') or die; - print $mdadm <md_detail("/dev/md/$_"); - print $mdadm "ARRAY /dev/md$i level=raid1 num-devices=2 UUID=", - $detail{uuid}, "\n"; - $i++; - } - - close($mdadm) or die; -} - -else { - print STDERR "$0: Unknown LAYOUT: ",$ENV{LAYOUT},"\n"; - exit 1; -} - -$g->pvcreate($rootdev); -$g->vgcreate('VG', [$rootdev]); -$g->lvcreate('Root', 'VG', 32); -$g->lvcreate('LV1', 'VG', 32); -$g->lvcreate('LV2', 'VG', 32); -$g->lvcreate('LV3', 'VG', 64); - -# Phony /boot filesystem -$g->mkfs_opts('ext2', $bootdev, blocksize => 4096); -$g->set_e2label($bootdev, 'BOOT'); -$g->set_e2uuid($bootdev, '01234567-0123-0123-0123-012345678901'); - -# Phony root filesystem. -$g->mkfs_opts('ext2', '/dev/VG/Root', blocksize => 4096); -$g->set_e2label('/dev/VG/Root', 'ROOT'); -$g->set_e2uuid('/dev/VG/Root', '01234567-0123-0123-0123-012345678902'); - -# Enough to fool inspection API. -$g->mount_options('', '/dev/VG/Root', '/'); -$g->mkdir('/boot'); -$g->mount_options('', $bootdev, '/boot'); -$g->mkdir('/bin'); -$g->mkdir('/etc'); -$g->mkdir('/etc/sysconfig'); -$g->mkdir('/usr'); -$g->mkdir_p('/var/lib/rpm'); - -$g->upload('fstab.tmp', '/etc/fstab'); -$g->write('/etc/redhat-release', 'Fedora release 14 (Phony)'); -$g->write('/etc/fedora-release', 'Fedora release 14 (Phony)'); -$g->write('/etc/sysconfig/network', 'HOSTNAME=fedora.invalid'); - -if (-f 'mdadm.tmp') { - $g->upload('mdadm.tmp', '/etc/mdadm.conf'); - unlink('mdadm.tmp') or die; -} - -$g->upload('guest-aux/fedora-name.db', '/var/lib/rpm/Name'); -$g->upload('guest-aux/fedora-packages.db', '/var/lib/rpm/Packages'); - -$g->upload($ENV{SRCDIR}.'/bin-x86_64-dynamic', '/bin/ls'); - -$g->mkdir('/boot/grub'); -$g->touch('/boot/grub/grub.conf'); - -# Test files. -$g->write('/etc/test1', 'abcdefg'); -$g->write('/etc/test2', ''); -$g->write('/etc/test3', -'a -b -c -d -e -f -'); -$g->write('/bin/test1', 'abcdefg'); -$g->write('/bin/test2', 'zxcvbnm'); -$g->write('/bin/test3', '1234567'); -$g->write('/bin/test4', ''); -$g->ln_s('/bin/test1', '/bin/test5'); -$g->mkfifo(0777, '/bin/test6'); -$g->mknod(0777, 10, 10, '/bin/test7'); - -# Other filesystems. -# Note that these should be empty, for testing virt-df. -$g->mkfs_opts('ext2', '/dev/VG/LV1', blocksize => 4096); -$g->mkfs_opts('ext2', '/dev/VG/LV2', blocksize => 1024); -$g->mkfs_opts('ext2', '/dev/VG/LV3', blocksize => 2048); - -# Cleanup -unlink('fstab.tmp') or die; -foreach my $img (@images) { - $img =~ /^(.*)\.tmp$/ or die; - rename($img, $1) or die; -} diff --git a/images/guest-aux/make-ubuntu-img.sh b/images/guest-aux/make-ubuntu-img.sh deleted file mode 100755 index 0c4d60a1..00000000 --- a/images/guest-aux/make-ubuntu-img.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash - -# libguestfs -# Copyright (C) 2010 Red Hat Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -# Make an Ubuntu image which is enough to fool the inspection heuristics. - -export LANG=C -set -e - -# fstab file. -cat > fstab.tmp < release.tmp <<'EOF' -DISTRIB_ID=Ubuntu -DISTRIB_RELEASE=10.10 -DISTRIB_CODENAME=maverick -DISTRIB_DESCRIPTION="Ubuntu 10.10 (Phony Pharaoh)" -EOF - -# Create a disk image. -../run ../fish/guestfish < $@-t + ../run $(builddir)/virt-inspector ../tests/guests/debian.img > $@-t mv $@-t $@ example-fedora.xml: rm -f $@ $@-t - ../run $(builddir)/virt-inspector ../images/fedora.img > $@-t + ../run $(builddir)/virt-inspector ../tests/guests/fedora.img > $@-t mv $@-t $@ example-ubuntu.xml: rm -f $@ $@-t - ../run $(builddir)/virt-inspector ../images/ubuntu.img > $@-t + ../run $(builddir)/virt-inspector ../tests/guests/ubuntu.img > $@-t mv $@-t $@ example-windows.xml: rm -f $@ $@-t - ../run $(builddir)/virt-inspector ../images/windows.img | \ + ../run $(builddir)/virt-inspector ../tests/guests/windows.img | \ fgrep -v '' > $@-t mv $@-t $@ diff --git a/perl/Makefile.am b/perl/Makefile.am index eff00596..e924cb1d 100644 --- a/perl/Makefile.am +++ b/perl/Makefile.am @@ -46,7 +46,7 @@ src_deps: $(top_builddir)/src/libguestfs.la $(generator_built) # Images used by tests .PHONY: test_images test_images: - $(MAKE) -C $(top_builddir)/images + $(MAKE) -C $(top_builddir)/tests/data TESTS = run-bindtests run-perl-tests diff --git a/po/POTFILES.in b/po/POTFILES.in index 9a18eadd..380a3c7d 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -137,10 +137,6 @@ perl/lib/Sys/Guestfs/Lib.pm php/extension/guestfs_php.c python/guestfs-py-byhand.c python/guestfs-py.c -regressions/rhbz501893.c -regressions/test-launch-race.pl -regressions/test-lvm-mapping.pl -regressions/test-noexec-stack.pl rescue/virt-rescue.c resize/progress_c.c ruby/ext/guestfs/_guestfs.c diff --git a/src/guestfs.pod b/src/guestfs.pod index 3bad6e63..f7740b6b 100644 --- a/src/guestfs.pod +++ b/src/guestfs.pod @@ -2964,12 +2964,6 @@ L, FUSE (userspace filesystem) built on top of libguestfs. The crucially important generator, used to automatically generate large amounts of boilerplate C code for things like RPC and bindings. -=item C - -Files used by the test suite. - -Some "phony" guest images which we test against. - =item C L, the virtual machine image inspector. diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am new file mode 100644 index 00000000..43f40a19 --- /dev/null +++ b/tests/data/Makefile.am @@ -0,0 +1,152 @@ +# libguestfs test images +# Copyright (C) 2009-2010 Red Hat Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +include $(top_srcdir)/subdir-rules.mk + +# Old RHEL 5 autoconf doesn't have builddir. +builddir ?= $(top_builddir)/tests/data + +EXTRA_DIST = \ + helloworld.tar \ + helloworld.tar.gz \ + helloworld.tar.xz \ + mbr-ext2-empty.img.gz \ + empty known-1 known-2 known-3 known-4 known-5 \ + bin-i586-dynamic \ + bin-sparc-dynamic \ + bin-win32.exe \ + bin-win64.exe \ + bin-x86_64-dynamic \ + lib-i586.so \ + lib-sparc.so \ + lib-win32.dll \ + lib-win64.dll \ + lib-x86_64.so \ + test-grep.txt + +noinst_DATA = test.iso + +CLEANFILES = \ + test.iso test.sqsh \ + 100kallzeroes 100kallnewlines 100kallspaces 100krandom 10klines \ + initrd + +images_files_src = \ + $(srcdir)/helloworld.tar \ + $(srcdir)/helloworld.tar.gz \ + $(srcdir)/helloworld.tar.xz \ + $(srcdir)/empty \ + $(srcdir)/known-1 \ + $(srcdir)/known-2 \ + $(srcdir)/known-3 \ + $(srcdir)/known-4 \ + $(srcdir)/known-5 \ + $(srcdir)/bin-i586-dynamic \ + $(srcdir)/bin-sparc-dynamic \ + $(srcdir)/bin-win32.exe \ + $(srcdir)/bin-win64.exe \ + $(srcdir)/bin-x86_64-dynamic \ + $(srcdir)/lib-i586.so \ + $(srcdir)/lib-sparc.so \ + $(srcdir)/lib-win32.dll \ + $(srcdir)/lib-win64.dll \ + $(srcdir)/lib-x86_64.so \ + $(srcdir)/test-grep.txt + +images_files_build = \ + $(builddir)/100kallzeroes \ + $(builddir)/100kallnewlines \ + $(builddir)/100kallspaces \ + $(builddir)/100krandom \ + $(builddir)/10klines \ + $(builddir)/abssymlink \ + $(builddir)/hello.b64 \ + $(builddir)/initrd \ + $(builddir)/initrd-x86_64.img \ + $(builddir)/initrd-x86_64.img.gz \ + $(builddir)/test-grep.txt.gz + +images_files = $(images_files_src) $(images_files_build) + +test.iso: $(images_files) + rm -f $@ $@-t + mkdir -p directory + $(GENISOIMAGE) -J -r -graft-points \ + -o $@-t \ + $(images_files) /directory=directory + rmdir directory + mv $@-t $@ + +$(builddir)/100kallzeroes: + rm -f $@ $@-t + dd if=/dev/zero of=$@-t bs=1024 count=100 + mv $@-t $@ + +$(builddir)/100kallnewlines: $(builddir)/100kallzeroes + rm -f $@ $@-t + tr '\0' '\n' < $< > $@-t + mv $@-t $@ + +$(builddir)/100kallspaces: $(builddir)/100kallzeroes + rm -f $@ $@-t + tr '\0' ' ' < $< > $@-t + mv $@-t $@ + +$(builddir)/100krandom: + rm -f $@ $@-t + dd if=/dev/urandom of=$@-t bs=1024 count=100 + mv $@-t $@ + +$(builddir)/10klines: + rm -f $@ $@-t + i=0; \ + while [ $$i -lt 10000 ]; do \ + echo "$${i}abcdefghijklmnopqrstuvwxyz"; \ + i=$$(($$i+1)); \ + done > $@-t + mv $@-t $@ + +$(builddir)/abssymlink: + ln -sf /10klines $@ + +$(builddir)/hello.b64: + echo "hello" | base64 > $@ + +$(builddir)/initrd: empty known-1 known-2 known-3 known-4 known-5 + rm -f $@ $@-t + for f in $^; do echo $$f; done | cpio -o -H newc | gzip --best > $@-t + mv $@-t $@ + +# Create a dummy initrd with a single file called 'bin/nash' which +# is used to test the Sys::Guestfs::Lib::file_architecture function. +$(builddir)/initrd-x86_64.img: bin-x86_64-dynamic + rm -rf bin $@ $@-t + mkdir bin + cp $< bin/nash + echo bin/nash | cpio -o -H newc > $@-t + mv $@-t $@ + rm -rf bin $@-t + +$(builddir)/initrd-x86_64.img.gz: initrd-x86_64.img + rm -f $@ $@-t + gzip --best -c $< > $@-t + mv $@-t $@ + +$(builddir)/test-grep.txt.gz: test-grep.txt + rm -f $@ $@-t + gzip --best -c $< > $@-t + mv $@-t $@ diff --git a/tests/data/README-binfiles b/tests/data/README-binfiles new file mode 100644 index 00000000..f99fc847 --- /dev/null +++ b/tests/data/README-binfiles @@ -0,0 +1,13 @@ +The bin-* and lib-* files are used for testing the +Sys::Guestfs::Lib::file_architecture API. + +The bin-* files are generated from empty source files (ie. +"main(){}") on the respective architectures. + +The lib-* files are generated from a (really) empty source file called +lib.c which is linked into a library using gcc -shared on the +respective architectures. + +If you are concerned that these binary files "lack source" then you +can just remove them, but you may need to patch out tests in the perl/ +directory. diff --git a/tests/data/bin-i586-dynamic b/tests/data/bin-i586-dynamic new file mode 100755 index 00000000..4f770633 Binary files /dev/null and b/tests/data/bin-i586-dynamic differ diff --git a/tests/data/bin-sparc-dynamic b/tests/data/bin-sparc-dynamic new file mode 100755 index 00000000..138839af Binary files /dev/null and b/tests/data/bin-sparc-dynamic differ diff --git a/tests/data/bin-win32.exe b/tests/data/bin-win32.exe new file mode 100755 index 00000000..db6d5758 Binary files /dev/null and b/tests/data/bin-win32.exe differ diff --git a/tests/data/bin-win64.exe b/tests/data/bin-win64.exe new file mode 100755 index 00000000..98bddc02 Binary files /dev/null and b/tests/data/bin-win64.exe differ diff --git a/tests/data/bin-x86_64-dynamic b/tests/data/bin-x86_64-dynamic new file mode 100755 index 00000000..033ac759 Binary files /dev/null and b/tests/data/bin-x86_64-dynamic differ diff --git a/tests/data/empty b/tests/data/empty new file mode 100644 index 00000000..e69de29b diff --git a/tests/data/helloworld.tar b/tests/data/helloworld.tar new file mode 100644 index 00000000..191a31b2 Binary files /dev/null and b/tests/data/helloworld.tar differ diff --git a/tests/data/helloworld.tar.gz b/tests/data/helloworld.tar.gz new file mode 100644 index 00000000..9d36cc97 Binary files /dev/null and b/tests/data/helloworld.tar.gz differ diff --git a/tests/data/helloworld.tar.xz b/tests/data/helloworld.tar.xz new file mode 100644 index 00000000..661f1a20 Binary files /dev/null and b/tests/data/helloworld.tar.xz differ diff --git a/tests/data/known-1 b/tests/data/known-1 new file mode 100644 index 00000000..8baef1b4 --- /dev/null +++ b/tests/data/known-1 @@ -0,0 +1 @@ +abc diff --git a/tests/data/known-2 b/tests/data/known-2 new file mode 100644 index 00000000..0373d933 --- /dev/null +++ b/tests/data/known-2 @@ -0,0 +1 @@ +abcdef diff --git a/tests/data/known-3 b/tests/data/known-3 new file mode 100644 index 00000000..3ac370d7 --- /dev/null +++ b/tests/data/known-3 @@ -0,0 +1,27 @@ + I WANDERED lonely as a cloud + That floats on high o'er vales and hills, + When all at once I saw a crowd, + A host, of golden daffodils; + Beside the lake, beneath the trees, + Fluttering and dancing in the breeze. + + Continuous as the stars that shine + And twinkle on the milky way, + They stretched in never-ending line + Along the margin of a bay: + Ten thousand saw I at a glance, + Tossing their heads in sprightly dance. + + The waves beside them danced; but they + Out-did the sparkling waves in glee: + A poet could not but be gay, + In such a jocund company: + I gazed--and gazed--but little thought + What wealth the show to me had brought: + + For oft, when on my couch I lie + In vacant or in pensive mood, + They flash upon that inward eye + Which is the bliss of solitude; + And then my heart with pleasure fills, + And dances with the daffodils. diff --git a/tests/data/known-4 b/tests/data/known-4 new file mode 100644 index 00000000..f5bc74f6 --- /dev/null +++ b/tests/data/known-4 @@ -0,0 +1,3 @@ +abc +def +ghi \ No newline at end of file diff --git a/tests/data/known-5 b/tests/data/known-5 new file mode 100644 index 00000000..3122d943 --- /dev/null +++ b/tests/data/known-5 @@ -0,0 +1,2 @@ +abcdefghi +jklmnopqr \ No newline at end of file diff --git a/tests/data/lib-i586.so b/tests/data/lib-i586.so new file mode 100755 index 00000000..e82023a1 Binary files /dev/null and b/tests/data/lib-i586.so differ diff --git a/tests/data/lib-sparc.so b/tests/data/lib-sparc.so new file mode 100755 index 00000000..7feec75e Binary files /dev/null and b/tests/data/lib-sparc.so differ diff --git a/tests/data/lib-win32.dll b/tests/data/lib-win32.dll new file mode 100755 index 00000000..e1a2d2e6 Binary files /dev/null and b/tests/data/lib-win32.dll differ diff --git a/tests/data/lib-win64.dll b/tests/data/lib-win64.dll new file mode 100755 index 00000000..ca94485c Binary files /dev/null and b/tests/data/lib-win64.dll differ diff --git a/tests/data/lib-x86_64.so b/tests/data/lib-x86_64.so new file mode 100755 index 00000000..8cee4d20 Binary files /dev/null and b/tests/data/lib-x86_64.so differ diff --git a/tests/data/mbr-ext2-empty.img.gz b/tests/data/mbr-ext2-empty.img.gz new file mode 100644 index 00000000..5438c1dd Binary files /dev/null and b/tests/data/mbr-ext2-empty.img.gz differ diff --git a/tests/data/test-grep.txt b/tests/data/test-grep.txt new file mode 100644 index 00000000..1d24b9a0 --- /dev/null +++ b/tests/data/test-grep.txt @@ -0,0 +1,7 @@ +abc +def +ghi +ghi + +abc123 +ABC diff --git a/tests/extra/Makefile.am b/tests/extra/Makefile.am index 7d1cc22e..582fa555 100644 --- a/tests/extra/Makefile.am +++ b/tests/extra/Makefile.am @@ -104,22 +104,22 @@ test-tools-null: # Invocations of tools on internal images shouldn't leak memory. test-tools-internal: - $(RUN_VG) ../../cat/virt-cat -a ../images/fedora.img /etc/fstab >/dev/null - $(RUN_VG) ../../cat/virt-filesystems -a ../images/fedora.img >/dev/null - $(RUN_VG) ../../cat/virt-filesystems -a ../images/fedora.img --all --long -h --uuid >/dev/null - $(RUN_VG) ../../cat/virt-ls -a ../images/fedora.img / >/dev/null - $(RUN_VG) ../../cat/virt-ls -a ../images/fedora.img -l / >/dev/null - $(RUN_VG) ../../cat/virt-ls -a ../images/fedora.img -R / >/dev/null - $(RUN_VG) ../../cat/virt-ls -a ../images/fedora.img -lR / >/dev/null - $(RUN_VG) ../../df/virt-df -a ../images/fedora.img >/dev/null - $(RUN_VG) ../../df/virt-df -a ../images/fedora.img -h >/dev/null - $(RUN_VG) ../../fish/guestfish -a ../images/fedora.img run - $(RUN_VG) ../../fish/guestfish -a ../images/fedora.img -i exit - $(RUN_VG) ../../inspector/virt-inspector -a ../images/debian.img >/dev/null - $(RUN_VG) ../../inspector/virt-inspector -a ../images/fedora.img >/dev/null - $(RUN_VG) ../../inspector/virt-inspector -a ../images/fedora-md1.img -a ../images/fedora-md2.img >/dev/null - $(RUN_VG) ../../inspector/virt-inspector -a ../images/ubuntu.img >/dev/null - $(RUN_VG) ../../inspector/virt-inspector -a ../images/windows.img >/dev/null + $(RUN_VG) ../../cat/virt-cat -a ../guests/fedora.img /etc/fstab >/dev/null + $(RUN_VG) ../../cat/virt-filesystems -a ../guests/fedora.img >/dev/null + $(RUN_VG) ../../cat/virt-filesystems -a ../guests/fedora.img --all --long -h --uuid >/dev/null + $(RUN_VG) ../../cat/virt-ls -a ../guests/fedora.img / >/dev/null + $(RUN_VG) ../../cat/virt-ls -a ../guests/fedora.img -l / >/dev/null + $(RUN_VG) ../../cat/virt-ls -a ../guests/fedora.img -R / >/dev/null + $(RUN_VG) ../../cat/virt-ls -a ../guests/fedora.img -lR / >/dev/null + $(RUN_VG) ../../df/virt-df -a ../guests/fedora.img >/dev/null + $(RUN_VG) ../../df/virt-df -a ../guests/fedora.img -h >/dev/null + $(RUN_VG) ../../fish/guestfish -a ../guests/fedora.img run + $(RUN_VG) ../../fish/guestfish -a ../guests/fedora.img -i exit + $(RUN_VG) ../../inspector/virt-inspector -a ../guests/debian.img >/dev/null + $(RUN_VG) ../../inspector/virt-inspector -a ../guests/fedora.img >/dev/null + $(RUN_VG) ../../inspector/virt-inspector -a ../guests/fedora-md1.img -a ../guests/fedora-md2.img >/dev/null + $(RUN_VG) ../../inspector/virt-inspector -a ../guests/ubuntu.img >/dev/null + $(RUN_VG) ../../inspector/virt-inspector -a ../guests/windows.img >/dev/null # Invocations of tools on real images shouldn't leak memory. test-df-real: diff --git a/tests/guests/Makefile.am b/tests/guests/Makefile.am new file mode 100644 index 00000000..ee28034a --- /dev/null +++ b/tests/guests/Makefile.am @@ -0,0 +1,106 @@ +# libguestfs test images +# Copyright (C) 2009-2010 Red Hat Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +include $(top_srcdir)/subdir-rules.mk + +# Old RHEL 5 autoconf doesn't have builddir. +builddir ?= $(top_builddir)/tests/guests + +EXTRA_DIST = \ + guest-aux/make-debian-img.sh \ + guest-aux/debian-packages \ + guest-aux/make-fedora-img.pl \ + guest-aux/fedora-name.db.txt \ + guest-aux/fedora-name.db \ + guest-aux/fedora-packages.db.txt \ + guest-aux/fedora-packages.db \ + guest-aux/make-ubuntu-img.sh \ + guest-aux/make-windows-img.sh \ + guest-aux/windows-software \ + guest-aux/windows-software.reg \ + guest-aux/windows-system \ + guest-aux/windows-system.reg \ + guest-aux/minimal-hive + +# This is 'check_DATA' because we don't need it until 'make check' +# time and we need the tools we have built in order to make it. +check_DATA = debian.img fedora.img fedora-md1.img fedora-md2.img ubuntu.img windows.img + +CLEANFILES = $(check_DATA) + +# Make a (dummy) Fedora image. +fedora.img: guest-aux/make-fedora-img.pl \ + guest-aux/fedora-name.db \ + guest-aux/fedora-packages.db + TMPDIR=$(top_builddir) \ + SRCDIR=$(srcdir) \ + LAYOUT=partitions \ + ../../run $< + +# Make a (dummy) Fedora image using md devices +fedora-md1.img fedora-md2.img: guest-aux/make-fedora-img.pl \ + guest-aux/fedora-name.db \ + guest-aux/fedora-packages.db + TMPDIR=$(top_builddir) \ + SRCDIR=$(srcdir) \ + LAYOUT=partitions-md \ + ../../run $< + +guest-aux/fedora-name.db: guest-aux/fedora-name.db.txt + rm -f $@ $@-t + mkdir -p guest-aux + $(DB_LOAD) $@-t < $< + mv $@-t $@ + +guest-aux/fedora-packages.db: guest-aux/fedora-packages.db.txt + rm -f $@ $@-t + mkdir -p guest-aux + $(DB_LOAD) $@-t < $< + mv $@-t $@ + +# Make a (dummy) Debian image. +debian.img: guest-aux/make-debian-img.sh + TMPDIR=$(top_builddir) \ + SRCDIR=$(srcdir) \ + bash $< + +# Make a (dummy) Ubuntu image. +ubuntu.img: guest-aux/make-ubuntu-img.sh + TMPDIR=$(top_builddir) \ + SRCDIR=$(srcdir) \ + bash $< + +# Make a (dummy) Windows image. +windows.img: guest-aux/make-windows-img.sh \ + guest-aux/windows-software guest-aux/windows-system + TMPDIR=$(top_builddir) \ + SRCDIR=$(srcdir) \ + bash $< + +# Since users might not have the tools needed to create this, we +# also distribute these files. +guest-aux/windows-software: guest-aux/windows-software.reg + rm -f $@ $@-t + cp guest-aux/minimal-hive $@-t + hivexregedit --merge $@-t --prefix 'HKEY_LOCAL_MACHINE\SOFTWARE' $< + mv $@-t $@ + +guest-aux/windows-system: guest-aux/windows-system.reg + rm -f $@ $@-t + cp guest-aux/minimal-hive $@-t + hivexregedit --merge $@-t --prefix 'HKEY_LOCAL_MACHINE\SYSTEM' $< + mv $@-t $@ diff --git a/tests/guests/guest-aux/debian-packages b/tests/guests/guest-aux/debian-packages new file mode 100644 index 00000000..38afc975 --- /dev/null +++ b/tests/guests/guest-aux/debian-packages @@ -0,0 +1,48 @@ +Package: test1 +Status: installed ok +Priority: optional +Section: libs +Installed-Size: 123 +Architecture: amd64 +Source: test +Version: 1.2.3-1 +Config-Version: 1.2.3-1 +Depends: libc6 (>= 2.3) +Description: this is a test package + This is a test package. + . + Don't confuse it with a real package. +Homepage: http://libguestfs.org/ + +Package: test2 +Status: installed ok +Priority: optional +Section: libs +Installed-Size: 123 +Architecture: amd64 +Source: test +Version: 1.2.3-1 +Config-Version: 1.2.3-1 +Depends: libc6 (>= 2.3) +Description: this is a test package + This is a test package. + . + Don't confuse it with a real package. +Homepage: http://libguestfs.org/ + +Package: test3 +Status: installed ok +Priority: optional +Section: libs +Installed-Size: 123 +Architecture: amd64 +Source: test +Version: 1.2.3-1 +Config-Version: 1.2.3-1 +Depends: libc6 (>= 2.3) +Description: this is a test package + This is a test package. + . + Don't confuse it with a real package. +Homepage: http://libguestfs.org/ + diff --git a/tests/guests/guest-aux/fedora-name.db.txt b/tests/guests/guest-aux/fedora-name.db.txt new file mode 100644 index 00000000..105b0fec --- /dev/null +++ b/tests/guests/guest-aux/fedora-name.db.txt @@ -0,0 +1,13 @@ +VERSION=3 +format=print +type=hash +h_nelem=3 +db_pagesize=4096 +HEADER=END + test1 + !\0b\00\00\00\00\00\00 + test2 + 7\0b\00\00\00\00\00\00 + test3 + \dd\0c\00\00\00\00\00\00 +DATA=END diff --git a/tests/guests/guest-aux/fedora-packages.db.txt b/tests/guests/guest-aux/fedora-packages.db.txt new file mode 100644 index 00000000..3939d6bd --- /dev/null +++ b/tests/guests/guest-aux/fedora-packages.db.txt @@ -0,0 +1,13 @@ +VERSION=3 +format=print +type=hash +h_nelem=3 +db_pagesize=4096 +HEADER=END + !\0b\00\00 + \00test1\001.0\001.fc14\00 + 7\0b\00\00 + \00test2\002.0\002.fc14\00 + \dd\0c\00\00 + \00test3\003.0\003.fc14\00 +DATA=END diff --git a/tests/guests/guest-aux/make-debian-img.sh b/tests/guests/guest-aux/make-debian-img.sh new file mode 100755 index 00000000..b936f817 --- /dev/null +++ b/tests/guests/guest-aux/make-debian-img.sh @@ -0,0 +1,92 @@ +#!/bin/bash - +# libguestfs +# Copyright (C) 2010 Red Hat Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +# Make a Debian image which is enough to fool the inspection heuristics. + +export LANG=C +set -e + +# fstab file. +cat > fstab.tmp <new(); + +my $bootdev; +my $rootdev; + +foreach ('LAYOUT', 'SRCDIR') { + defined($ENV{$_}) or die "Missing environment variable: $_"; +} + +if ($ENV{LAYOUT} eq 'partitions') { + push (@images, 'fedora.img.tmp'); + + open(my $fstab, '>', 'fstab.tmp') or die; + print $fstab <', 'fedora.img.tmp') or die; + truncate($img, 512*1024*1024) or die; + close($img) or die; + + $g->add_drive('fedora.img.tmp'); + $g->launch(); + + $g->part_init('/dev/sda', 'mbr'); + $g->part_add('/dev/sda', 'p', 64, 524287); + $g->part_add('/dev/sda', 'p', 524288, -64); +} + +elsif ($ENV{LAYOUT} eq 'partitions-md') { + push(@images, 'fedora-md1.img.tmp', 'fedora-md2.img.tmp'); + + open(my $fstab, '>', 'fstab.tmp') or die; + print $fstab <', $img) or die; + truncate($fh, 512*1024*1024) or die; + close($fh) or die; + + $g->add_drive($img); + } + + $g->launch(); + + # Format the disks. + foreach ('a', 'b') { + $g->part_init("/dev/sd$_", 'mbr'); + $g->part_add("/dev/sd$_", 'p', 64, 524287); + $g->part_add("/dev/sd$_", 'p', 524288, -64); + } + + $g->md_create('boot', ['/dev/sda1', '/dev/sdb1']); + $g->md_create('root', ['/dev/sda2', '/dev/sdb2']); + + open(my $mdadm, '>', 'mdadm.tmp') or die; + print $mdadm <md_detail("/dev/md/$_"); + print $mdadm "ARRAY /dev/md$i level=raid1 num-devices=2 UUID=", + $detail{uuid}, "\n"; + $i++; + } + + close($mdadm) or die; +} + +else { + print STDERR "$0: Unknown LAYOUT: ",$ENV{LAYOUT},"\n"; + exit 1; +} + +$g->pvcreate($rootdev); +$g->vgcreate('VG', [$rootdev]); +$g->lvcreate('Root', 'VG', 32); +$g->lvcreate('LV1', 'VG', 32); +$g->lvcreate('LV2', 'VG', 32); +$g->lvcreate('LV3', 'VG', 64); + +# Phony /boot filesystem +$g->mkfs_opts('ext2', $bootdev, blocksize => 4096); +$g->set_e2label($bootdev, 'BOOT'); +$g->set_e2uuid($bootdev, '01234567-0123-0123-0123-012345678901'); + +# Phony root filesystem. +$g->mkfs_opts('ext2', '/dev/VG/Root', blocksize => 4096); +$g->set_e2label('/dev/VG/Root', 'ROOT'); +$g->set_e2uuid('/dev/VG/Root', '01234567-0123-0123-0123-012345678902'); + +# Enough to fool inspection API. +$g->mount_options('', '/dev/VG/Root', '/'); +$g->mkdir('/boot'); +$g->mount_options('', $bootdev, '/boot'); +$g->mkdir('/bin'); +$g->mkdir('/etc'); +$g->mkdir('/etc/sysconfig'); +$g->mkdir('/usr'); +$g->mkdir_p('/var/lib/rpm'); + +$g->upload('fstab.tmp', '/etc/fstab'); +$g->write('/etc/redhat-release', 'Fedora release 14 (Phony)'); +$g->write('/etc/fedora-release', 'Fedora release 14 (Phony)'); +$g->write('/etc/sysconfig/network', 'HOSTNAME=fedora.invalid'); + +if (-f 'mdadm.tmp') { + $g->upload('mdadm.tmp', '/etc/mdadm.conf'); + unlink('mdadm.tmp') or die; +} + +$g->upload('guest-aux/fedora-name.db', '/var/lib/rpm/Name'); +$g->upload('guest-aux/fedora-packages.db', '/var/lib/rpm/Packages'); + +$g->upload($ENV{SRCDIR}.'/../data/bin-x86_64-dynamic', '/bin/ls'); + +$g->mkdir('/boot/grub'); +$g->touch('/boot/grub/grub.conf'); + +# Test files. +$g->write('/etc/test1', 'abcdefg'); +$g->write('/etc/test2', ''); +$g->write('/etc/test3', +'a +b +c +d +e +f +'); +$g->write('/bin/test1', 'abcdefg'); +$g->write('/bin/test2', 'zxcvbnm'); +$g->write('/bin/test3', '1234567'); +$g->write('/bin/test4', ''); +$g->ln_s('/bin/test1', '/bin/test5'); +$g->mkfifo(0777, '/bin/test6'); +$g->mknod(0777, 10, 10, '/bin/test7'); + +# Other filesystems. +# Note that these should be empty, for testing virt-df. +$g->mkfs_opts('ext2', '/dev/VG/LV1', blocksize => 4096); +$g->mkfs_opts('ext2', '/dev/VG/LV2', blocksize => 1024); +$g->mkfs_opts('ext2', '/dev/VG/LV3', blocksize => 2048); + +# Cleanup +unlink('fstab.tmp') or die; +foreach my $img (@images) { + $img =~ /^(.*)\.tmp$/ or die; + rename($img, $1) or die; +} diff --git a/tests/guests/guest-aux/make-ubuntu-img.sh b/tests/guests/guest-aux/make-ubuntu-img.sh new file mode 100755 index 00000000..e55c7908 --- /dev/null +++ b/tests/guests/guest-aux/make-ubuntu-img.sh @@ -0,0 +1,81 @@ +#!/bin/bash - +# libguestfs +# Copyright (C) 2010 Red Hat Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +# Make an Ubuntu image which is enough to fool the inspection heuristics. + +export LANG=C +set -e + +# fstab file. +cat > fstab.tmp < release.tmp <<'EOF' +DISTRIB_ID=Ubuntu +DISTRIB_RELEASE=10.10 +DISTRIB_CODENAME=maverick +DISTRIB_DESCRIPTION="Ubuntu 10.10 (Phony Pharaoh)" +EOF + +# Create a disk image. +../../run ../../fish/guestfish < test.output exists /boot/grub/grub.conf diff --git a/tests/md/test-inspect-fstab.sh b/tests/md/test-inspect-fstab.sh index 72a11fad..576ce031 100755 --- a/tests/md/test-inspect-fstab.sh +++ b/tests/md/test-inspect-fstab.sh @@ -28,7 +28,7 @@ rm -f test1.img test.fstab test.output # Start with the regular (good) fedora image, modify /etc/fstab # and then inspect it. -cp ../../images/fedora.img test1.img +cp ../guests/fedora.img test1.img cat <<'EOF' > test.fstab /dev/VG/Root / ext2 default 0 0 diff --git a/tools/test-virt-list-filesystems.sh b/tools/test-virt-list-filesystems.sh index bd4e4e70..210ea131 100755 --- a/tools/test-virt-list-filesystems.sh +++ b/tools/test-virt-list-filesystems.sh @@ -5,7 +5,7 @@ set -e # Run virt-list-filesystems. # Only columns 1 & 2 are guaranteed, we may add more in future. -if [ "$(./virt-list-filesystems -l ../images/fedora.img | +if [ "$(./virt-list-filesystems -l ../tests/guests/fedora.img | sort | awk '{print $1 $2}')" \ != \ "/dev/VG/LV1ext2 diff --git a/tools/test-virt-tar.sh b/tools/test-virt-tar.sh index dec4f482..14179890 100755 --- a/tools/test-virt-tar.sh +++ b/tools/test-virt-tar.sh @@ -4,7 +4,7 @@ export LANG=C set -e # Read out the test directory using virt-tar. -./virt-tar -x ../images/fedora.img /bin test.tar +./virt-tar -x ../tests/guests/fedora.img /bin test.tar if [ "$(tar tf test.tar | sort)" != "./ ./ls -- cgit