All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH OSSTEST v2] standalone: Extend -h to support ident=host style specifications
@ 2015-07-31  8:26 Ian Campbell
  2015-07-31 15:24 ` Ian Jackson
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Campbell @ 2015-07-31  8:26 UTC (permalink / raw)
  To: ian.jackson, xen-devel; +Cc: Ian Campbell

Allowing for multi-host tests.

Also make reset-host reset all hosts.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
v2: Fix regex for reset-host
    Correct handling/ordering of multiple uses of -h
---
 standalone | 47 ++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 36 insertions(+), 11 deletions(-)

diff --git a/standalone b/standalone
index e9a74c1..873616a 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="$hosts $ident=$h"
+	    ;;
+	*)
+	    hosts="$hosts host=$h"
+	    ;;
+    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 '/(?:\w+_)?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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH OSSTEST v2] standalone: Extend -h to support ident=host style specifications
  2015-07-31  8:26 [PATCH OSSTEST v2] standalone: Extend -h to support ident=host style specifications Ian Campbell
@ 2015-07-31 15:24 ` Ian Jackson
  2015-08-05 10:50   ` Ian Campbell
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Jackson @ 2015-07-31 15:24 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel

Ian Campbell writes ("[PATCH OSSTEST v2] standalone: Extend -h to support ident=host style specifications"):
> Allowing for multi-host tests.
> 
> Also make reset-host reset all hosts.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH OSSTEST v2] standalone: Extend -h to support ident=host style specifications
  2015-07-31 15:24 ` Ian Jackson
@ 2015-08-05 10:50   ` Ian Campbell
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Campbell @ 2015-08-05 10:50 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

On Fri, 2015-07-31 at 16:24 +0100, Ian Jackson wrote:
> Ian Campbell writes ("[PATCH OSSTEST v2] standalone: Extend -h to support 
> ident=host style specifications"):
> > Allowing for multi-host tests.
> > 
> > Also make reset-host reset all hosts.
> 
> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

Thanks, added to pretest.

Ian.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-05 10:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-31  8:26 [PATCH OSSTEST v2] standalone: Extend -h to support ident=host style specifications Ian Campbell
2015-07-31 15:24 ` Ian Jackson
2015-08-05 10:50   ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.