qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	 Thomas Huth <thuth@redhat.com>,
	Laurent Vivier <laurent@vivier.eu>
Subject: Re: [PATCH 1/2] qtest: Don't assert on "-qtest chardev:myid"
Date: Fri, 14 Apr 2023 23:01:19 +0400	[thread overview]
Message-ID: <CAMxuvaxBEVN7hca0-hXntHFCUAMVK7L1D8PtpHFu1cM=8dak9Q@mail.gmail.com> (raw)
In-Reply-To: <20230413150724.404304-2-peter.maydell@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 1732 bytes --]

On Thu, Apr 13, 2023 at 7:07 PM Peter Maydell <peter.maydell@linaro.org>
wrote:

> If the -qtest command line argument is passed a string that says
> "use this chardev for I/O", then it will assert:
>
> $ ./build/clang/qemu-system-i386 -chardev file,path=/dev/null,id=myid
> -qtest chardev:myid
> Unexpected error in qtest_set_chardev() at ../../softmmu/qtest.c:1011:
> qemu-system-i386: Cannot find character device 'qtest'
> Aborted (core dumped)
>
> This is because in qtest_server_init() we assume that when we create
> the chardev with qemu_chr_new() it will always have the name "qtest".
> This is true if qemu_chr_new() had to create a new chardev, but not
> true if one already existed and is being referred to with
> "chardev:myid".
>
> Use the name of the chardev we get back from qemu_chr_new() as the
> string to set the qtest 'chardev' property to, instead of hardcoding
> it to "qtest".
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>



> ---
>  softmmu/qtest.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/softmmu/qtest.c b/softmmu/qtest.c
> index 34bd2a33a76..26852996b5b 100644
> --- a/softmmu/qtest.c
> +++ b/softmmu/qtest.c
> @@ -867,7 +867,7 @@ void qtest_server_init(const char *qtest_chrdev, const
> char *qtest_log, Error **
>      }
>
>      qtest = object_new(TYPE_QTEST);
> -    object_property_set_str(qtest, "chardev", "qtest", &error_abort);
> +    object_property_set_str(qtest, "chardev", chr->label, &error_abort);
>      if (qtest_log) {
>          object_property_set_str(qtest, "log", qtest_log, &error_abort);
>      }
> --
> 2.34.1
>
>

[-- Attachment #2: Type: text/html, Size: 2531 bytes --]

  parent reply	other threads:[~2023-04-14 19:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-13 15:07 [PATCH 0/2] chardev/char-file: Allow setting input file on command line Peter Maydell
2023-04-13 15:07 ` [PATCH 1/2] qtest: Don't assert on "-qtest chardev:myid" Peter Maydell
2023-04-14 14:50   ` Thomas Huth
2023-04-14 19:01   ` Marc-André Lureau [this message]
2023-04-13 15:07 ` [PATCH 2/2] chardev: Allow setting file chardev input file on the command line Peter Maydell
2023-04-14 14:03   ` Philippe Mathieu-Daudé
2023-04-14 14:21     ` Peter Maydell
2023-04-14 14:52   ` Thomas Huth
2023-04-14 19:33   ` Marc-André Lureau

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='CAMxuvaxBEVN7hca0-hXntHFCUAMVK7L1D8PtpHFu1cM=8dak9Q@mail.gmail.com' \
    --to=marcandre.lureau@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.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 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).