All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: kvm@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com>, Andrew Jones <drjones@redhat.com>
Subject: [kvm-unit-tests PATCH v4 11/13] scripts/runtime: skip tests that cannot run
Date: Wed, 11 May 2016 18:30:41 +0200	[thread overview]
Message-ID: <1462984243-5783-2-git-send-email-rkrcmar@redhat.com> (raw)
In-Reply-To: <1462984243-5783-1-git-send-email-rkrcmar@redhat.com>

A case where QEMU won't run the kernel should be considered as skipped.
Hyper-V tests used to FAIL on old QEMUs.  The infamous QEMU=/dev/null
FAIL streak is covered too.  Some error messages in arch/run were
reworded, because they are now visible in summary.

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
---
 v4:
 * clarified "kvm only" error message [Drew+Lukáš]
 * used _NO_FILE_4Uhere_ instead of /dev/null [Drew]
 * completely reworked output, now prints the last line

 arm/run              |  2 +-
 powerpc/run          |  2 +-
 scripts/runtime.bash | 28 +++++++++++++++++++++++++++-
 3 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/arm/run b/arm/run
index ebf703d5757c..a2f35ef6a7e6 100755
--- a/arm/run
+++ b/arm/run
@@ -19,7 +19,7 @@ if [ -c /dev/kvm ]; then
 fi
 
 if [ "$ACCEL" = "kvm" ] && [ "$kvm_available" != "yes" ]; then
-	echo "skip $TESTNAME (kvm only)"
+	echo "KVM is needed, but not available on this host"
 	exit 2
 fi
 
diff --git a/powerpc/run b/powerpc/run
index 56698e622592..14988a75b1e2 100755
--- a/powerpc/run
+++ b/powerpc/run
@@ -16,7 +16,7 @@ if [ -c /dev/kvm ]; then
 fi
 
 if [ "$ACCEL" = "kvm" ] && [ "$kvm_available" != "yes" ]; then
-	echo "skip $TESTNAME (kvm only)"
+	echo "KVM is needed, but not available on this host"
 	exit 2
 fi
 
diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index deae077e50a1..c9ab9ba47d81 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -11,6 +11,27 @@ extract_summary()
     tail -1 | grep '^SUMMARY: ' | sed 's/^SUMMARY: /(/;s/$/)/'
 }
 
+# We assume that QEMU is going to work if it tried to load the kernel
+premature_failure()
+{
+    local log="$(eval $(get_cmdline _NO_FILE_4Uhere_) 2>&1)"
+    local last_line=$(tail -1 <<< "$log")
+
+    echo "$last_line" | grep -qi "could not load kernel" &&
+        return 1
+
+    RUNTIME_log_stderr <<< "$log"
+
+    echo "$last_line"
+    return 0
+}
+
+get_cmdline()
+{
+    local kernel=$1
+    echo "TESTNAME=$testname TIMEOUT=$timeout ACCEL=$accel $RUNTIME_arch_run $kernel -smp $smp $opts"
+}
+
 function run()
 {
     local testname="$1"
@@ -48,7 +69,12 @@ function run()
         fi
     done
 
-    cmdline="TESTNAME=$testname TIMEOUT=$timeout ACCEL=$accel $RUNTIME_arch_run $kernel -smp $smp $opts"
+    last_line=$(premature_failure) && {
+        echo "`SKIP` $1 ($last_line)"
+        return 77
+    }
+
+    cmdline=$(get_cmdline $kernel)
     if [ "$verbose" = "yes" ]; then
         echo $cmdline
     fi
-- 
2.8.2


  reply	other threads:[~2016-05-11 16:30 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-11 16:12 [kvm-unit-tests PATCH v4 00/13] Improve the output of test runners Radim Krčmář
2016-05-11 16:12 ` [kvm-unit-tests PATCH v4 01/13] lib/report: allow test skipping Radim Krčmář
2016-05-11 16:12 ` [kvm-unit-tests PATCH v4 02/13] x86/*: report skipped tests Radim Krčmář
2016-05-17 12:19   ` Paolo Bonzini
2016-05-25 17:19     ` Radim Krčmář
2016-05-25 17:23       ` Radim Krčmář
2016-05-26  7:22         ` Paolo Bonzini
2016-05-11 16:12 ` [kvm-unit-tests PATCH v4 03/13] x86/unittests: remove svm-disabled Radim Krčmář
2016-05-11 16:12 ` [kvm-unit-tests PATCH v4 04/13] lib/string: add strncmp Radim Krčmář
2016-05-11 16:33   ` Andrew Jones
2016-05-11 16:12 ` [kvm-unit-tests PATCH v4 05/13] lib/util: add args_parse_keyval Radim Krčmář
2016-05-11 16:58   ` Andrew Jones
2016-05-11 17:19     ` Radim Krčmář
2016-05-11 17:23   ` Andrew Jones
2016-05-11 16:12 ` [kvm-unit-tests PATCH v4 06/13] x86/pmu: expect failure with nmi_watchdog Radim Krčmář
2016-05-11 17:00   ` Andrew Jones
2016-05-11 16:12 ` [kvm-unit-tests PATCH v4 07/13] lib/report: don't print 0 failed tests Radim Krčmář
2016-05-11 16:12 ` [kvm-unit-tests PATCH v4 08/13] scripts/runtime: consolidate summary tags Radim Krčmář
2016-05-17 12:22   ` Paolo Bonzini
2016-05-25 17:46     ` Radim Krčmář
2016-05-11 16:12 ` [kvm-unit-tests PATCH v4 09/13] run_tests: print SUMMARY line in summary Radim Krčmář
2016-05-11 17:10   ` Andrew Jones
2016-05-17 12:32   ` Paolo Bonzini
2016-05-25 17:41     ` Radim Krčmář
2016-05-11 16:30 ` [kvm-unit-tests PATCH v4 10/13] run_tests: log stderr Radim Krčmář
2016-05-11 16:30   ` Radim Krčmář [this message]
2016-05-11 17:20     ` [kvm-unit-tests PATCH v4 11/13] scripts/runtime: skip tests that cannot run Andrew Jones
2016-05-11 16:30   ` [kvm-unit-tests PATCH v4 12/13] scripts/arch-run: change QEMU failure detection Radim Krčmář
2016-05-11 17:24     ` Andrew Jones
2016-05-11 16:30   ` [kvm-unit-tests PATCH v4 13/13] scripts/run: generalize check Radim Krčmář
2016-05-11 17:31     ` Andrew Jones
2016-05-11 17:11   ` [kvm-unit-tests PATCH v4 10/13] run_tests: log stderr Andrew Jones
2016-05-17 12:29 ` [kvm-unit-tests PATCH v4 00/13] Improve the output of test runners Paolo Bonzini
2016-05-25 17:49   ` Radim Krčmář
2016-05-26  7:25     ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1462984243-5783-2-git-send-email-rkrcmar@redhat.com \
    --to=rkrcmar@redhat.com \
    --cc=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.