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 13/13] scripts/run: generalize check Date: Wed, 11 May 2016 18:30:43 +0200 Message-ID: <1462984243-5783-4-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]:47807 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751936AbcEKQa4 (ORCPT ); Wed, 11 May 2016 12:30:56 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (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 212FD90E5E for ; Wed, 11 May 2016 16:30:56 +0000 (UTC) In-Reply-To: <1462984243-5783-1-git-send-email-rkrcmar@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: config attribute "check" is currently unused and a simpler imlementatio= n has better chances of being used. Signed-off-by: Radim Kr=C4=8Dm=C3=A1=C5=99 --- v4: new scripts/runtime.bash | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/scripts/runtime.bash b/scripts/runtime.bash index c9ab9ba47d81..7f9bf9a2de0e 100644 --- a/scripts/runtime.bash +++ b/scripts/runtime.bash @@ -57,17 +57,11 @@ function run() return 2 fi =20 - # check a file for a particular value before running a test - # the check line can contain multiple files to check separated by = a space - # but each check parameter needs to be of the form =3D - for check_param in ${check[@]}; do - path=3D${check_param%%=3D*} - value=3D${check_param#*=3D} - if [ "$path" ] && [ "$(cat $path)" !=3D "$value" ]; then - echo "`SKIP` $1 ($path not equal to $value)" - return 2 - fi - done + eval $check || { + echo "skipped $testname (\`$check\` returned $?)" | RUNTIME_lo= g_stderr + echo "`SKIP` $testname (check failed)" + return 77 + } =20 last_line=3D$(premature_failure) && { echo "`SKIP` $1 ($last_line)" --=20 2.8.2