From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PATCH kvm-unit-tests v2 01/12] run_tests: move run() to scripts/ Date: Thu, 17 Dec 2015 18:53:32 +0100 Message-ID: <1450374823-7648-2-git-send-email-rkrcmar@redhat.com> References: <1450374823-7648-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]:56532 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751958AbbLQRx6 (ORCPT ); Thu, 17 Dec 2015 12:53:58 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id EA2578F266 for ; Thu, 17 Dec 2015 17:53:57 +0000 (UTC) In-Reply-To: <1450374823-7648-1-git-send-email-rkrcmar@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: We'll be using it from scripts/mkstandalone later. Signed-off-by: Radim Kr=C4=8Dm=C3=A1=C5=99 --- v2: new =20 run_tests.sh | 53 +-----------------------------------------------= ----- scripts/run.bash | 51 ++++++++++++++++++++++++++++++++++++++++++++++++= +++ 2 files changed, 52 insertions(+), 52 deletions(-) create mode 100644 scripts/run.bash diff --git a/run_tests.sh b/run_tests.sh index fad22a935b00..58949e39c38c 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -6,63 +6,12 @@ if [ ! -f config.mak ]; then fi source config.mak source scripts/functions.bash +source scripts/run.bash =20 config=3D$TEST_DIR/unittests.cfg qemu=3D${QEMU:-qemu-system-$ARCH} verbose=3D0 =20 -function run() -{ - local testname=3D"$1" - local groups=3D"$2" - local smp=3D"$3" - local kernel=3D"$4" - local opts=3D"$5" - local arch=3D"$6" - local check=3D"$7" - local accel=3D"$8" - - if [ -z "$testname" ]; then - return - fi - - if [ -n "$only_group" ] && ! grep -q "$only_group" <<<$groups; the= n - return - fi - - if [ -n "$arch" ] && [ "$arch" !=3D "$ARCH" ]; then - echo "skip $1 ($arch only)" - return - fi - - # 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 - fi - done - - cmdline=3D"TESTNAME=3D$testname ACCEL=3D$accel ./$TEST_DIR-run $ke= rnel -smp $smp $opts" - if [ $verbose !=3D 0 ]; then - echo $cmdline - fi - - # extra_params in the config file may contain backticks that need = to be - # expanded, so use eval to start qemu - eval $cmdline >> test.log - - if [ $? -le 1 ]; then - echo -e "\e[32mPASS\e[0m $1" - else - echo -e "\e[31mFAIL\e[0m $1" - fi -} - function usage() { cat <=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 + fi + done + + cmdline=3D"TESTNAME=3D$testname ACCEL=3D$accel ./$TEST_DIR-run $ke= rnel -smp $smp $opts" + if [ $verbose !=3D 0 ]; then + echo $cmdline + fi + + # extra_params in the config file may contain backticks that need = to be + # expanded, so use eval to start qemu + eval $cmdline >> test.log + + if [ $? -le 1 ]; then + echo -e "\e[32mPASS\e[0m $1" + else + echo -e "\e[31mFAIL\e[0m $1" + fi +} --=20 2.6.4