All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: qemu-devel@nongnu.org, lvivier@redhat.com,
	Paolo Bonzini <pbonzini@redhat.com>, John Snow <jsnow@redhat.com>,
	qemu-block@nongnu.org, armbru@redhat.com, eblake@redhat.com,
	Hannes Reinecke <hare@suse.com>
Subject: Re: [Qemu-devel] [PATCH for-4.1 4/5] tests/test-hmp: Use qtest_init() instead of qtest_start()
Date: Tue, 9 Apr 2019 10:09:22 +0100	[thread overview]
Message-ID: <20190409090922.GC2964@work-vm> (raw)
In-Reply-To: <20190409085245.31548-5-thuth@redhat.com>

* Thomas Huth (thuth@redhat.com) wrote:
> qtest_start() + qtest_end() should be avoided, since they use the
> global_qtest variable that we want to get rid of in the long run
> Use qtest_init() and qtest_quit() instead.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

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

> ---
>  tests/test-hmp.c | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/tests/test-hmp.c b/tests/test-hmp.c
> index 54a01824dc..f0d843e34a 100644
> --- a/tests/test-hmp.c
> +++ b/tests/test-hmp.c
> @@ -72,13 +72,13 @@ static const char *hmp_cmds[] = {
>  };
>  
>  /* Run through the list of pre-defined commands */
> -static void test_commands(void)
> +static void test_commands(QTestState *qts)
>  {
>      char *response;
>      int i;
>  
>      for (i = 0; hmp_cmds[i] != NULL; i++) {
> -        response = hmp("%s", hmp_cmds[i]);
> +        response = qtest_hmp(qts, "%s", hmp_cmds[i]);
>          if (verbose) {
>              fprintf(stderr,
>                      "\texecute HMP command: %s\n"
> @@ -91,11 +91,11 @@ static void test_commands(void)
>  }
>  
>  /* Run through all info commands and call them blindly (without arguments) */
> -static void test_info_commands(void)
> +static void test_info_commands(QTestState *qts)
>  {
>      char *resp, *info, *info_buf, *endp;
>  
> -    info_buf = info = hmp("help info");
> +    info_buf = info = qtest_hmp(qts, "help info");
>  
>      while (*info) {
>          /* Extract the info command, ignore parameters and description */
> @@ -107,7 +107,7 @@ static void test_info_commands(void)
>          if (verbose) {
>              fprintf(stderr, "\t%s\n", info);
>          }
> -        resp = hmp("%s", info);
> +        resp = qtest_hmp(qts, "%s", info);
>          g_free(resp);
>          /* And move forward to the next line */
>          info = strchr(endp + 1, '\n');
> @@ -124,14 +124,15 @@ static void test_machine(gconstpointer data)
>  {
>      const char *machine = data;
>      char *args;
> +    QTestState *qts;
>  
>      args = g_strdup_printf("-S -M %s", machine);
> -    qtest_start(args);
> +    qts = qtest_init(args);
>  
> -    test_info_commands();
> -    test_commands();
> +    test_info_commands(qts);
> +    test_commands(qts);
>  
> -    qtest_end();
> +    qtest_quit(qts);
>      g_free(args);
>      g_free((void *)data);
>  }
> -- 
> 2.21.0
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

WARNING: multiple messages have this Message-ID (diff)
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: lvivier@redhat.com, Hannes Reinecke <hare@suse.com>,
	qemu-block@nongnu.org, qemu-devel@nongnu.org, armbru@redhat.com,
	Paolo Bonzini <pbonzini@redhat.com>, John Snow <jsnow@redhat.com>
Subject: Re: [Qemu-devel] [PATCH for-4.1 4/5] tests/test-hmp: Use qtest_init() instead of qtest_start()
Date: Tue, 9 Apr 2019 10:09:22 +0100	[thread overview]
Message-ID: <20190409090922.GC2964@work-vm> (raw)
Message-ID: <20190409090922.CQQqpm_xz2VqNf0kWzxma9-NBk7n_5RQuloaViAuF9A@z> (raw)
In-Reply-To: <20190409085245.31548-5-thuth@redhat.com>

* Thomas Huth (thuth@redhat.com) wrote:
> qtest_start() + qtest_end() should be avoided, since they use the
> global_qtest variable that we want to get rid of in the long run
> Use qtest_init() and qtest_quit() instead.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

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

> ---
>  tests/test-hmp.c | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/tests/test-hmp.c b/tests/test-hmp.c
> index 54a01824dc..f0d843e34a 100644
> --- a/tests/test-hmp.c
> +++ b/tests/test-hmp.c
> @@ -72,13 +72,13 @@ static const char *hmp_cmds[] = {
>  };
>  
>  /* Run through the list of pre-defined commands */
> -static void test_commands(void)
> +static void test_commands(QTestState *qts)
>  {
>      char *response;
>      int i;
>  
>      for (i = 0; hmp_cmds[i] != NULL; i++) {
> -        response = hmp("%s", hmp_cmds[i]);
> +        response = qtest_hmp(qts, "%s", hmp_cmds[i]);
>          if (verbose) {
>              fprintf(stderr,
>                      "\texecute HMP command: %s\n"
> @@ -91,11 +91,11 @@ static void test_commands(void)
>  }
>  
>  /* Run through all info commands and call them blindly (without arguments) */
> -static void test_info_commands(void)
> +static void test_info_commands(QTestState *qts)
>  {
>      char *resp, *info, *info_buf, *endp;
>  
> -    info_buf = info = hmp("help info");
> +    info_buf = info = qtest_hmp(qts, "help info");
>  
>      while (*info) {
>          /* Extract the info command, ignore parameters and description */
> @@ -107,7 +107,7 @@ static void test_info_commands(void)
>          if (verbose) {
>              fprintf(stderr, "\t%s\n", info);
>          }
> -        resp = hmp("%s", info);
> +        resp = qtest_hmp(qts, "%s", info);
>          g_free(resp);
>          /* And move forward to the next line */
>          info = strchr(endp + 1, '\n');
> @@ -124,14 +124,15 @@ static void test_machine(gconstpointer data)
>  {
>      const char *machine = data;
>      char *args;
> +    QTestState *qts;
>  
>      args = g_strdup_printf("-S -M %s", machine);
> -    qtest_start(args);
> +    qts = qtest_init(args);
>  
> -    test_info_commands();
> -    test_commands();
> +    test_info_commands(qts);
> +    test_commands(qts);
>  
> -    qtest_end();
> +    qtest_quit(qts);
>      g_free(args);
>      g_free((void *)data);
>  }
> -- 
> 2.21.0
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK


  reply	other threads:[~2019-04-09  9:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-09  8:52 [Qemu-devel] [PATCH for-4.1 0/5] First batch of global_qtest-removement patches for QEMU 4.1 Thomas Huth
2019-04-09  8:52 ` Thomas Huth
2019-04-09  8:52 ` [Qemu-devel] [PATCH for-4.1 1/5] tests/tco: Make test independent of global_qtest Thomas Huth
2019-04-09  8:52   ` Thomas Huth
2019-04-09  8:52 ` [Qemu-devel] [PATCH for-4.1 2/5] tests/megasas: " Thomas Huth
2019-04-09  8:52   ` Thomas Huth
2019-04-09  8:52 ` [Qemu-devel] [PATCH for-4.1 3/5] tests/qmp-cmd-test: Use qtest_init() instead of qtest_start() Thomas Huth
2019-04-09  8:52   ` Thomas Huth
2019-04-09  8:52 ` [Qemu-devel] [PATCH for-4.1 4/5] tests/test-hmp: " Thomas Huth
2019-04-09  8:52   ` Thomas Huth
2019-04-09  9:09   ` Dr. David Alan Gilbert [this message]
2019-04-09  9:09     ` Dr. David Alan Gilbert
2019-04-09  8:52 ` [Qemu-devel] [PATCH for-4.1 5/5] tests/ide-test: Make test independent of global_qtest Thomas Huth
2019-04-09  8:52   ` Thomas Huth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190409090922.GC2964@work-vm \
    --to=dgilbert@redhat.com \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=hare@suse.com \
    --cc=jsnow@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.