[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 03/11] tests/qtest/boot-serial-test: Build command line using
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 03/11] tests/qtest/boot-serial-test: Build command line using GString API |
Date: |
Thu, 19 Jan 2023 15:58:30 +0100 |
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
tests/qtest/boot-serial-test.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c
index 3a854b0174..92890b409d 100644
--- a/tests/qtest/boot-serial-test.c
+++ b/tests/qtest/boot-serial-test.c
@@ -226,14 +226,17 @@ static void test_machine(const void *data)
const testdef_t *test = data;
g_autofree char *serialtmp = NULL;
g_autofree char *codetmp = NULL;
- const char *codeparam = "";
QTestState *qts;
int ser_fd;
+ g_autoptr(GString) cmd = g_string_new("");
ser_fd = g_file_open_tmp("qtest-boot-serial-sXXXXXX", &serialtmp, NULL);
g_assert(ser_fd != -1);
close(ser_fd);
+ g_string_append_printf(cmd, "-M %s ", test->machine);
+ g_string_append(cmd, "-no-shutdown ");
+
if (test->kernel || test->bios) {
ssize_t wlen;
int code_fd;
@@ -243,19 +246,23 @@ static void test_machine(const void *data)
wlen = write(code_fd, test->kernel ? : test->bios, test->codesize);
g_assert(wlen == test->codesize);
close(code_fd);
+ g_string_append_printf(cmd, "%s %s ",
+ test->kernel ? "-kernel " : "-bios ", codetmp);
}
+ g_string_append_printf(cmd, "-chardev file,id=serial0,path=%s "
+ "-serial chardev:serial0 ", serialtmp);
+
/*
* Make sure that this test uses tcg if available: It is used as a
* fast-enough smoketest for that.
*/
- qts = qtest_initf("%s %s %s -M %s -no-shutdown "
- "-chardev file,id=serial0,path=%s "
- "-serial chardev:serial0 -accel tcg -accel kvm %s",
- codeparam,
- test->kernel ? "-kernel " : test->bios ? "-bios " : "",
- codetmp ? : "", test->machine,
- serialtmp, test->extra);
+ g_string_append(cmd, "-accel tcg ");
+ g_string_append(cmd, "-accel kvm ");
+ g_string_append(cmd, test->extra);
+
+ qts = qtest_init(cmd->str);
+
if (codetmp) {
unlink(codetmp);
}
--
2.38.1
- [PATCH v2 00/11] tests/qtest: Allow running boot-serial / migration with TCG disabled, Philippe Mathieu-Daudé, 2023/01/19
- [PATCH v2 01/11] tests/qtest/boot-serial-test: Constify tests[] array, Philippe Mathieu-Daudé, 2023/01/19
- [PATCH v2 02/11] tests/qtest/boot-serial-test: Simplify test_machine() a bit, Philippe Mathieu-Daudé, 2023/01/19
- [PATCH v2 03/11] tests/qtest/boot-serial-test: Build command line using GString API,
Philippe Mathieu-Daudé <=
- [PATCH v2 04/11] tests/qtest/boot-serial-test: Only use available accelerators, Philippe Mathieu-Daudé, 2023/01/19
- [PATCH v2 05/11] tests/qtest/migration-test: Inverse #ifdef'ry ladders, Philippe Mathieu-Daudé, 2023/01/19
- [PATCH v2 06/11] tests/qtest/migration-test: Reduce 'cmd_source' string scope, Philippe Mathieu-Daudé, 2023/01/19