From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [kvm-unit-tests PATCH v4 11/13] scripts/runtime: skip tests that cannot run Date: Wed, 11 May 2016 18:30:41 +0200 Message-ID: <1462984243-5783-2-git-send-email-rkrcmar@redhat.com> References: <1462983171-4208-1-git-send-email-rkrcmar@redhat.com> <1462984243-5783-1-git-send-email-rkrcmar@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Paolo Bonzini , Andrew Jones To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:45781 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751692AbcEKQa4 (ORCPT ); Wed, 11 May 2016 12:30:56 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6DCC163147 for ; Wed, 11 May 2016 16:30:50 +0000 (UTC) In-Reply-To: <1462984243-5783-1-git-send-email-rkrcmar@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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=3D/dev/null =46AIL streak is covered too. Some error messages in arch/run were reworded, because they are now visible in summary. Signed-off-by: Radim Kr=C4=8Dm=C3=A1=C5=99 --- v4: * clarified "kvm only" error message [Drew+Luk=C3=A1=C5=A1] * 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 =20 if [ "$ACCEL" =3D "kvm" ] && [ "$kvm_available" !=3D "yes" ]; then - echo "skip $TESTNAME (kvm only)" + echo "KVM is needed, but not available on this host" exit 2 fi =20 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 =20 if [ "$ACCEL" =3D "kvm" ] && [ "$kvm_available" !=3D "yes" ]; then - echo "skip $TESTNAME (kvm only)" + echo "KVM is needed, but not available on this host" exit 2 fi =20 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/$/)/' } =20 +# We assume that QEMU is going to work if it tried to load the kernel +premature_failure() +{ + local log=3D"$(eval $(get_cmdline _NO_FILE_4Uhere_) 2>&1)" + local last_line=3D$(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=3D$1 + echo "TESTNAME=3D$testname TIMEOUT=3D$timeout ACCEL=3D$accel $RUNT= IME_arch_run $kernel -smp $smp $opts" +} + function run() { local testname=3D"$1" @@ -48,7 +69,12 @@ function run() fi done =20 - cmdline=3D"TESTNAME=3D$testname TIMEOUT=3D$timeout ACCEL=3D$accel = $RUNTIME_arch_run $kernel -smp $smp $opts" + last_line=3D$(premature_failure) && { + echo "`SKIP` $1 ($last_line)" + return 77 + } + + cmdline=3D$(get_cmdline $kernel) if [ "$verbose" =3D "yes" ]; then echo $cmdline fi --=20 2.8.2