diff --git a/0001-.-run-Add-a-better-comment-describing-test-mode.patch b/0001-.-run-Add-a-better-comment-describing-test-mode.patch new file mode 100644 index 0000000..64bce3e --- /dev/null +++ b/0001-.-run-Add-a-better-comment-describing-test-mode.patch @@ -0,0 +1,72 @@ +From 745e507c2fd06f9349212efe86f8143a1f0c5a0e Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 11 Jul 2013 12:53:28 +0100 +Subject: [PATCH 1/2] ./run: Add a better comment describing --test mode. + +This is just code motion, there is no functional change. +--- + run.in | 49 ++++++++++++++++++++++++++----------------------- + 1 file changed, 26 insertions(+), 23 deletions(-) + +diff --git a/run.in b/run.in +index 5d9ad75..f49df8e 100755 +--- a/run.in ++++ b/run.in +@@ -214,28 +214,31 @@ export GNOME_KEYRING_PID= + # Run the program. + if [ -z "$test_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 ++ ++pid=$$ ++tmpout=$b/tmp/run-$pid ++rm -f $tmpout ++start_t="$(date +'%s')" ++$libtool "$@" > $tmpout 2>&1 ++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 + else +- # For tests (./run --test), redirect all output to a file, and +- # only print the file if the test fails. +- pid=$$ +- tmpout=$b/tmp/run-$pid +- rm -f $tmpout +- start_t="$(date +'%s')" +- $libtool "$@" > $tmpout 2>&1 +- 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 +- else +- # Test failed. +- echo "$b/run --test" "$@" +- cat $tmpout +- echo "$b/run: command failed with exit code $fail" +- fi +- rm -f $tmpout +- exit $fail ++ # Test failed. ++ echo "$b/run --test" "$@" ++ cat $tmpout ++ echo "$b/run: command failed with exit code $fail" + fi ++rm -f $tmpout ++exit $fail +-- +1.8.3.1 + diff --git a/0002-.-run-Timeout-tests-after-1-hour.patch b/0002-.-run-Timeout-tests-after-1-hour.patch new file mode 100644 index 0000000..ada36d1 --- /dev/null +++ b/0002-.-run-Timeout-tests-after-1-hour.patch @@ -0,0 +1,54 @@ +From caab9f1e6f7ac0d8d5209c31854d640b807519ce Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 11 Jul 2013 12:58:45 +0100 +Subject: [PATCH 2/2] ./run: Timeout tests after 1 hour. + +No single test should run longer than 1 hour even on the slowest of +hardware. We are having a problem in Koji where a test hangs and then +we end up losing the output completely, so a timeout + print the log +to that point is much better. +--- + run.in | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/run.in b/run.in +index f49df8e..d8b2e03 100755 +--- a/run.in ++++ b/run.in +@@ -220,12 +220,20 @@ fi + # - 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 ++ ++# Do we have Padraig's timeout utility (from coreutils)? ++if timeout --help >/dev/null 2>&1; then ++ # Timeout (SIGTERM) after 1 hour. ++ # Then send a second SIGKILL 30 seconds later. ++ timeout="timeout -k 30s 1h" ++fi + + pid=$$ + tmpout=$b/tmp/run-$pid + rm -f $tmpout + start_t="$(date +'%s')" +-$libtool "$@" > $tmpout 2>&1 ++$timeout $libtool "$@" > $tmpout 2>&1 + fail=$? + end_t="$(date +'%s')" + if [ "$fail" -eq 0 ]; then +@@ -234,6 +242,11 @@ if [ "$fail" -eq 0 ]; then + 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 1 hour" + else + # Test failed. + echo "$b/run --test" "$@" +-- +1.8.3.1 + diff --git a/libguestfs.spec b/libguestfs.spec index 2ef434b..6bfd0bf 100644 --- a/libguestfs.spec +++ b/libguestfs.spec @@ -12,7 +12,7 @@ Summary: Access and modify virtual machine disk images Name: libguestfs Epoch: 1 Version: 1.23.8 -Release: 2%{?dist} +Release: 3%{?dist} License: LGPLv2+ # Source and patches. @@ -20,6 +20,8 @@ URL: http://libguestfs.org/ Source0: http://libguestfs.org/download/1.23-development/%{name}-%{version}.tar.gz Patch1: 0001-golang-Fix-it-so-it-builds-if-libguestfs-is-not-inst.patch +Patch2: 0001-.-run-Add-a-better-comment-describing-test-mode.patch +Patch3: 0002-.-run-Timeout-tests-after-1-hour.patch # Basic build requirements: BuildRequires: perl(Pod::Simple) @@ -537,6 +539,8 @@ for %{name}. %setup -q %patch1 -p1 +%patch2 -p1 +%patch3 -p1 if [ "$(getenforce | tr '[A-Z]' '[a-z]')" != "disabled" ]; then # For sVirt to work, the local temporary directory we use in the @@ -910,6 +914,9 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/libguestfs %changelog +* Thu Jul 11 2013 Richard W.M. Jones - 1:1.23.8-3 +- Add patches to ./run so we capture errors when i686 tests time out. + * Tue Jul 9 2013 Richard W.M. Jones - 1:1.23.8-2 - New upstream version 1.23.8. - Try enabling golang bindings.