Message ID | 1398681696-2773-5-git-send-email-ian.campbell@citrix.com |
---|---|
State | New |
Headers | show |
Ian Campbell writes ("[PATCH OSSTEST v2 05/15] TestSupport: Add helper to wait for a guest to shutdown"): > Signed-off-by: Ian Campbell <ian.campbell@citrix.com> ... > @@ -1249,6 +1250,17 @@ sub guest_await_reboot ($$$) { > return undef if $st eq 'sr'; > fail("guest unexpectedly shutdown; state is '$st'") > if $st =~ m/^s/ || $st eq ''; > + return "guest state is \"$st\""; > + }); > +} > + > +sub guest_await_shutdown ($$$) { > + my ($ho,$gho, $timeout) = @_; > + poll_loop($timeout, 30, "await shutdown request from $gho->{Guest}", sub { > + my $st= guest_get_state($ho,$gho); > + return undef if $st eq 's'; > + fail("guest unexpectedly shutdown; state is '$st'") > + if $st =~ m/^s/ || $st eq ''; This function is practically identical to guest_await_reboot. Ian.
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 35838a7..b283e07 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -91,7 +91,8 @@ BEGIN { guest_umount_lv guest_await guest_await_dhcp_tcp guest_checkrunning guest_check_ip guest_find_ether guest_find_domid guest_check_up guest_check_up_quick - guest_get_state guest_await_reboot guest_destroy + guest_get_state guest_await_reboot + guest_await_shutdown guest_destroy guest_vncsnapshot_begin guest_vncsnapshot_stash guest_check_remus_ok guest_editconfig host_involves_pcipassthrough host_get_pcipassthrough_devs @@ -1249,6 +1250,17 @@ sub guest_await_reboot ($$$) { return undef if $st eq 'sr'; fail("guest unexpectedly shutdown; state is '$st'") if $st =~ m/^s/ || $st eq ''; + return "guest state is \"$st\""; + }); +} + +sub guest_await_shutdown ($$$) { + my ($ho,$gho, $timeout) = @_; + poll_loop($timeout, 30, "await shutdown request from $gho->{Guest}", sub { + my $st= guest_get_state($ho,$gho); + return undef if $st eq 's'; + fail("guest unexpectedly shutdown; state is '$st'") + if $st =~ m/^s/ || $st eq ''; return "guest state is $st"; }); }
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> --- Osstest/TestSupport.pm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)