From: Andrew Jones Subject: [kvm-unit-tests PATCH v2 1/6] run_tests.sh: share run_all as for_each_unittest Date: Mon, 13 Jul 2015 19:02:58 +0200 Message-ID: <1436806983-29783-2-git-send-email-drjones@redhat.com> References: <1436806983-29783-1-git-send-email-drjones@redhat.com> Cc: pbonzini@redhat.com, mtosatti@redhat.com, jen@redhat.com To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:46624 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750792AbbGMRDJ (ORCPT ); Mon, 13 Jul 2015 13:03:09 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 908941CA6DE for ; Mon, 13 Jul 2015 17:03:09 +0000 (UTC) In-Reply-To: <1436806983-29783-1-git-send-email-drjones@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: To avoid duplicating unittests.cfg parsing code in other scripts, let's put it in a file where it can be shared. Signed-off-by: Andrew Jones --- run_tests.sh | 46 ++-------------------------------------------- scripts/functions.bash | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 44 deletions(-) create mode 100644 scripts/functions.bash diff --git a/run_tests.sh b/run_tests.sh index e48f1db049f81..ebb7e9fe6fdfc 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -5,6 +5,7 @@ if [ ! -f config.mak ]; then exit fi source config.mak +source scripts/functions.bash config=$TEST_DIR/unittests.cfg qemu=${QEMU:-qemu-system-$ARCH} @@ -61,49 +62,6 @@ function run() fi } -function run_all() -{ - local config="$1" - local testname - local smp - local kernel - local opts - local groups - local arch - local check - - exec {config_fd}<$config - - while read -u $config_fd line; do - if [[ "$line" =~ ^\[(.*)\]$ ]]; then - run "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" - testname=${BASH_REMATCH[1]} - smp=1 - kernel="" - opts="" - groups="" - arch="" - check="" - elif [[ $line =~ ^file\ *=\ *(.*)$ ]]; then - kernel=$TEST_DIR/${BASH_REMATCH[1]} - elif [[ $line =~ ^smp\ *=\ *(.*)$ ]]; then - smp=${BASH_REMATCH[1]} - elif [[ $line =~ ^extra_params\ *=\ *(.*)$ ]]; then - opts=${BASH_REMATCH[1]} - elif [[ $line =~ ^groups\ *=\ *(.*)$ ]]; then - groups=${BASH_REMATCH[1]} - elif [[ $line =~ ^arch\ *=\ *(.*)$ ]]; then - arch=${BASH_REMATCH[1]} - elif [[ $line =~ ^check\ *=\ *(.*)$ ]]; then - check=${BASH_REMATCH[1]} - fi - done - - run "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" - - exec {config_fd}<&- -} - function usage() { cat <