[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH OSSTEST] standalone: Extend -h to support ident=host style specifications



Allowing for multi-host tests.

Also make reset-host reset all hosts.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 standalone | 47 ++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 36 insertions(+), 11 deletions(-)

diff --git a/standalone b/standalone
index e9a74c1..584c07a 100755
--- a/standalone
+++ b/standalone
@@ -31,15 +31,17 @@ Operations:
 
 * reset-host [cf] [JOB]
 
-  Allow a job which has been run before to run on a different host
-  next time. Otherwise osstest will complain if you change the host
-  which a job is running on on successive runs.
+  Allow a job which has been run before to run on a different host or
+  hosts next time. Otherwise osstest will complain if you change the
+  host(s) which a job is running on on successive runs.
 
 Options:
 
 -c FILE, --config=FILE        Use FILE as configuration file
 -f FLIGHT, --flight=FLIGHT    Operate on FLIGHT
--h HOST, --host=HOST          Test host
+-h HOST, --host=HOST          Test host, HOST can also be ident=HOST can
+                              be given multiple times, not that the
+                              order matters in some cases (e.g run-test)
 -r, --reuse                   Do not wipe test host (default)
 -R, --noreuse, --reinstall    Wipe the test host (if job or test does so)
 -s, --simulate, --dry-run     Dry run, printing what would be run
@@ -76,17 +78,39 @@ else
     config=$HOME/.xen-osstest/config
 fi
 flight="standalone"
-host=
+hosts=
 reuse=1 # Don't blow away machines by default
 dryrun=0
 lvextendmax=50 # Leave some LVM space free for running tests
 nobaseline=y
 
+add_host() {
+    local h=$1
+    case $h in
+       *=*)
+           local ident=${h/=*}
+           h=${h/*=}
+           hosts="$ident=$h $hosts"
+           ;;
+       *)
+           hosts="host=$h $hosts"
+           ;;
+    esac
+}
+
+export_hosts_environ() {
+    for h in $hosts ; do
+       local ident=${h/=*}
+       h=${h/*=}
+       eval export OSSTEST_HOST_${ident^^}=$h
+    done
+}
+
 while true ; do
     case "$1" in
        -c|--config) config=$2; shift 2;;
        -f|--flight) flight=$2; shift 2;;
-       -h|--host)   host=$2;   shift 2;;
+       -h|--host)   add_host $2; shift 2;;
        -r|--reuse)  reuse=1;   shift 1;;
        -R|--noreuse|--reinstall)reuse=0;shift 1;;
        -s|--simulate|--dry-run)dryrun=1;shift 1;;
@@ -111,7 +135,7 @@ if ! ssh-add -l >/dev/null ] ; then
 fi
 
 if [ $reuse -eq 0 ]; then
-    echo "WARNING: Will blow away machine..."
+    echo "WARNING: Will blow away machine(s)..."
     echo "Press ENTER to confirm."
     read
 fi
@@ -142,7 +166,7 @@ need_flight() {
     fi
 }
 need_host() {
-    if [ -z "$host" ] ; then
+    if [ "x$hosts" = x ] ; then
        echo "run-job: Need a host" >&2
        exit 1
     fi
@@ -240,7 +264,7 @@ case $op in
        fi
 
        job=$1; shift
-       ./cs-adjust-flight -v $flight runvar-del $job host
+       ./cs-adjust-flight -v $flight runvar-del $job '/host$'
        ;;
 
     run-job)
@@ -253,9 +277,10 @@ case $op in
 
        job=$1; shift
 
+       export_hosts_environ
+
         OSSTEST_CONFIG=$config \
        OSSTEST_FLIGHT=$flight \
-       OSSTEST_HOST_HOST=$host \
        OSSTEST_HOST_REUSE=$reuse \
        OSSTEST_SIMULATE=$dryrun \
            with_logging logs/$flight/$job.log ./sg-run-job $job
@@ -275,7 +300,7 @@ case $op in
        OSSTEST_FLIGHT=$flight \
        OSSTEST_HOST_REUSE=$reuse \
        OSSTEST_JOB=$job \
-           with_logging logs/$flight/$job.$ts.log ./$ts host=$host $@
+           with_logging logs/$flight/$job.$ts.log ./$ts $hosts $@
        ;;
     *)
        echo "Unknown op $op" ; exit 1 ;;
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.