qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Alex Bennée" <alex.bennee@linaro.org>,
	"Julia Suvorova" <jusual@mail.ru>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Thomas Huth" <thuth@redhat.com>,
	"Steffen Görtz" <contrib@steffen-goertz.de>,
	qemu-devel@nongnu.org, "Joel Stanley" <joel@jms.id.au>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Jim Mussared" <jim@groklearning.com>
Subject: Re: [Qemu-devel] [PATCH v5 1/3] tests/libqtest: Introduce qtest_init_with_serial()
Date: Wed, 23 Jan 2019 08:44:12 -0600	[thread overview]
Message-ID: <8f1c4cff-c186-9fc3-10ee-7f628882ef82@redhat.com> (raw)
In-Reply-To: <87zhrrzc8l.fsf@linaro.org>

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

On 1/23/19 8:20 AM, Alex Bennée wrote:
> 
> Julia Suvorova <jusual@mail.ru> writes:
> 
>> Run qtest with a socket that connects QEMU chardev and test code.
>>
>> Signed-off-by: Julia Suvorova <jusual@mail.ru>
>> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> 
> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
> 

>> +QTestState *qtest_init_with_serial(const char *extra_args, int *sock_fd)
>> +{
>> +    int sock_fd_init;
>> +    char *sock_path, sock_dir[] = "/tmp/qtest-serial-XXXXXX";
>> +    QTestState *qts;
>> +
>> +    g_assert_true(mkdtemp(sock_dir) != NULL);
>> +    sock_path = g_strdup_printf("%s/sock", sock_dir);
>> +
>> +    sock_fd_init = init_socket(sock_path);
>> +
>> +    qts = qtest_initf("-chardev socket,id=s0,path=%s -serial chardev:s0 %s",
>> +                      sock_path, extra_args);

EWWWW.  Please, let's not bake in this interface.  Relying on shell
splitting is nasty.


>>
>> +/**
>> + * qtest_init_with_serial:
>> + * @extra_args: other arguments to pass to QEMU.  CAUTION: these
>> + * arguments are subject to word splitting and shell evaluation.
>> + * @sock_fd: pointer to store the socket file descriptor for
>> + * connection with serial.
>> + *
>> + * Returns: #QTestState instance.
>> + */
>> +QTestState *qtest_init_with_serial(const char *extra_args, int *sock_fd);

I would MUCH rather see an interface that used varargs to pass extra
arguments as a list/array of actual arguments, no shell splitting required.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2019-01-23 14:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-23 12:07 [Qemu-devel] [PATCH v5 0/3] tests/microbit-test: Add UART device test Julia Suvorova
2019-01-23 12:07 ` [Qemu-devel] [PATCH v5 1/3] tests/libqtest: Introduce qtest_init_with_serial() Julia Suvorova
2019-01-23 13:06   ` Thomas Huth
2019-01-23 14:20   ` Alex Bennée
2019-01-23 14:44     ` Eric Blake [this message]
2019-01-23 14:56       ` Daniel P. Berrangé
2019-01-23 12:07 ` [Qemu-devel] [PATCH v5 2/3] tests/microbit-test: Make test independent of global_qtest Julia Suvorova
2019-01-23 12:07 ` [Qemu-devel] [PATCH v5 3/3] tests/microbit-test: Check nRF51 UART functionality Julia Suvorova
2019-01-23 13:09   ` Thomas Huth
2019-01-23 17:49   ` Stefan Hajnoczi
2019-01-24 13:44 ` [Qemu-devel] [PATCH v5 0/3] tests/microbit-test: Add UART device test Peter Maydell

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=8f1c4cff-c186-9fc3-10ee-7f628882ef82@redhat.com \
    --to=eblake@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=contrib@steffen-goertz.de \
    --cc=jim@groklearning.com \
    --cc=joel@jms.id.au \
    --cc=jusual@mail.ru \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --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).