summaryrefslogtreecommitdiffstats
path: root/cat
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-11-12 17:54:31 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-11-13 15:26:29 +0000
commit3636c5fcff69e7a5a5afa126a597883db4c781bb (patch)
tree0d1406c121f1fb684b54f0d33b564246774bb826 /cat
parentc4a3ea066be9823d4572b57fd05940345904b826 (diff)
downloadlibguestfs-3636c5fcff69e7a5a5afa126a597883db4c781bb.tar.gz
libguestfs-3636c5fcff69e7a5a5afa126a597883db4c781bb.tar.xz
libguestfs-3636c5fcff69e7a5a5afa126a597883db4c781bb.zip
tests: Replace 'make extra-tests' with individual tests.
'make extra-tests' was a monolithic set of tests that did all sorts of things: valgrind, tests over local guests, tests with upstream qemu, tests with upstream libvirt, tests with the appliance attach method. This made it hard to perform individual tests, eg. just valgrind testing. It was also hard to maintain because the tests were not located in the same directories as the programs and sometimes duplicated tests that were run elsewhere. This commit splits up 'make extra-tests' into 5 separate targets: make check-valgrind # run a subset of tests under valgrind make check-valgrind-local-guests # test under valgrind with local guests make check-with-appliance # test with attach-method == appliance make check-with-upstream-qemu # test with an alternate/upstream qemu make check-with-upstream-libvirt # test with an alternate/upstream libvirt (You can also still run 'make extra-tests' which is now simply a rule that runs the above 5 targets in order). This replaces everything that was in the tests/extra directory, so that has now gone.
Diffstat (limited to 'cat')
-rw-r--r--cat/Makefile.am13
-rwxr-xr-xcat/test-virt-cat.sh4
-rwxr-xr-xcat/test-virt-filesystems.sh4
-rwxr-xr-xcat/test-virt-ls.sh8
4 files changed, 22 insertions, 7 deletions
diff --git a/cat/Makefile.am b/cat/Makefile.am
index 3549248c..daea4461 100644
--- a/cat/Makefile.am
+++ b/cat/Makefile.am
@@ -134,5 +134,16 @@ stamp-virt-filesystems.pod: virt-filesystems.pod
TESTS_ENVIRONMENT = $(top_builddir)/run --test
if ENABLE_APPLIANCE
-TESTS = test-virt-cat.sh test-virt-filesystems.sh test-virt-ls.sh
+TESTS = \
+ test-virt-cat.sh \
+ test-virt-filesystems.sh \
+ test-virt-ls.sh
endif ENABLE_APPLIANCE
+
+check-valgrind:
+ $(MAKE) VG="$(top_builddir)/run @VG@" check
+
+check-valgrind-local-guests:
+ for g in $(GUESTS); do \
+ $(top_builddir)/run --test @VG@ ./virt-filesystems -c "$(libvirt_ro_uri)" -d "$$g" --all --long -h --uuid || exit $$?; \
+ done
diff --git a/cat/test-virt-cat.sh b/cat/test-virt-cat.sh
index 5c051560..ee306bf7 100755
--- a/cat/test-virt-cat.sh
+++ b/cat/test-virt-cat.sh
@@ -20,11 +20,11 @@ export LANG=C
set -e
# Read out the test files from the image using virt-cat.
-if [ "$(./virt-cat ../tests/guests/fedora.img /etc/test1)" != "abcdefg" ]; then
+if [ "$($VG ./virt-cat ../tests/guests/fedora.img /etc/test1)" != "abcdefg" ]; then
echo "$0: error: mismatch in file test1"
exit 1
fi
-if [ "$(./virt-cat ../tests/guests/fedora.img /etc/test2)" != "" ]; then
+if [ "$($VG ./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 b413bacf..96a398e4 100755
--- a/cat/test-virt-filesystems.sh
+++ b/cat/test-virt-filesystems.sh
@@ -19,7 +19,7 @@
export LANG=C
set -e
-output="$(./virt-filesystems -a ../tests/guests/fedora.img | sort)"
+output="$($VG ./virt-filesystems -a ../tests/guests/fedora.img | sort)"
expected="/dev/VG/LV1
/dev/VG/LV2
/dev/VG/LV3
@@ -32,7 +32,7 @@ if [ "$output" != "$expected" ]; then
exit 1
fi
-output="$(./virt-filesystems -a ../tests/guests/fedora.img --all --long --uuid -h --no-title | awk '{print $1}' | sort -u)"
+output="$($VG ./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 9cfe9db9..55fc1140 100755
--- a/cat/test-virt-ls.sh
+++ b/cat/test-virt-ls.sh
@@ -20,7 +20,7 @@ export LANG=C
set -e
# Read out the test directory using virt-ls.
-if [ "$(./virt-ls ../tests/guests/fedora.img /bin)" != "ls
+if [ "$($VG ./virt-ls ../tests/guests/fedora.img /bin)" != "ls
test1
test2
test3
@@ -33,7 +33,7 @@ test7" ]; then
fi
# Try the -lR option.
-output="$(./virt-ls -lR ../tests/guests/fedora.img /boot | awk '{print $1 $2 $4}')"
+output="$($VG ./virt-ls -lR ../tests/guests/fedora.img /boot | awk '{print $1 $2 $4}')"
expected="d0755/boot
d0755/boot/grub
-0644/boot/grub/grub.conf
@@ -47,3 +47,7 @@ if [ "$output" != "$expected" ]; then
echo "--------------------------------------------------"
exit 1
fi
+
+# Try the -l and -R options. XXX Should check the output.
+$VG ./virt-ls -l ../tests/guests/fedora.img /
+$VG ./virt-ls -R ../tests/guests/fedora.img /