On Wed, Jan 23, 2019 at 08:44:12AM -0600, Eric Blake wrote: > On 1/23/19 8:20 AM, Alex Bennée wrote: > > > > Julia Suvorova <[email protected]> writes: > > > >> Run qtest with a socket that connects QEMU chardev and test code. > >> > >> Signed-off-by: Julia Suvorova <[email protected]> > >> Reviewed-by: Stefan Hajnoczi <[email protected]> > > > > Reviewed-by: Alex Bennée <[email protected]> > > > > >> +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_initf() is long a standing interface that's relied on shell splitting for years :-( I agree we should fix that, but its a pre-existing problem that this patch doesn't make worse. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
