Use (implicitly) parallel tests on new enough automake. The tests run
a bit quicker with this change. On my laptop, I measured 27 mins down
to 18 mins.
Change the ./run function so that ./run --test no longer spools the
test output to a file. That is not necessary when using parallel
tests, since the test harness does the same thing.
Note: This commit breaks the $RUN_OUTPUT_FILE functionality.
---
.gitignore | 2 ++
configure.ac | 19 ++-----------------
run.in | 34 +++++++++++++---------------------
tests/qemu/Makefile.am | 4 ++++
4 files changed, 21 insertions(+), 38 deletions(-)
diff --git a/.gitignore b/.gitignore
index 8e7158e..8091608 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,11 +14,13 @@
*.jar
*.la
*.lo
+*.log
*.o
*.orig
*.patch
*.rej
*.swp
+*.trs
bindtests.tmp
cscope.out
diff --git a/configure.ac b/configure.ac
index 88f5568..bd3e5e9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,23 +30,8 @@ AC_SUBST([RELEASE_DATE], [2015-11-04])
AC_CONFIG_AUX_DIR([build-aux])
-dnl Initialize automake. automake < 1.12 didn't have serial-tests and
-dnl gives an error if it sees this, but for automake >= 1.13
-dnl serial-tests is required so we have to include it. Solution is to
-dnl test for the version of automake (by running an external command)
-dnl and provide it if necessary. Note we have to do this entirely using
-dnl m4 macros since automake queries this macro by running
-dnl 'autoconf --trace'.
-m4_define([serial_tests], [
- m4_esyscmd([automake --version | head -1 | awk '
- {
- split ($NF, version, ".");
- if (version[1] == 1 && version[2] >= 12)
- print "serial-tests";
- }'
- ])
-])
-AM_INIT_AUTOMAKE(foreign serial_tests subdir-objects) dnl NB: Do not [quote] this
parameter.
+dnl Initialize automake.
+AM_INIT_AUTOMAKE(foreign subdir-objects) dnl NB: Do not [quote] this parameter.
m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
diff --git a/run.in b/run.in
index 46dbaf0..d59da7f 100755
--- a/run.in
+++ b/run.in
@@ -31,15 +31,20 @@
# For lots more ways to use this script, see the libguestfs README
# file.
#
-# The script can also be used to make the output of tests shorter:
+# The script should also be used for tests like this:
+#
# TESTS_ENVIRONMENT = ... $(top_builddir)/run --test [$(VG)]
-# (Use the optional $(VG) when the tests must also be run under
-# valgrind).
+#
+# The --test parameter introduces a timeout, stopping tests from
+# running forever.
+#
+# Use the optional $(VG) when the tests must also be run under
+# valgrind.
#----------------------------------------------------------------------
if [ "$1" = "--test" ]; then
- test_mode=1
+ timeout_mode=1
shift
fi
@@ -223,14 +228,11 @@ export GNOME_KEYRING_CONTROL=
export GNOME_KEYRING_PID=
# Run the program.
-if [ -z "$test_mode" ]; then
+if [ -z "$timeout_mode" ]; then
exec $libtool "$@"
fi
# For tests (./run --test):
-# - redirect all output to a file, and only print the file if the
-# test fails
-# - print how long it takes to run the test
# - timeout if the test takes too long to run
# Originally 1h, but that is not long enough to run the C API
@@ -246,28 +248,19 @@ if timeout --foreground 2 sleep 0 >/dev/null 2>&1; then
fi
fi
-pid=$$
-tmpout=$b/tmp/run-$pid
-rm -f $tmpout
-start_t="$(date +'%s')"
-$timeout $libtool "$@" > $tmpout 2>&1
+$timeout $libtool "$@"
fail=$?
-end_t="$(date +'%s')"
if [ "$fail" -eq 0 ]; then
# Test successful.
- echo $(($end_t - $start_t)) seconds: "$@"
+ :
elif [ "$fail" -eq 77 ]; then
# Tests return 77 to mean skipped.
- cat $tmpout
+ :
elif [ "$fail" -eq 124 ]; then
# Timed out.
- echo "$b/run --test" "$@"
- cat $tmpout
echo "$b/run: command timed out after $timeout_period"
else
# Test failed.
- echo "$b/run --test" "$@"
- cat $tmpout
echo "$b/run: command failed with exit code $fail"
fi
if [ -n "$RUN_OUTPUT_FILE" ]; then
@@ -282,5 +275,4 @@ if [ -n "$RUN_OUTPUT_FILE" ]; then
echo "]]>" >> $RUN_OUTPUT_FILE
echo "</test>" >> $RUN_OUTPUT_FILE
fi
-rm -f $tmpout
exit $fail
diff --git a/tests/qemu/Makefile.am b/tests/qemu/Makefile.am
index 478b3f1..6c72b18 100644
--- a/tests/qemu/Makefile.am
+++ b/tests/qemu/Makefile.am
@@ -75,3 +75,7 @@ qemu_speed_test_LDADD = \
$(LIBVIRT_LIBS) \
$(LTLIBINTL) \
$(top_builddir)/gnulib/lib/libgnu.la
+
+# Don't run these tests in parallel, since they are designed to check
+# the integrity of qemu.
+.NOTPARALLEL:
--
2.5.0