qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v5 1/3] tests/libqtest: Introduce qtest_init_wit


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v5 1/3] tests/libqtest: Introduce qtest_init_with_serial()
Date: Wed, 23 Jan 2019 08:44:12 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

On 1/23/19 8:20 AM, Alex Bennée wrote:
> 
> Julia Suvorova <address@hidden> writes:
> 
>> Run qtest with a socket that connects QEMU chardev and test code.
>>
>> Signed-off-by: Julia Suvorova <address@hidden>
>> Reviewed-by: Stefan Hajnoczi <address@hidden>
> 
> Reviewed-by: Alex Bennée <address@hidden>
> 

>> +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: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]