From: Laurent Vivier <laurent@vivier.eu>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, "Alex Bennée" <alex.bennee@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Laurent Vivier" <laurent@vivier.eu>
Subject: [PULL 10/10] tests/unit: simpler variable sequence for test-io-channel
Date: Thu, 3 Nov 2022 17:17:27 +0100 [thread overview]
Message-ID: <20221103161727.4116147-11-laurent@vivier.eu> (raw)
In-Reply-To: <20221103161727.4116147-1-laurent@vivier.eu>
From: Alex Bennée <alex.bennee@linaro.org>
This avoids some compilers complaining about a potentially
un-initialised [src|dst]argv. In retrospect using GString was overkill
for what we are constructing.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20221103102329.2581508-1-alex.bennee@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
tests/unit/test-io-channel-command.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/tests/unit/test-io-channel-command.c b/tests/unit/test-io-channel-command.c
index 43e29c8cfbf4..19f72eab961d 100644
--- a/tests/unit/test-io-channel-command.c
+++ b/tests/unit/test-io-channel-command.c
@@ -33,19 +33,13 @@ static void test_io_channel_command_fifo(bool async)
{
g_autofree gchar *tmpdir = g_dir_make_tmp("qemu-test-io-channel.XXXXXX", NULL);
g_autofree gchar *fifo = g_strdup_printf("%s/%s", tmpdir, TEST_FIFO);
- g_autoptr(GString) srcargs = g_string_new(socat);
- g_autoptr(GString) dstargs = g_string_new(socat);
- g_auto(GStrv) srcargv;
- g_auto(GStrv) dstargv;
+ g_autofree gchar *srcargs = g_strdup_printf("%s - PIPE:%s,wronly", socat, fifo);
+ g_autofree gchar *dstargs = g_strdup_printf("%s PIPE:%s,rdonly -", socat, fifo);
+ g_auto(GStrv) srcargv = g_strsplit(srcargs, " ", -1);
+ g_auto(GStrv) dstargv = g_strsplit(dstargs, " ", -1);
QIOChannel *src, *dst;
QIOChannelTest *test;
- g_string_append_printf(srcargs, " - PIPE:%s,wronly", fifo);
- g_string_append_printf(dstargs, " PIPE:%s,rdonly -", fifo);
-
- srcargv = g_strsplit(srcargs->str, " ", -1);
- dstargv = g_strsplit(dstargs->str, " ", -1);
-
src = QIO_CHANNEL(qio_channel_command_new_spawn((const char **) srcargv,
O_WRONLY,
&error_abort));
--
2.37.3
next prev parent reply other threads:[~2022-11-03 16:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-03 16:17 [PULL 00/10] Trivial branch for 7.2 patches Laurent Vivier
2022-11-03 16:17 ` [PULL 01/10] qapi: virtio: Fix the introduced version Laurent Vivier
2022-11-03 16:17 ` [PULL 02/10] Fix some typos in documentation and comments Laurent Vivier
2022-11-03 16:17 ` [PULL 03/10] xen/pt: fix syntax error that causes FTBFS in some configurations Laurent Vivier
2022-11-03 16:17 ` [PULL 04/10] libvhost-user: Fix wrong type of argument to formatting function (reported by LGTM) Laurent Vivier
2022-11-04 16:16 ` Laurent Vivier
2022-11-05 9:15 ` Stefan Weil via
2022-11-03 16:17 ` [PULL 05/10] libvhost-user: Fix format strings Laurent Vivier
2022-11-03 16:17 ` [PULL 06/10] libvhost-user: Add format attribute to local function vu_panic Laurent Vivier
2022-11-03 16:17 ` [PULL 07/10] target/m68k: Rename qregs.def -> qregs.h.inc Laurent Vivier
2022-11-03 16:17 ` [PULL 08/10] target/s390x: Rename insn-data/format.def -> insn-data/format.h.inc Laurent Vivier
2022-11-03 16:17 ` [PULL 09/10] target/tricore: Rename csfr.def -> csfr.h.inc Laurent Vivier
2022-11-03 16:17 ` Laurent Vivier [this message]
2022-11-04 14:39 ` [PULL 00/10] Trivial branch for 7.2 patches Stefan Hajnoczi
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=20221103161727.4116147-11-laurent@vivier.eu \
--to=laurent@vivier.eu \
--cc=alex.bennee@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/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).