tests: Split images -> tests/data + tests/guests
authorRichard W.M. Jones <rjones@redhat.com>
Thu, 22 Dec 2011 12:15:06 +0000 (12:15 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Thu, 22 Dec 2011 15:48:11 +0000 (15:48 +0000)
62 files changed:
.gitignore
.x-sc_TAB_in_indentation
.x-sc_trailing_blank
Makefile.am
cat/test-virt-cat.sh
cat/test-virt-filesystems.sh
cat/test-virt-ls.sh
clone/test-virt-sysprep.sh
configure.ac
df/test-virt-df.sh
edit/test-virt-edit.sh
fish/test-copy.sh
fish/test-find0.sh
fish/test-read_file.sh
fish/test-upload-to-dir.sh
generator/generator_actions.ml
generator/generator_tests_c_api.ml
inspector/Makefile.am
perl/Makefile.am
po/POTFILES.in
src/guestfs.pod
tests/data/Makefile.am [moved from images/Makefile.am with 61% similarity]
tests/data/README-binfiles [moved from images/README-binfiles with 100% similarity]
tests/data/bin-i586-dynamic [moved from images/bin-i586-dynamic with 100% similarity]
tests/data/bin-sparc-dynamic [moved from images/bin-sparc-dynamic with 100% similarity]
tests/data/bin-win32.exe [moved from images/bin-win32.exe with 100% similarity]
tests/data/bin-win64.exe [moved from images/bin-win64.exe with 100% similarity]
tests/data/bin-x86_64-dynamic [moved from images/bin-x86_64-dynamic with 100% similarity]
tests/data/empty [moved from images/empty with 100% similarity]
tests/data/helloworld.tar [moved from images/helloworld.tar with 100% similarity]
tests/data/helloworld.tar.gz [moved from images/helloworld.tar.gz with 100% similarity]
tests/data/helloworld.tar.xz [moved from images/helloworld.tar.xz with 100% similarity]
tests/data/known-1 [moved from images/known-1 with 100% similarity]
tests/data/known-2 [moved from images/known-2 with 100% similarity]
tests/data/known-3 [moved from images/known-3 with 100% similarity]
tests/data/known-4 [moved from images/known-4 with 100% similarity]
tests/data/known-5 [moved from images/known-5 with 100% similarity]
tests/data/lib-i586.so [moved from images/lib-i586.so with 100% similarity]
tests/data/lib-sparc.so [moved from images/lib-sparc.so with 100% similarity]
tests/data/lib-win32.dll [moved from images/lib-win32.dll with 100% similarity]
tests/data/lib-win64.dll [moved from images/lib-win64.dll with 100% similarity]
tests/data/lib-x86_64.so [moved from images/lib-x86_64.so with 100% similarity]
tests/data/mbr-ext2-empty.img.gz [moved from images/mbr-ext2-empty.img.gz with 100% similarity]
tests/data/test-grep.txt [moved from images/test-grep.txt with 100% similarity]
tests/extra/Makefile.am
tests/guests/Makefile.am [new file with mode: 0644]
tests/guests/guest-aux/debian-packages [moved from images/guest-aux/debian-packages with 100% similarity]
tests/guests/guest-aux/fedora-name.db.txt [moved from images/guest-aux/fedora-name.db.txt with 100% similarity]
tests/guests/guest-aux/fedora-packages.db.txt [moved from images/guest-aux/fedora-packages.db.txt with 100% similarity]
tests/guests/guest-aux/make-debian-img.sh [moved from images/guest-aux/make-debian-img.sh with 96% similarity]
tests/guests/guest-aux/make-fedora-img.pl [moved from images/guest-aux/make-fedora-img.pl with 98% similarity]
tests/guests/guest-aux/make-ubuntu-img.sh [moved from images/guest-aux/make-ubuntu-img.sh with 95% similarity]
tests/guests/guest-aux/make-windows-img.sh [moved from images/guest-aux/make-windows-img.sh with 91% similarity]
tests/guests/guest-aux/minimal-hive [moved from images/guest-aux/minimal-hive with 100% similarity]
tests/guests/guest-aux/windows-software [moved from images/guest-aux/windows-software with 100% similarity]
tests/guests/guest-aux/windows-software.reg [moved from images/guest-aux/windows-software.reg with 100% similarity]
tests/guests/guest-aux/windows-system [moved from images/guest-aux/windows-system with 100% similarity]
tests/guests/guest-aux/windows-system.reg [moved from images/guest-aux/windows-system.reg with 100% similarity]
tests/md/test-inspect-fstab-md.sh
tests/md/test-inspect-fstab.sh
tools/test-virt-list-filesystems.sh
tools/test-virt-tar.sh

index 895227c..dcf2af1 100644 (file)
@@ -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
index ef5b1b6..586e1d2 100644 (file)
@@ -1,5 +1,5 @@
 ^appliance/debian/modules/
-^images/
+^tests/data/
 ^COPYING(.LIB)?$
 ^\.gitmodules$
 (^|\/)ChangeLog[^/]*$
index 502e660..148e6aa 100644 (file)
@@ -1,2 +1,2 @@
-images/bin-win64.exe
+tests/data/bin-win64.exe
 *.pod
index 9ae5217..438c522 100644 (file)
@@ -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
index 19b8d87..7984456 100755 (executable)
@@ -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
index f3c325c..e664e1a 100755 (executable)
@@ -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
index 3f702b7..b7b02a3 100755 (executable)
@@ -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
index 1ebbde7..3217389 100755 (executable)
@@ -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.
index 6084a1b..b0661a0 100644 (file)
@@ -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
index 38884e1..af503a3 100755 (executable)
@@ -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
index d43851b..7645a7f 100755 (executable)
@@ -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
index ea6a4cc..b6f3422 100755 (executable)
@@ -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 <<EOF
 mkdir /data
-# This creates a directory /data/images/
+# This creates a directory /data/data/
 copy-in original /data
 is-file /data/original/known-1
 is-file /data/original/known-3
index 726469c..5fd3185 100755 (executable)
@@ -23,7 +23,7 @@ set -e
 rm -f test.out
 
 ../fish/guestfish <<'EOF'
-add-ro ../images/test.iso
+add-ro ../tests/data/test.iso
 run
 mount-ro /dev/sda /
 find0 / test.out
index cd016e3..c6e4158 100755 (executable)
@@ -23,12 +23,12 @@ set -e
 rm -f test.out
 
 ../fish/guestfish <<'EOF' > 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
index 41ce5e5..1ef24a0 100755 (executable)
@@ -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
index f7a6a6c..7a5d786 100644 (file)
@@ -2818,7 +2818,7 @@ To get the checksums for many files, use C<guestfs_checksums_out>.");
   ("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<guestfs_txz_out>.");
   ("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<guestfs_part_get_parttype>).");
   ("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",
    "\
index 5b4f7a8..5d2d20a 100644 (file)
@@ -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);
   }
 
index 338afe3..8ef8734 100644 (file)
@@ -101,18 +101,18 @@ endif
 
 example-debian.xml:
        rm -f $@ $@-t
-       ../run $(builddir)/virt-inspector ../images/debian.img > $@-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 '<uuid>' > $@-t
        mv $@-t $@
index eff0059..e924cb1 100644 (file)
@@ -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
 
index 9a18ead..380a3c7 100644 (file)
@@ -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
index 3bad6e6..f7740b6 100644 (file)
@@ -2964,12 +2964,6 @@ L<guestmount(1)>, 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<images>
-
-Files used by the test suite.
-
-Some "phony" guest images which we test against.
-
 =item C<inspector>
 
 L<virt-inspector(1)>, the virtual machine image inspector.
similarity index 61%
rename from images/Makefile.am
rename to tests/data/Makefile.am
index e413750..43f40a1 100644 (file)
@@ -18,7 +18,7 @@
 include $(top_srcdir)/subdir-rules.mk
 
 # Old RHEL 5 autoconf doesn't have builddir.
-builddir ?= $(top_builddir)/images
+builddir ?= $(top_builddir)/tests/data
 
 EXTRA_DIST = \
        helloworld.tar \
@@ -36,32 +36,14 @@ EXTRA_DIST = \
        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
+       test-grep.txt
 
 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)
+       initrd
 
 images_files_src = \
        $(srcdir)/helloworld.tar \
@@ -168,66 +150,3 @@ $(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 $@
similarity index 100%
rename from images/empty
rename to tests/data/empty
similarity index 100%
rename from images/known-1
rename to tests/data/known-1
similarity index 100%
rename from images/known-2
rename to tests/data/known-2
similarity index 100%
rename from images/known-3
rename to tests/data/known-3
similarity index 100%
rename from images/known-4
rename to tests/data/known-4
similarity index 100%
rename from images/known-5
rename to tests/data/known-5
similarity index 100%
rename from images/lib-i586.so
rename to tests/data/lib-i586.so
similarity index 100%
rename from images/lib-sparc.so
rename to tests/data/lib-sparc.so
index 7d1cc22..582fa55 100644 (file)
@@ -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 (file)
index 0000000..ee28034
--- /dev/null
@@ -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 $@
similarity index 96%
rename from images/guest-aux/make-debian-img.sh
rename to tests/guests/guest-aux/make-debian-img.sh
index ade2331..b936f81 100755 (executable)
@@ -31,7 +31,7 @@ LABEL=BOOT /boot ext2 default 0 0
 EOF
 
 # Create a disk image.
-../run ../fish/guestfish <<EOF
+../../run ../../fish/guestfish <<EOF
 sparse debian.img.tmp 512M
 run
 
@@ -82,7 +82,7 @@ write /etc/hostname "debian.invalid"
 
 upload ${SRCDIR}/guest-aux/debian-packages /var/lib/dpkg/status
 
-upload ${SRCDIR}/bin-x86_64-dynamic /bin/ls
+upload ${SRCDIR}/../data/bin-x86_64-dynamic /bin/ls
 
 mkdir /boot/grub
 touch /boot/grub/grub.conf
similarity index 98%
rename from images/guest-aux/make-fedora-img.pl
rename to tests/guests/guest-aux/make-fedora-img.pl
index de72086..eb0cf77 100755 (executable)
@@ -157,7 +157,7 @@ if (-f 'mdadm.tmp') {
 $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->upload($ENV{SRCDIR}.'/../data/bin-x86_64-dynamic', '/bin/ls');
 
 $g->mkdir('/boot/grub');
 $g->touch('/boot/grub/grub.conf');
similarity index 95%
rename from images/guest-aux/make-ubuntu-img.sh
rename to tests/guests/guest-aux/make-ubuntu-img.sh
index 0c4d60a..e55c790 100755 (executable)
@@ -36,7 +36,7 @@ DISTRIB_DESCRIPTION="Ubuntu 10.10 (Phony Pharaoh)"
 EOF
 
 # Create a disk image.
-../run ../fish/guestfish <<EOF
+../../run ../../fish/guestfish <<EOF
 sparse ubuntu.img.tmp 512M
 run
 
@@ -71,7 +71,7 @@ write /etc/hostname "ubuntu.invalid"
 
 upload ${SRCDIR}/guest-aux/debian-packages /var/lib/dpkg/status
 
-upload ${SRCDIR}/bin-x86_64-dynamic /bin/ls
+upload ${SRCDIR}/../data/bin-x86_64-dynamic /bin/ls
 
 mkdir /boot/grub
 touch /boot/grub/grub.conf
similarity index 91%
rename from images/guest-aux/make-windows-img.sh
rename to tests/guests/guest-aux/make-windows-img.sh
index ec6aa47..7454630 100755 (executable)
@@ -25,7 +25,7 @@ set -e
 # ntfs-3g/ntfsprogs then we cannot create a Windows phony image.
 # Nothing actually uses windows.img in the standard build so we can
 # just 'touch' it and emit a warning.
-if ! ../run ../fish/guestfish -a /dev/null run : available "ntfs3g ntfsprogs"; then
+if ! ../../run ../../fish/guestfish -a /dev/null run : available "ntfs3g ntfsprogs"; then
   echo "***"
   echo "Warning: cannot create windows.img because there is no NTFS"
   echo "support in this build of libguestfs.  Just touching the output"
@@ -36,7 +36,7 @@ if ! ../run ../fish/guestfish -a /dev/null run : available "ntfs3g ntfsprogs"; t
 fi
 
 # Create a disk image.
-../run ../fish/guestfish <<EOF
+../../run ../../fish/guestfish <<EOF
 sparse windows.img.tmp 512M
 run
 
@@ -61,7 +61,7 @@ mkdir-p /Windows/System32/Config
 upload ${SRCDIR}/guest-aux/windows-software /Windows/System32/Config/SOFTWARE
 upload ${SRCDIR}/guest-aux/windows-system /Windows/System32/Config/SYSTEM
 
-upload ${SRCDIR}/bin-win32.exe /Windows/System32/cmd.exe
+upload ${SRCDIR}/../data/bin-win32.exe /Windows/System32/cmd.exe
 
 mkdir "/Program Files"
 touch /autoexec.bat
index 2a6cb6a..1804d33 100755 (executable)
@@ -35,8 +35,8 @@ guestfish=../../fish/guestfish
 rm -f test1.img test.fstab test.output
 
 # First, test the regular fedora image, which specifies /boot as /dev/md0
-cp ../../images/fedora-md1.img test1.img
-cp ../../images/fedora-md2.img test2.img
+cp ../guests/fedora-md1.img test1.img
+cp ../guests/fedora-md2.img test2.img
 
 $guestfish -i test[12].img <<'EOF' | sort > test.output
   exists /boot/grub/grub.conf
index 72a11fa..576ce03 100755 (executable)
@@ -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
index bd4e4e7..210ea13 100755 (executable)
@@ -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
index dec4f48..1417989 100755 (executable)
@@ -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