Re: [Xen-devel] [PATCH OSSTEST v2 03/13] osstest migrate support check catch -> variables

2015-07-22 Thread Ian Campbell
On Tue, 2015-07-21 at 18:36 +0100, Ian Jackson wrote:
> Wei Liu writes ("Re: [PATCH OSSTEST v2 03/13] osstest migrate support 
> check catch -> variables"):
> > Do I need to change anything in this patch? I guess not? It's not 
> > very
> > clear to me.
> 
> Ian C was asking whether the patch (which I wrote) was right, in a
> particular respect.  I answered that it is correct.  So no, you don't
> need to do anything to this patch.

Right, that question was really address to Ian to confirm my
understanding of how Tcl works...

He's explained and I understood correctly, s:
Acked-by: Ian Campbell 

Ian.


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


Re: [Xen-devel] [PATCH OSSTEST v2 03/13] osstest migrate support check catch -> variables

2015-07-21 Thread Ian Jackson
Wei Liu writes ("Re: [PATCH OSSTEST v2 03/13] osstest migrate support check 
catch -> variables"):
> Do I need to change anything in this patch? I guess not? It's not very
> clear to me.

Ian C was asking whether the patch (which I wrote) was right, in a
particular respect.  I answered that it is correct.  So no, you don't
need to do anything to this patch.

Ian.

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


Re: [Xen-devel] [PATCH OSSTEST v2 03/13] osstest migrate support check catch -> variables

2015-07-21 Thread Wei Liu
On Tue, Jul 21, 2015 at 05:32:25PM +0100, Ian Jackson wrote:
> Ian Campbell writes ("Re: [PATCH OSSTEST v2 03/13] osstest migrate support 
> check catch -> variables"):
> > On Sun, 2015-07-12 at 17:20 +0100, Wei Liu wrote:
> > > @@ -300,7 +300,9 @@ proc run-job/test-pair {} {
> > >  proc test-guest-migr {g} {
> > > -if {[catch { run-ts . = ts-migrate-support-check + host $g }]} return
> > > +set to_reap [spawn-ts . = ts-migrate-support-check + host $g]
> > 
> > Most other uses of spawn-ts use [eval spawn-ts ]. I think those
> > are just trying to expand a $args into multiple arguments to spawn-ts,
> > and hence that isn't needed here (because $g is a singleton argument
> > already). But TBH I don't know...
> 
> Yes, the effect of the
> set reap [eval spawn-ts $args]
> is to expand the list in $args as arguments to spawn-ts.  $g is a
> singleton as you say, not a list.
> 
> spawn-ts has the same argument convention as run-ts.
> 

Do I need to change anything in this patch? I guess not? It's not very
clear to me.

Wei.

> Ian.

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


Re: [Xen-devel] [PATCH OSSTEST v2 03/13] osstest migrate support check catch -> variables

2015-07-21 Thread Ian Jackson
Ian Campbell writes ("Re: [PATCH OSSTEST v2 03/13] osstest migrate support 
check catch -> variables"):
> On Sun, 2015-07-12 at 17:20 +0100, Wei Liu wrote:
> > @@ -300,7 +300,9 @@ proc run-job/test-pair {} {
> >  proc test-guest-migr {g} {
> > -if {[catch { run-ts . = ts-migrate-support-check + host $g }]} return
> > +set to_reap [spawn-ts . = ts-migrate-support-check + host $g]
> 
> Most other uses of spawn-ts use [eval spawn-ts ]. I think those
> are just trying to expand a $args into multiple arguments to spawn-ts,
> and hence that isn't needed here (because $g is a singleton argument
> already). But TBH I don't know...

Yes, the effect of the
set reap [eval spawn-ts $args]
is to expand the list in $args as arguments to spawn-ts.  $g is a
singleton as you say, not a list.

spawn-ts has the same argument convention as run-ts.

Ian.

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


Re: [Xen-devel] [PATCH OSSTEST v2 03/13] osstest migrate support check catch -> variables

2015-07-13 Thread Ian Campbell
On Sun, 2015-07-12 at 17:20 +0100, Wei Liu wrote:
> @@ -300,7 +300,9 @@ proc run-job/test-pair {} {
>  }
>  
>  proc test-guest-migr {g} {
> -if {[catch { run-ts . = ts-migrate-support-check + host $g }]} return
> +set to_reap [spawn-ts . = ts-migrate-support-check + host $g]

Most other uses of spawn-ts use [eval spawn-ts ]. I think those
are just trying to expand a $args into multiple arguments to spawn-ts,
and hence that isn't needed here (because $g is a singleton argument
already). But TBH I don't know...



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


[Xen-devel] [PATCH OSSTEST v2 03/13] osstest migrate support check catch -> variables

2015-07-12 Thread Wei Liu
From: Ian Jackson 

The goal here is to skip the following test steps if the check fails.

Instead of using catch to turn an exception into value, we can just
use spawn-ts and reap-ts to do that. This pattern is useful when we add
in extra check for save / restore check later.

Signed-off-by: Ian Jackson 
[ wei: write commit message ]
Signed-off-by: Wei Liu 
---
 sg-run-job | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sg-run-job b/sg-run-job
index d53fd83..61f88fb 100755
--- a/sg-run-job
+++ b/sg-run-job
@@ -300,7 +300,9 @@ proc run-job/test-pair {} {
 }
 
 proc test-guest-migr {g} {
-if {[catch { run-ts . = ts-migrate-support-check + host $g }]} return
+set to_reap [spawn-ts . = ts-migrate-support-check + host $g]
+set can_migrate [reap-ts $to_reap]
+if {!$can_migrate} return
 
 foreach iteration {{} .2} {
 run-ts . =$iteration ts-guest-saverestore + host $g
-- 
1.9.1


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