qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] tests/migration: Do not use functions anymore that rely on global_qtest
@ 2019-08-20 15:01 Thomas Huth
  2019-08-20 15:38 ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Huth @ 2019-08-20 15:01 UTC (permalink / raw)
  To: qemu-devel, Juan Quintela, Dr. David Alan Gilbert; +Cc: Laurent Vivier

The migration tests deal with multiple test states, so we really should
not use functions here that rely on the single global_qtest variable.
Switch from qtest_start() to qtest_init() to make sure that global_qtest
is not set anymore. This also revealed a regression in the migrate()
function: It has once been converted to use the qtest_qmp() function,
but commit b5bbd3f315d686bd511 ("Clean up string interpolation into QMP,
part 2") accidentally reverted it back to qmp().

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/migration-test.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/migration-test.c b/tests/migration-test.c
index b87ba99a9e..a9f81cc185 100644
--- a/tests/migration-test.c
+++ b/tests/migration-test.c
@@ -490,7 +490,7 @@ static void migrate(QTestState *who, const char *uri, const char *fmt, ...)
     g_assert(!qdict_haskey(args, "uri"));
     qdict_put_str(args, "uri", uri);
 
-    rsp = qmp("{ 'execute': 'migrate', 'arguments': %p}", args);
+    rsp = qtest_qmp(who, "{ 'execute': 'migrate', 'arguments': %p}", args);
 
     g_assert(qdict_haskey(rsp, "return"));
     qobject_unref(rsp);
@@ -625,7 +625,7 @@ static int test_migrate_start(QTestState **from, QTestState **to,
         cmd_dst = tmp;
     }
 
-    *from = qtest_start(cmd_src);
+    *from = qtest_init(cmd_src);
     g_free(cmd_src);
 
     *to = qtest_init(cmd_dst);
@@ -715,7 +715,7 @@ static void test_deprecated(void)
 {
     QTestState *from;
 
-    from = qtest_start("-machine none");
+    from = qtest_init("-machine none");
 
     deprecated_set_downtime(from, 0.12345);
     deprecated_set_speed(from, 12345);
-- 
2.18.1



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

* Re: [Qemu-devel] [PATCH] tests/migration: Do not use functions anymore that rely on global_qtest
  2019-08-20 15:01 [Qemu-devel] [PATCH] tests/migration: Do not use functions anymore that rely on global_qtest Thomas Huth
@ 2019-08-20 15:38 ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 2+ messages in thread
From: Dr. David Alan Gilbert @ 2019-08-20 15:38 UTC (permalink / raw)
  To: Thomas Huth; +Cc: Laurent Vivier, qemu-devel, Juan Quintela

* Thomas Huth (thuth@redhat.com) wrote:
> The migration tests deal with multiple test states, so we really should
> not use functions here that rely on the single global_qtest variable.
> Switch from qtest_start() to qtest_init() to make sure that global_qtest
> is not set anymore. This also revealed a regression in the migrate()
> function: It has once been converted to use the qtest_qmp() function,
> but commit b5bbd3f315d686bd511 ("Clean up string interpolation into QMP,
> part 2") accidentally reverted it back to qmp().
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  tests/migration-test.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/migration-test.c b/tests/migration-test.c
> index b87ba99a9e..a9f81cc185 100644
> --- a/tests/migration-test.c
> +++ b/tests/migration-test.c
> @@ -490,7 +490,7 @@ static void migrate(QTestState *who, const char *uri, const char *fmt, ...)
>      g_assert(!qdict_haskey(args, "uri"));
>      qdict_put_str(args, "uri", uri);
>  
> -    rsp = qmp("{ 'execute': 'migrate', 'arguments': %p}", args);
> +    rsp = qtest_qmp(who, "{ 'execute': 'migrate', 'arguments': %p}", args);

It took me some time to figure out what %p really meant since libqtest.h
tells me to see the non-existent parse_escape, which is actually
parse_interpolation.

Dave

>      g_assert(qdict_haskey(rsp, "return"));
>      qobject_unref(rsp);
> @@ -625,7 +625,7 @@ static int test_migrate_start(QTestState **from, QTestState **to,
>          cmd_dst = tmp;
>      }
>  
> -    *from = qtest_start(cmd_src);
> +    *from = qtest_init(cmd_src);
>      g_free(cmd_src);
>  
>      *to = qtest_init(cmd_dst);
> @@ -715,7 +715,7 @@ static void test_deprecated(void)
>  {
>      QTestState *from;
>  
> -    from = qtest_start("-machine none");
> +    from = qtest_init("-machine none");
>  
>      deprecated_set_downtime(from, 0.12345);
>      deprecated_set_speed(from, 12345);
> -- 
> 2.18.1
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK


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

end of thread, other threads:[~2019-08-20 15:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-20 15:01 [Qemu-devel] [PATCH] tests/migration: Do not use functions anymore that rely on global_qtest Thomas Huth
2019-08-20 15:38 ` Dr. David Alan Gilbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).