[Spice-devel] [spice/tests/migrate v1 2/4] tests: migrate: wait user launch client option

Victor Toso victortoso at redhat.com
Mon Oct 7 08:10:56 UTC 2019


Hi,

On Sun, Oct 06, 2019 at 10:49:13AM +0300, Uri Lublin wrote:
> On 10/4/19 11:37 AM, Victor Toso > On Thu, Oct 03, 2019 at 05:13:46PM +0300,
> Uri Lublin wrote:>> On 10/3/19 1:14 PM, Victor Toso wrote:>>> From: Victor
> Toso <me at victortoso.com>>>>>>> Useful to test different clients running
> different tools (gdb,>>> valgrind).>>>>>> Signed-off-by: Victor Toso
> <victortoso at redhat.com>>>> --->>>    tests/migrate.py | 13 +++++++++---->>>
> 1 file changed, 9 insertions(+), 4 deletions(-)>>>>>> diff --git
> a/tests/migrate.py b/tests/migrate.py>>> index 5ed9eba4..88e17691 100755>>>
> --- a/tests/migrate.py>>> +++ b/tests/migrate.py>>> @@ -63,6 +63,8 @@ def
> get_args():>>>              help="Append options for agent's
> virtserialport")>>>  parser.add_argument('--wait-user-input',
> dest="wait_user_input", action='store_true', default=False,>>> help="Wait
> user's input to start migration test")>>> +
> parser.add_argument('--wait-user-connect', dest="wait_user_connect",
> action='store_true', default=False,>>> + help="Wait spice client to connect
> to move to next step of migration (default False)")>>>> Consider adding a
> check for both --wait-user-connect and --client=non-none>> (which I expect
> will break something)
> > Not really, runs fine here (assuming you mean a valid client such
> > as spicy or remote-viewer)
> 
> I do mean with e.g. remote-viewer.
> 
> The problem is that there are two clients in this scenario:
>  1. the one that is started by the script (--client)
>  2. the one that is started by the user ( --wait-user-connect )

Not sure where is the problem? If you mean issues in the client
itself, reproducing them easily is the reason I started to poke
with this migrate.py! I'm trying to address them now.

Just to be 100% clear, I'm fine in having specific client
launched (1) for automated testing scenarios, so you don't need
to run a client by yourself; I'm happy in having (2) for
debugging and also to play with different clients.

Thanks for the comments and reviews!
Victor

> Uri.
> 
> > 
> > With --wait-user-connect it launches but migration only starts
> > after connection is established. Also tried with
> > --wait-user-input and client connects but no migration happens
> > till some keystroke on console.
> > 
> 
> > Thanks for the reviews!
> > Victor
> > 
> > > Uri.
> > > 
> > > >        parser.add_argument('--count', dest='counter', type=int, default=100,
> > > >                            help="Number of migrations to run (set 0 for infinite)")
> > > >        args = parser.parse_args(sys.argv[1:])
> > > > @@ -174,25 +176,28 @@ class Migrator(object):
> > > >                if os.path.exists(x):
> > > >                    os.unlink(x)
> > > > -    def iterate(self, wait_for_user_input=False):
> > > > +    def iterate(self, wait_for_user_input=False, wait_user_connect=False):
> > > >            wait_active(self.active.qmp, True)
> > > >            wait_active(self.target.qmp, False)
> > > >            if not self.connected_client:
> > > >                if self.client:
> > > >                    self.connected_client = start_client(client=self.client, spice_port=self.spice_ports[0])
> > > > -                wait_for_event(self.active.qmp, 'SPICE_INITIALIZED')
> > > >                if wait_for_user_input:
> > > >                    print "waiting for Enter to start migrations"
> > > >                    raw_input()
> > > > +        # Tester can launch its own client or we wait start_client() to connect
> > > > +        if wait_user_connect:
> > > > +            wait_for_event(self.active.qmp, 'SPICE_INITIALIZED')
> > > > +
> > > >            self.active.qmp.cmd('client_migrate_info', {'protocol':'spice',
> > > >                'hostname':'localhost', 'port':self.target.spice_port})
> > > >            self.active.qmp.cmd('migrate', {'uri': 'tcp:localhost:%s' % self.migration_port})
> > > >            wait_active(self.active.qmp, False)
> > > >            wait_active(self.target.qmp, True)
> > > > -        if self.connected_client:
> > > > +        if self.connected_client or wait_user_connect:
> > > >                wait_for_event(self.target.qmp, 'SPICE_CONNECTED')
> > > >            dead = self.active
> > > > @@ -224,7 +229,7 @@ def main():
> > > >        atexit.register(cleanup, migrator)
> > > >        counter = 0
> > > >        while args.counter == 0 or counter < args.counter:
> > > > -        migrator.iterate(args.wait_user_input)
> > > > +        migrator.iterate(args.wait_user_input, args.wait_user_connect)
> > > >            counter += 1
> > > >    if __name__ == '__main__':
> > > > 
> > > 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20191007/0fb1957b/attachment.sig>


More information about the Spice-devel mailing list