[Xen-devel,OSSTEST,02/17] make-flight: refactor common function "stripy" into helper library

Message ID 1390384501-20552-2-git-send-email-ian.campbell@citrix.com
State New
Headers show

Commit Message

Ian Campbell Jan. 22, 2014, 9:54 a.m.
Will be useful for other make-flight variants.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 make-flight | 18 +-----------------
 mfi-common  | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 17 deletions(-)
 create mode 100644 mfi-common

Patch

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 <http://www.gnu.org/licenses/>.
+
+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: