From: Ian Campbell Subject: [PATCH OSSTEST 02/17] make-flight: refactor common function "stripy" into helper library Date: Wed, 22 Jan 2014 09:54:46 +0000 Message-ID: <1390384501-20552-2-git-send-email-ian.campbell@citrix.com> References: <1390384419.32519.32.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1390384419.32519.32.camel@kazak.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: ian.jackson@eu.citrix.com Cc: Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org Will be useful for other make-flight variants. Signed-off-by: Ian Campbell --- make-flight | 18 +----------------- mfi-common | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 17 deletions(-) create mode 100644 mfi-common diff --git a/make-flight b/make-flight index ddd4427..fdde3af 100755 --- a/make-flight +++ b/make-flight @@ -28,6 +28,7 @@ flight=`./cs-flight-create $blessing $branch` . ap-common . cri-common +. mfi-common defsuite=`getconfig DebianSuite` defguestsuite=`getconfig GuestDebianSuite` @@ -208,23 +209,6 @@ else fi -stripy () { - local out_vn="$1"; shift - local out_0="$1"; shift - local out_1="$1"; shift - local out_val=0 - local this_val - local this_cmp - while [ $# != 0 ]; do - this_val="$1"; shift - this_cmp="$1"; shift - if [ "x$this_val" = "x$this_cmp" ]; then - out_val=$(( $out_val ^ 1 )) - fi - done - eval "$out_vn=\"\$out_$out_val\"" -} - job_create_test () { local job=$1; shift local recipe=$1; shift diff --git a/mfi-common b/mfi-common new file mode 100644 index 0000000..ec0beca --- /dev/null +++ b/mfi-common @@ -0,0 +1,38 @@ +# This is part of "osstest", an automated testing framework for Xen. +# Copyright (C) 2009-2014 Citrix Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +stripy () { + local out_vn="$1"; shift + local out_0="$1"; shift + local out_1="$1"; shift + local out_val=0 + local this_val + local this_cmp + while [ $# != 0 ]; do + this_val="$1"; shift + this_cmp="$1"; shift + if [ "x$this_val" = "x$this_cmp" ]; then + out_val=$(( $out_val ^ 1 )) + fi + done + eval "$out_vn=\"\$out_$out_val\"" +} + +# Local variables: +# mode: sh +# sh-basic-offset: 2 +# indent-tabs-mode: nil +# End: -- 1.8.5.2