[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH v3] build: Drop serial_tests.



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 removes the $RUN_OUTPUT_FILE functionality.  We will
change the CI integration in a future commit so it uses the .trs and
.log files.
---
 .gitignore             |  2 ++
 configure.ac           | 19 ++-----------------
 run.in                 | 46 +++++++++++++---------------------------------
 tests/qemu/Makefile.am |  4 ++++
 4 files changed, 21 insertions(+), 50 deletions(-)

diff --git a/.gitignore b/.gitignore
index 16fcfd1..ebccae7 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 64079ac..f1a31b3 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..486cf1d 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,41 +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
-    testname=`echo "$1" | @SED@ -e 's,^./,,g'`
-    echo "<test rescode=\"$fail\" name=\"$testname\" time=\"$(($end_t - $start_t))\">" >> $RUN_OUTPUT_FILE
-    echo "<![CDATA[" >> $RUN_OUTPUT_FILE
-    # skip the results of test-virt-rescue.pl, as they contain
-    # non-ASCII chars which give troubles to xsltproc
-    if ! echo "$testname" | grep test-virt-rescue.pl &>/dev/null ; then
-      cat $tmpout >> $RUN_OUTPUT_FILE
-    fi
-    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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]