mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
tests: Add ./run --test option.
This option, when added via TESTS_ENVIRONMENT = [...] $(top_builddir)/run --test allows us to run the tests and only print the full output (including debugging etc) when the test fails.
This commit is contained in:
@@ -74,6 +74,6 @@ stamp-virt-alignment-scan.pod: virt-alignment-scan.pod
|
||||
|
||||
# TESTS_ENVIRONMENT = \
|
||||
# MALLOC_PERTURB_=$(random_val) \
|
||||
# $(top_builddir)/run
|
||||
# $(top_builddir)/run --test
|
||||
|
||||
# TESTS = test-virt-alignment-scan.sh
|
||||
|
||||
@@ -132,7 +132,7 @@ random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run
|
||||
$(top_builddir)/run --test
|
||||
|
||||
if ENABLE_APPLIANCE
|
||||
TESTS = test-virt-cat.sh test-virt-filesystems.sh test-virt-ls.sh
|
||||
|
||||
@@ -78,7 +78,7 @@ random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run
|
||||
$(top_builddir)/run --test
|
||||
|
||||
if ENABLE_APPLIANCE
|
||||
TESTS = test-virt-df.sh
|
||||
|
||||
@@ -70,7 +70,7 @@ random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run
|
||||
$(top_builddir)/run --test
|
||||
|
||||
if ENABLE_APPLIANCE
|
||||
TESTS = test-virt-edit.sh
|
||||
|
||||
@@ -233,7 +233,7 @@ random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run
|
||||
$(top_builddir)/run --test
|
||||
|
||||
TESTS = \
|
||||
test-a.sh \
|
||||
|
||||
@@ -71,7 +71,7 @@ random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run
|
||||
$(top_builddir)/run --test
|
||||
|
||||
if ENABLE_APPLIANCE
|
||||
TESTS = test-virt-format.sh
|
||||
|
||||
@@ -28,7 +28,7 @@ EXTRA_DIST = $(generator_built) *.hs run-bindtests
|
||||
if HAVE_HASKELL
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
$(top_builddir)/run \
|
||||
$(top_builddir)/run --test \
|
||||
$(VG)
|
||||
|
||||
# Don't run the bindtests: they don't build since the addition of optargs.
|
||||
|
||||
@@ -104,18 +104,22 @@ endif
|
||||
|
||||
example-debian.xml:
|
||||
rm -f $@ $@-t
|
||||
../run $(builddir)/virt-inspector ../tests/guests/debian.img > $@-t
|
||||
../run --test \
|
||||
$(builddir)/virt-inspector ../tests/guests/debian.img > $@-t
|
||||
mv $@-t $@
|
||||
example-fedora.xml:
|
||||
rm -f $@ $@-t
|
||||
../run $(builddir)/virt-inspector ../tests/guests/fedora.img > $@-t
|
||||
../run --test \
|
||||
$(builddir)/virt-inspector ../tests/guests/fedora.img > $@-t
|
||||
mv $@-t $@
|
||||
example-ubuntu.xml:
|
||||
rm -f $@ $@-t
|
||||
../run $(builddir)/virt-inspector ../tests/guests/ubuntu.img > $@-t
|
||||
../run --test \
|
||||
$(builddir)/virt-inspector ../tests/guests/ubuntu.img > $@-t
|
||||
mv $@-t $@
|
||||
example-windows.xml:
|
||||
rm -f $@ $@-t
|
||||
../run $(builddir)/virt-inspector ../tests/guests/windows.img | \
|
||||
../run --test \
|
||||
$(builddir)/virt-inspector ../tests/guests/windows.img | \
|
||||
fgrep -v '<uuid>' > $@-t
|
||||
mv $@-t $@
|
||||
|
||||
@@ -82,7 +82,7 @@ endif
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
CAML_LD_LIBRARY_PATH=. \
|
||||
$(top_builddir)/run \
|
||||
$(top_builddir)/run --test \
|
||||
$(VG)
|
||||
|
||||
test_progs = \
|
||||
|
||||
@@ -57,7 +57,7 @@ endif
|
||||
$(TESTS): $(test_prereq)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
$(top_builddir)/run
|
||||
$(top_builddir)/run --test
|
||||
|
||||
INSTALLDIRS = site
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ libguestfsmod_la_LDFLAGS = -avoid-version -shared
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
PYTHON=$(PYTHON) \
|
||||
$(top_builddir)/run
|
||||
$(top_builddir)/run --test
|
||||
|
||||
TESTS = run-bindtests
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run
|
||||
$(top_builddir)/run --test
|
||||
|
||||
TESTS = utils_tests
|
||||
if ENABLE_APPLIANCE
|
||||
|
||||
@@ -51,7 +51,7 @@ TESTS = run-bindtests run-ruby-tests
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
RUBY=$(RUBY) \
|
||||
$(top_builddir)/run
|
||||
$(top_builddir)/run --test
|
||||
|
||||
all: $(generator_built)
|
||||
$(RAKE) build
|
||||
|
||||
26
run.in
Executable file → Normal file
26
run.in
Executable file → Normal file
@@ -26,9 +26,17 @@
|
||||
# This works for any C, OCaml or Perl virt tools in the libguestfs
|
||||
# distribution. Also you can make a symbolic link to this 'run'
|
||||
# script from anywhere (eg. $HOME/bin/run) if you wish.
|
||||
#
|
||||
# The script can also be used to make the output of tests shorter:
|
||||
# TESTS_ENVIRONMENT = ... $(top_builddir)/run --test
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
if [ "$1" = "--test" ]; then
|
||||
test_mode=1
|
||||
shift
|
||||
fi
|
||||
|
||||
# Find this script.
|
||||
b=@abs_builddir@
|
||||
|
||||
@@ -75,4 +83,20 @@ if libtool --help >/dev/null 2>&1; then
|
||||
fi
|
||||
|
||||
# Run the program.
|
||||
exec $libtool "$@"
|
||||
if [ -z "$test_mode" ]; then
|
||||
exec $libtool "$@"
|
||||
else
|
||||
# For tests (./run --test), redirect all output to a file, and
|
||||
# only print the file if the test fails.
|
||||
fail=0
|
||||
pid=$$
|
||||
rm -f run.$pid
|
||||
$libtool "$@" > $b/run.$pid 2>&1 || {
|
||||
fail=$?
|
||||
echo "$b/run --test" "$@"
|
||||
cat $b/run.$pid
|
||||
echo "$b/run: command failed with exit code $fail"
|
||||
}
|
||||
rm -f run.$pid
|
||||
exit $fail
|
||||
fi
|
||||
|
||||
@@ -105,7 +105,7 @@ random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run
|
||||
$(top_builddir)/run --test
|
||||
|
||||
if ENABLE_APPLIANCE
|
||||
TESTS = test-virt-sparsify.sh
|
||||
|
||||
@@ -168,7 +168,7 @@ TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
abs_builddir=$(abs_builddir) \
|
||||
abs_srcdir=$(abs_srcdir) \
|
||||
$(top_builddir)/run
|
||||
$(top_builddir)/run --test
|
||||
|
||||
if ENABLE_APPLIANCE
|
||||
TESTS = \
|
||||
|
||||
@@ -25,7 +25,7 @@ random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run
|
||||
$(top_builddir)/run --test
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(TESTS)
|
||||
|
||||
@@ -61,8 +61,7 @@ EXTRA_DIST += test-add-libvirt-dom.c
|
||||
TESTS_ENVIRONMENT = \
|
||||
SKIP_TEST_COMMAND=$(shell ldd test-command | grep -sq 'not a dynamic executable' || echo 1) \
|
||||
SKIP_TEST_COMMAND_LINES=$(shell ldd test-command | grep -sq 'not a dynamic executable' || echo 1) \
|
||||
LIBGUESTFS_PATH=$(top_builddir)/appliance \
|
||||
TMPDIR=$(top_builddir) \
|
||||
$(top_builddir)/run --test \
|
||||
$(VG)
|
||||
|
||||
#SKIP_TEST_CHECKSUM_8=$(shell if test `find ../initramfs -name squashfs.ko | wc -l` -eq 0; then echo 1; fi)
|
||||
|
||||
@@ -24,8 +24,7 @@ random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
LIBGUESTFS_PATH=$(top_builddir)/appliance \
|
||||
TMPDIR=$(top_builddir) \
|
||||
$(top_builddir)/run --test \
|
||||
$(VG)
|
||||
|
||||
check_PROGRAMS = $(TESTS)
|
||||
|
||||
@@ -24,7 +24,7 @@ random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run
|
||||
$(top_builddir)/run --test
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(TESTS)
|
||||
|
||||
@@ -49,7 +49,7 @@ fedora.img: guest-aux/make-fedora-img.pl \
|
||||
TMPDIR=$(top_builddir) \
|
||||
SRCDIR=$(srcdir) \
|
||||
LAYOUT=partitions \
|
||||
../../run $<
|
||||
../../run --test $<
|
||||
|
||||
# Make a (dummy) Fedora image using md devices
|
||||
fedora-md1.img fedora-md2.img: stamp-fedora-md.img
|
||||
@@ -61,7 +61,7 @@ stamp-fedora-md.img: guest-aux/make-fedora-img.pl \
|
||||
TMPDIR=$(top_builddir) \
|
||||
SRCDIR=$(srcdir) \
|
||||
LAYOUT=partitions-md \
|
||||
../../run $<
|
||||
../../run --test $<
|
||||
touch $@
|
||||
|
||||
guest-aux/fedora-name.db: guest-aux/fedora-name.db.txt
|
||||
|
||||
@@ -25,7 +25,7 @@ random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run
|
||||
$(top_builddir)/run --test
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(TESTS)
|
||||
|
||||
@@ -25,7 +25,7 @@ random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run
|
||||
$(top_builddir)/run --test
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(TESTS)
|
||||
|
||||
@@ -28,7 +28,7 @@ random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run
|
||||
$(top_builddir)/run --test
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(TESTS)
|
||||
$(TESTS)
|
||||
|
||||
@@ -24,7 +24,7 @@ random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run
|
||||
$(top_builddir)/run --test
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(TESTS)
|
||||
|
||||
@@ -30,7 +30,7 @@ random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run
|
||||
$(top_builddir)/run --test
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(TESTS)
|
||||
|
||||
@@ -29,7 +29,7 @@ random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run
|
||||
$(top_builddir)/run --test
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(TESTS)
|
||||
|
||||
@@ -39,7 +39,7 @@ random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
NOEXEC_CHECK="$(top_builddir)/src/.libs/libguestfs.so $(top_builddir)/daemon/guestfsd" \
|
||||
$(top_builddir)/run
|
||||
$(top_builddir)/run --test
|
||||
|
||||
check_PROGRAMS = \
|
||||
rhbz501893 \
|
||||
|
||||
@@ -34,7 +34,7 @@ random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run
|
||||
$(top_builddir)/run --test
|
||||
|
||||
EXTRA_DIST = \
|
||||
run-test.pl \
|
||||
|
||||
@@ -40,7 +40,7 @@ TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
abs_srcdir=$(abs_srcdir) \
|
||||
LD_PRELOAD=.libs/libfakevirtxml.so \
|
||||
$(top_builddir)/run
|
||||
$(top_builddir)/run --test
|
||||
|
||||
endif
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run
|
||||
$(top_builddir)/run --test
|
||||
|
||||
if ENABLE_APPLIANCE
|
||||
TESTS = test-virt-list-filesystems.sh \
|
||||
|
||||
Reference in New Issue
Block a user