diff --git a/align/Makefile.am b/align/Makefile.am index eccb05c03..ab78e8396 100644 --- a/align/Makefile.am +++ b/align/Makefile.am @@ -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 diff --git a/cat/Makefile.am b/cat/Makefile.am index f883d1086..f2c3ac860 100644 --- a/cat/Makefile.am +++ b/cat/Makefile.am @@ -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 diff --git a/df/Makefile.am b/df/Makefile.am index 83409da1d..95da813c5 100644 --- a/df/Makefile.am +++ b/df/Makefile.am @@ -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 diff --git a/edit/Makefile.am b/edit/Makefile.am index e89136a86..e3f80b250 100644 --- a/edit/Makefile.am +++ b/edit/Makefile.am @@ -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 diff --git a/fish/Makefile.am b/fish/Makefile.am index 6b52820b0..1d8f4d3f0 100644 --- a/fish/Makefile.am +++ b/fish/Makefile.am @@ -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 \ diff --git a/format/Makefile.am b/format/Makefile.am index d9ae7e292..cc8392881 100644 --- a/format/Makefile.am +++ b/format/Makefile.am @@ -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 diff --git a/haskell/Makefile.am b/haskell/Makefile.am index 6cc75bd6f..866b85e51 100644 --- a/haskell/Makefile.am +++ b/haskell/Makefile.am @@ -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. diff --git a/inspector/Makefile.am b/inspector/Makefile.am index 00300a093..df870c8b9 100644 --- a/inspector/Makefile.am +++ b/inspector/Makefile.am @@ -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 '' > $@-t mv $@-t $@ diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am index f22f3f4cc..232edb7fc 100644 --- a/ocaml/Makefile.am +++ b/ocaml/Makefile.am @@ -82,7 +82,7 @@ endif TESTS_ENVIRONMENT = \ CAML_LD_LIBRARY_PATH=. \ - $(top_builddir)/run \ + $(top_builddir)/run --test \ $(VG) test_progs = \ diff --git a/perl/Makefile.am b/perl/Makefile.am index 404a4e919..bca7b0bf3 100644 --- a/perl/Makefile.am +++ b/perl/Makefile.am @@ -57,7 +57,7 @@ endif $(TESTS): $(test_prereq) TESTS_ENVIRONMENT = \ - $(top_builddir)/run + $(top_builddir)/run --test INSTALLDIRS = site diff --git a/python/Makefile.am b/python/Makefile.am index c6c1b1df8..6ffb0d8d4 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -47,7 +47,7 @@ libguestfsmod_la_LDFLAGS = -avoid-version -shared TESTS_ENVIRONMENT = \ PYTHON=$(PYTHON) \ - $(top_builddir)/run + $(top_builddir)/run --test TESTS = run-bindtests diff --git a/resize/Makefile.am b/resize/Makefile.am index 8d87ab97b..b613bb778 100644 --- a/resize/Makefile.am +++ b/resize/Makefile.am @@ -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 diff --git a/ruby/Makefile.am b/ruby/Makefile.am index 9073ad7d7..35599c306 100644 --- a/ruby/Makefile.am +++ b/ruby/Makefile.am @@ -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 diff --git a/run.in b/run.in old mode 100755 new mode 100644 index 08ac1cc2a..0aa3b75a1 --- a/run.in +++ b/run.in @@ -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 diff --git a/sparsify/Makefile.am b/sparsify/Makefile.am index f4002e3e6..5df30a80a 100644 --- a/sparsify/Makefile.am +++ b/sparsify/Makefile.am @@ -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 diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am index be233a917..7d20e102a 100644 --- a/sysprep/Makefile.am +++ b/sysprep/Makefile.am @@ -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 = \ diff --git a/tests/btrfs/Makefile.am b/tests/btrfs/Makefile.am index 6d789ba73..89f683c45 100644 --- a/tests/btrfs/Makefile.am +++ b/tests/btrfs/Makefile.am @@ -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) diff --git a/tests/c-api/Makefile.am b/tests/c-api/Makefile.am index 8888b7396..04cd52c10 100644 --- a/tests/c-api/Makefile.am +++ b/tests/c-api/Makefile.am @@ -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) diff --git a/tests/charsets/Makefile.am b/tests/charsets/Makefile.am index d18cb61a7..401f47f5b 100644 --- a/tests/charsets/Makefile.am +++ b/tests/charsets/Makefile.am @@ -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) diff --git a/tests/disks/Makefile.am b/tests/disks/Makefile.am index da68fd50c..d1b573494 100644 --- a/tests/disks/Makefile.am +++ b/tests/disks/Makefile.am @@ -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) diff --git a/tests/guests/Makefile.am b/tests/guests/Makefile.am index 3e5aea032..77ce61ba9 100644 --- a/tests/guests/Makefile.am +++ b/tests/guests/Makefile.am @@ -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 diff --git a/tests/luks/Makefile.am b/tests/luks/Makefile.am index fdbbb1b69..cafef0ba2 100644 --- a/tests/luks/Makefile.am +++ b/tests/luks/Makefile.am @@ -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) diff --git a/tests/lvm/Makefile.am b/tests/lvm/Makefile.am index 7e89babaa..3242e17cb 100644 --- a/tests/lvm/Makefile.am +++ b/tests/lvm/Makefile.am @@ -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) diff --git a/tests/md/Makefile.am b/tests/md/Makefile.am index 06352da6c..2b4e7a10b 100644 --- a/tests/md/Makefile.am +++ b/tests/md/Makefile.am @@ -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) \ No newline at end of file + $(TESTS) diff --git a/tests/ntfsclone/Makefile.am b/tests/ntfsclone/Makefile.am index 637b247a2..fcce8100a 100644 --- a/tests/ntfsclone/Makefile.am +++ b/tests/ntfsclone/Makefile.am @@ -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) diff --git a/tests/protocol/Makefile.am b/tests/protocol/Makefile.am index 6e0f03f47..671b2626f 100644 --- a/tests/protocol/Makefile.am +++ b/tests/protocol/Makefile.am @@ -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) diff --git a/tests/qemu/Makefile.am b/tests/qemu/Makefile.am index 128296d3b..af2061dc6 100644 --- a/tests/qemu/Makefile.am +++ b/tests/qemu/Makefile.am @@ -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) diff --git a/tests/regressions/Makefile.am b/tests/regressions/Makefile.am index 3027cd8e8..22a364cc6 100644 --- a/tests/regressions/Makefile.am +++ b/tests/regressions/Makefile.am @@ -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 \ diff --git a/tests/selinux/Makefile.am b/tests/selinux/Makefile.am index 29ee7fdc3..47fdde549 100644 --- a/tests/selinux/Makefile.am +++ b/tests/selinux/Makefile.am @@ -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 \ diff --git a/tests/xml/Makefile.am b/tests/xml/Makefile.am index f5638fcb0..04f9e6854 100644 --- a/tests/xml/Makefile.am +++ b/tests/xml/Makefile.am @@ -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 diff --git a/tools/Makefile.am b/tools/Makefile.am index 0a7cfaadb..a5d9844c5 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -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 \