* [PATCH v3 00/11] tests/qtest: Allow running boot-serial / migration with TCG disabled
@ 2023-01-20 8:23 Philippe Mathieu-Daudé
2023-01-20 8:23 ` [PATCH v3 01/11] tests/qtest/boot-serial-test: Constify tests[] array Philippe Mathieu-Daudé
` (11 more replies)
0 siblings, 12 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-20 8:23 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Dr. David Alan Gilbert, Thomas Huth,
Fabiano Rosas, Juan Quintela, Laurent Vivier, qemu-arm,
Philippe Mathieu-Daudé
Missing review: #7
Two test were failing on Darwin when testing Fabiano's series
which allows building ARM targets without TCG accelerator:
https://lore.kernel.org/qemu-devel/20230118193518.26433-1-farosas@suse.de/
These patches allow boot-serial / migration tests to run without
TCG / KVM.
Philippe Mathieu-Daudé (11):
tests/qtest/boot-serial-test: Constify tests[] array
tests/qtest/boot-serial-test: Simplify test_machine() a bit
tests/qtest/boot-serial-test: Build command line using GString API
tests/qtest/boot-serial-test: Only use available accelerators
tests/qtest/migration-test: Inverse #ifdef'ry ladders
tests/qtest/migration-test: Reduce 'cmd_source' string scope
tests/qtest/migration-test: Build command line using GString API (1/4)
tests/qtest/migration-test: Build command line using GString API (2/4)
tests/qtest/migration-test: Build command line using GString API (3/4)
tests/qtest/migration-test: Build command line using GString API (4/4)
tests/qtest/migration-test: Only use available accelerators
tests/qtest/boot-serial-test.c | 46 +++++++++-------
tests/qtest/migration-test.c | 96 ++++++++++++++++++----------------
2 files changed, 80 insertions(+), 62 deletions(-)
--
2.38.1
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH v3 01/11] tests/qtest/boot-serial-test: Constify tests[] array
2023-01-20 8:23 [PATCH v3 00/11] tests/qtest: Allow running boot-serial / migration with TCG disabled Philippe Mathieu-Daudé
@ 2023-01-20 8:23 ` Philippe Mathieu-Daudé
2023-01-20 8:23 ` [PATCH v3 02/11] tests/qtest/boot-serial-test: Simplify test_machine() a bit Philippe Mathieu-Daudé
` (10 subsequent siblings)
11 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-20 8:23 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Dr. David Alan Gilbert, Thomas Huth,
Fabiano Rosas, Juan Quintela, Laurent Vivier, qemu-arm,
Philippe Mathieu-Daudé,
Richard Henderson
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
tests/qtest/boot-serial-test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c
index b216519b62..3aef3a97a9 100644
--- a/tests/qtest/boot-serial-test.c
+++ b/tests/qtest/boot-serial-test.c
@@ -139,7 +139,7 @@ typedef struct testdef {
const uint8_t *bios; /* Set in case we use our own mini bios */
} testdef_t;
-static testdef_t tests[] = {
+static const testdef_t tests[] = {
{ "alpha", "clipper", "", "PCI:" },
{ "avr", "arduino-duemilanove", "", "T", sizeof(bios_avr), NULL, bios_avr },
{ "avr", "arduino-mega-2560-v3", "", "T", sizeof(bios_avr), NULL, bios_avr},
--
2.38.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 02/11] tests/qtest/boot-serial-test: Simplify test_machine() a bit
2023-01-20 8:23 [PATCH v3 00/11] tests/qtest: Allow running boot-serial / migration with TCG disabled Philippe Mathieu-Daudé
2023-01-20 8:23 ` [PATCH v3 01/11] tests/qtest/boot-serial-test: Constify tests[] array Philippe Mathieu-Daudé
@ 2023-01-20 8:23 ` Philippe Mathieu-Daudé
2023-01-20 8:23 ` [PATCH v3 03/11] tests/qtest/boot-serial-test: Build command line using GString API Philippe Mathieu-Daudé
` (9 subsequent siblings)
11 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-20 8:23 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Dr. David Alan Gilbert, Thomas Huth,
Fabiano Rosas, Juan Quintela, Laurent Vivier, qemu-arm,
Philippe Mathieu-Daudé,
Richard Henderson
Slighly modify test_machine() to simplify next commit review.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
tests/qtest/boot-serial-test.c | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c
index 3aef3a97a9..3a854b0174 100644
--- a/tests/qtest/boot-serial-test.c
+++ b/tests/qtest/boot-serial-test.c
@@ -227,7 +227,6 @@ static void test_machine(const void *data)
g_autofree char *serialtmp = NULL;
g_autofree char *codetmp = NULL;
const char *codeparam = "";
- const uint8_t *code = NULL;
QTestState *qts;
int ser_fd;
@@ -235,21 +234,13 @@ static void test_machine(const void *data)
g_assert(ser_fd != -1);
close(ser_fd);
- if (test->kernel) {
- code = test->kernel;
- codeparam = "-kernel";
- } else if (test->bios) {
- code = test->bios;
- codeparam = "-bios";
- }
-
- if (code) {
+ if (test->kernel || test->bios) {
ssize_t wlen;
int code_fd;
code_fd = g_file_open_tmp("qtest-boot-serial-cXXXXXX", &codetmp, NULL);
g_assert(code_fd != -1);
- wlen = write(code_fd, code, test->codesize);
+ wlen = write(code_fd, test->kernel ? : test->bios, test->codesize);
g_assert(wlen == test->codesize);
close(code_fd);
}
@@ -258,12 +249,14 @@ static void test_machine(const void *data)
* Make sure that this test uses tcg if available: It is used as a
* fast-enough smoketest for that.
*/
- qts = qtest_initf("%s %s -M %s -no-shutdown "
+ 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, code ? codetmp : "", test->machine,
+ codeparam,
+ test->kernel ? "-kernel " : test->bios ? "-bios " : "",
+ codetmp ? : "", test->machine,
serialtmp, test->extra);
- if (code) {
+ if (codetmp) {
unlink(codetmp);
}
--
2.38.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 03/11] tests/qtest/boot-serial-test: Build command line using GString API
2023-01-20 8:23 [PATCH v3 00/11] tests/qtest: Allow running boot-serial / migration with TCG disabled Philippe Mathieu-Daudé
2023-01-20 8:23 ` [PATCH v3 01/11] tests/qtest/boot-serial-test: Constify tests[] array Philippe Mathieu-Daudé
2023-01-20 8:23 ` [PATCH v3 02/11] tests/qtest/boot-serial-test: Simplify test_machine() a bit Philippe Mathieu-Daudé
@ 2023-01-20 8:23 ` Philippe Mathieu-Daudé
2023-01-20 8:23 ` [PATCH v3 04/11] tests/qtest/boot-serial-test: Only use available accelerators Philippe Mathieu-Daudé
` (8 subsequent siblings)
11 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-20 8:23 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Dr. David Alan Gilbert, Thomas Huth,
Fabiano Rosas, Juan Quintela, Laurent Vivier, qemu-arm,
Philippe Mathieu-Daudé,
Richard Henderson
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@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
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 04/11] tests/qtest/boot-serial-test: Only use available accelerators
2023-01-20 8:23 [PATCH v3 00/11] tests/qtest: Allow running boot-serial / migration with TCG disabled Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2023-01-20 8:23 ` [PATCH v3 03/11] tests/qtest/boot-serial-test: Build command line using GString API Philippe Mathieu-Daudé
@ 2023-01-20 8:23 ` Philippe Mathieu-Daudé
2023-01-20 8:23 ` [PATCH v3 05/11] tests/qtest/migration-test: Inverse #ifdef'ry ladders Philippe Mathieu-Daudé
` (7 subsequent siblings)
11 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-20 8:23 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Dr. David Alan Gilbert, Thomas Huth,
Fabiano Rosas, Juan Quintela, Laurent Vivier, qemu-arm,
Philippe Mathieu-Daudé,
Richard Henderson
For example, avoid when TCG is disabled:
$ make check-qtest-aarch64
...
18/20 qemu:qtest+qtest-aarch64 / qtest-aarch64/boot-serial-test
qemu-system-aarch64: -accel tcg: invalid accelerator tcg
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
tests/qtest/boot-serial-test.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c
index 92890b409d..f375b16dae 100644
--- a/tests/qtest/boot-serial-test.c
+++ b/tests/qtest/boot-serial-test.c
@@ -17,6 +17,9 @@
#include "libqtest.h"
#include "libqos/libqos-spapr.h"
+static bool has_tcg;
+static bool has_kvm;
+
static const uint8_t bios_avr[] = {
0x88, 0xe0, /* ldi r24, 0x08 */
0x80, 0x93, 0xc1, 0x00, /* sts 0x00C1, r24 ; Enable tx */
@@ -257,8 +260,12 @@ static void test_machine(const void *data)
* Make sure that this test uses tcg if available: It is used as a
* fast-enough smoketest for that.
*/
- g_string_append(cmd, "-accel tcg ");
- g_string_append(cmd, "-accel kvm ");
+ if (has_tcg) {
+ g_string_append(cmd, "-accel tcg ");
+ }
+ if (has_kvm) {
+ g_string_append(cmd, "-accel kvm ");
+ }
g_string_append(cmd, test->extra);
qts = qtest_init(cmd->str);
@@ -285,6 +292,9 @@ int main(int argc, char *argv[])
const char *arch = qtest_get_arch();
int i;
+ has_tcg = qtest_has_accel("tcg");
+ has_kvm = qtest_has_accel("kvm");
+
g_test_init(&argc, &argv, NULL);
for (i = 0; tests[i].arch != NULL; i++) {
--
2.38.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 05/11] tests/qtest/migration-test: Inverse #ifdef'ry ladders
2023-01-20 8:23 [PATCH v3 00/11] tests/qtest: Allow running boot-serial / migration with TCG disabled Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2023-01-20 8:23 ` [PATCH v3 04/11] tests/qtest/boot-serial-test: Only use available accelerators Philippe Mathieu-Daudé
@ 2023-01-20 8:23 ` Philippe Mathieu-Daudé
2023-01-30 4:43 ` Juan Quintela
2023-01-20 8:23 ` [PATCH v3 06/11] tests/qtest/migration-test: Reduce 'cmd_source' string scope Philippe Mathieu-Daudé
` (6 subsequent siblings)
11 siblings, 1 reply; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-20 8:23 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Dr. David Alan Gilbert, Thomas Huth,
Fabiano Rosas, Juan Quintela, Laurent Vivier, qemu-arm,
Philippe Mathieu-Daudé,
Richard Henderson
This slighly simplify the logic, and eases the following conversion.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
tests/qtest/migration-test.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 1dd32c9506..5271ddb868 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -647,15 +647,15 @@ static int test_migrate_start(QTestState **from, QTestState **to,
}
if (!getenv("QTEST_LOG") && args->hide_stderr) {
-#ifndef _WIN32
- ignore_stderr = "2>/dev/null";
-#else
+#ifdef _WIN32
/*
* On Windows the QEMU executable is created via CreateProcess() and
* IO redirection does not work, so don't bother adding IO redirection
* to the command line.
*/
ignore_stderr = "";
+#else
+ ignore_stderr = "2>/dev/null";
#endif
} else {
ignore_stderr = "";
--
2.38.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 06/11] tests/qtest/migration-test: Reduce 'cmd_source' string scope
2023-01-20 8:23 [PATCH v3 00/11] tests/qtest: Allow running boot-serial / migration with TCG disabled Philippe Mathieu-Daudé
` (4 preceding siblings ...)
2023-01-20 8:23 ` [PATCH v3 05/11] tests/qtest/migration-test: Inverse #ifdef'ry ladders Philippe Mathieu-Daudé
@ 2023-01-20 8:23 ` Philippe Mathieu-Daudé
2023-01-30 4:44 ` Juan Quintela
2023-01-20 8:23 ` [PATCH v3 07/11] tests/qtest/migration-test: Build command line using GString API (1/4) Philippe Mathieu-Daudé
` (5 subsequent siblings)
11 siblings, 1 reply; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-20 8:23 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Dr. David Alan Gilbert, Thomas Huth,
Fabiano Rosas, Juan Quintela, Laurent Vivier, qemu-arm,
Philippe Mathieu-Daudé,
Richard Henderson
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
tests/qtest/migration-test.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 5271ddb868..f96c73f552 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -584,7 +584,6 @@ static int test_migrate_start(QTestState **from, QTestState **to,
{
g_autofree gchar *arch_source = NULL;
g_autofree gchar *arch_target = NULL;
- g_autofree gchar *cmd_source = NULL;
g_autofree gchar *cmd_target = NULL;
const gchar *ignore_stderr;
g_autofree char *bootpath = NULL;
@@ -672,20 +671,22 @@ static int test_migrate_start(QTestState **from, QTestState **to,
shmem_opts = g_strdup("");
}
- cmd_source = g_strdup_printf("-accel kvm%s -accel tcg%s%s "
- "-name source,debug-threads=on "
- "-m %s "
- "-serial file:%s/src_serial "
- "%s %s %s %s",
- args->use_dirty_ring ?
- ",dirty-ring-size=4096" : "",
- machine_opts ? " -machine " : "",
- machine_opts ? machine_opts : "",
- memory_size, tmpfs,
- arch_source, shmem_opts,
- args->opts_source ? args->opts_source : "",
- ignore_stderr);
if (!args->only_target) {
+ g_autofree gchar *cmd_source = NULL;
+
+ cmd_source = g_strdup_printf("-accel kvm%s -accel tcg%s%s "
+ "-name source,debug-threads=on "
+ "-m %s "
+ "-serial file:%s/src_serial "
+ "%s %s %s %s",
+ args->use_dirty_ring ?
+ ",dirty-ring-size=4096" : "",
+ machine_opts ? " -machine " : "",
+ machine_opts ? machine_opts : "",
+ memory_size, tmpfs,
+ arch_source, shmem_opts,
+ args->opts_source ? args->opts_source : "",
+ ignore_stderr);
*from = qtest_init(cmd_source);
}
--
2.38.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 07/11] tests/qtest/migration-test: Build command line using GString API (1/4)
2023-01-20 8:23 [PATCH v3 00/11] tests/qtest: Allow running boot-serial / migration with TCG disabled Philippe Mathieu-Daudé
` (5 preceding siblings ...)
2023-01-20 8:23 ` [PATCH v3 06/11] tests/qtest/migration-test: Reduce 'cmd_source' string scope Philippe Mathieu-Daudé
@ 2023-01-20 8:23 ` Philippe Mathieu-Daudé
2023-01-23 10:57 ` Dr. David Alan Gilbert
2023-01-30 4:45 ` Juan Quintela
2023-01-20 8:23 ` [PATCH v3 08/11] tests/qtest/migration-test: Build command line using GString API (2/4) Philippe Mathieu-Daudé
` (4 subsequent siblings)
11 siblings, 2 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-20 8:23 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Dr. David Alan Gilbert, Thomas Huth,
Fabiano Rosas, Juan Quintela, Laurent Vivier, qemu-arm,
Philippe Mathieu-Daudé
Part 1/4: Convert memory & machine options.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
tests/qtest/migration-test.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index f96c73f552..9cdef4fa65 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -582,6 +582,7 @@ typedef struct {
static int test_migrate_start(QTestState **from, QTestState **to,
const char *uri, MigrateStart *args)
{
+ g_autoptr(GString) cmd_common = NULL;
g_autofree gchar *arch_source = NULL;
g_autofree gchar *arch_target = NULL;
g_autofree gchar *cmd_target = NULL;
@@ -601,6 +602,9 @@ static int test_migrate_start(QTestState **from, QTestState **to,
}
got_stop = false;
+
+ cmd_common = g_string_new("");
+
bootpath = g_strdup_printf("%s/bootsect", tmpfs);
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
/* the assembled x86 boot sector should be exactly one sector large */
@@ -644,6 +648,10 @@ static int test_migrate_start(QTestState **from, QTestState **to,
} else {
g_assert_not_reached();
}
+ if (machine_opts) {
+ g_string_append_printf(cmd_common, " -machine %s ", machine_opts);
+ }
+ g_string_append_printf(cmd_common, "-m %s ", memory_size);
if (!getenv("QTEST_LOG") && args->hide_stderr) {
#ifdef _WIN32
@@ -674,33 +682,29 @@ static int test_migrate_start(QTestState **from, QTestState **to,
if (!args->only_target) {
g_autofree gchar *cmd_source = NULL;
- cmd_source = g_strdup_printf("-accel kvm%s -accel tcg%s%s "
+ cmd_source = g_strdup_printf("-accel kvm%s -accel tcg %s "
"-name source,debug-threads=on "
- "-m %s "
"-serial file:%s/src_serial "
"%s %s %s %s",
args->use_dirty_ring ?
",dirty-ring-size=4096" : "",
- machine_opts ? " -machine " : "",
- machine_opts ? machine_opts : "",
- memory_size, tmpfs,
+ cmd_common->str,
+ tmpfs,
arch_source, shmem_opts,
args->opts_source ? args->opts_source : "",
ignore_stderr);
*from = qtest_init(cmd_source);
}
- cmd_target = g_strdup_printf("-accel kvm%s -accel tcg%s%s "
+ cmd_target = g_strdup_printf("-accel kvm%s -accel tcg %s "
"-name target,debug-threads=on "
- "-m %s "
"-serial file:%s/dest_serial "
"-incoming %s "
"%s %s %s %s",
args->use_dirty_ring ?
",dirty-ring-size=4096" : "",
- machine_opts ? " -machine " : "",
- machine_opts ? machine_opts : "",
- memory_size, tmpfs, uri,
+ cmd_common->str,
+ tmpfs, uri,
arch_target, shmem_opts,
args->opts_target ? args->opts_target : "",
ignore_stderr);
--
2.38.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 08/11] tests/qtest/migration-test: Build command line using GString API (2/4)
2023-01-20 8:23 [PATCH v3 00/11] tests/qtest: Allow running boot-serial / migration with TCG disabled Philippe Mathieu-Daudé
` (6 preceding siblings ...)
2023-01-20 8:23 ` [PATCH v3 07/11] tests/qtest/migration-test: Build command line using GString API (1/4) Philippe Mathieu-Daudé
@ 2023-01-20 8:23 ` Philippe Mathieu-Daudé
2023-01-30 4:46 ` Juan Quintela
2023-01-20 8:23 ` [PATCH v3 09/11] tests/qtest/migration-test: Build command line using GString API (3/4) Philippe Mathieu-Daudé
` (3 subsequent siblings)
11 siblings, 1 reply; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-20 8:23 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Dr. David Alan Gilbert, Thomas Huth,
Fabiano Rosas, Juan Quintela, Laurent Vivier, qemu-arm,
Philippe Mathieu-Daudé,
Richard Henderson
Part 2/4: Convert shmem option.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
tests/qtest/migration-test.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 9cdef4fa65..670097a956 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -588,7 +588,6 @@ static int test_migrate_start(QTestState **from, QTestState **to,
g_autofree gchar *cmd_target = NULL;
const gchar *ignore_stderr;
g_autofree char *bootpath = NULL;
- g_autofree char *shmem_opts = NULL;
g_autofree char *shmem_path = NULL;
const char *arch = qtest_get_arch();
const char *machine_opts = NULL;
@@ -670,13 +669,10 @@ static int test_migrate_start(QTestState **from, QTestState **to,
if (args->use_shmem) {
shmem_path = g_strdup_printf("/dev/shm/qemu-%d", getpid());
- shmem_opts = g_strdup_printf(
+ g_string_append_printf(cmd_common,
"-object memory-backend-file,id=mem0,size=%s"
",mem-path=%s,share=on -numa node,memdev=mem0",
memory_size, shmem_path);
- } else {
- shmem_path = NULL;
- shmem_opts = g_strdup("");
}
if (!args->only_target) {
@@ -685,12 +681,12 @@ static int test_migrate_start(QTestState **from, QTestState **to,
cmd_source = g_strdup_printf("-accel kvm%s -accel tcg %s "
"-name source,debug-threads=on "
"-serial file:%s/src_serial "
- "%s %s %s %s",
+ "%s %s %s",
args->use_dirty_ring ?
",dirty-ring-size=4096" : "",
cmd_common->str,
tmpfs,
- arch_source, shmem_opts,
+ arch_source,
args->opts_source ? args->opts_source : "",
ignore_stderr);
*from = qtest_init(cmd_source);
@@ -700,12 +696,12 @@ static int test_migrate_start(QTestState **from, QTestState **to,
"-name target,debug-threads=on "
"-serial file:%s/dest_serial "
"-incoming %s "
- "%s %s %s %s",
+ "%s %s %s",
args->use_dirty_ring ?
",dirty-ring-size=4096" : "",
cmd_common->str,
tmpfs, uri,
- arch_target, shmem_opts,
+ arch_target,
args->opts_target ? args->opts_target : "",
ignore_stderr);
*to = qtest_init(cmd_target);
--
2.38.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 09/11] tests/qtest/migration-test: Build command line using GString API (3/4)
2023-01-20 8:23 [PATCH v3 00/11] tests/qtest: Allow running boot-serial / migration with TCG disabled Philippe Mathieu-Daudé
` (7 preceding siblings ...)
2023-01-20 8:23 ` [PATCH v3 08/11] tests/qtest/migration-test: Build command line using GString API (2/4) Philippe Mathieu-Daudé
@ 2023-01-20 8:23 ` Philippe Mathieu-Daudé
2023-01-23 10:59 ` Dr. David Alan Gilbert
2023-01-30 4:47 ` Juan Quintela
2023-01-20 8:23 ` [PATCH v3 10/11] tests/qtest/migration-test: Build command line using GString API (4/4) Philippe Mathieu-Daudé
` (2 subsequent siblings)
11 siblings, 2 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-20 8:23 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Dr. David Alan Gilbert, Thomas Huth,
Fabiano Rosas, Juan Quintela, Laurent Vivier, qemu-arm,
Philippe Mathieu-Daudé,
Richard Henderson
Part 3/4: Convert accelerator options.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
tests/qtest/migration-test.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 670097a956..1ed3505c91 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -603,6 +603,13 @@ static int test_migrate_start(QTestState **from, QTestState **to,
got_stop = false;
cmd_common = g_string_new("");
+ /* KVM first */
+ if (args->use_dirty_ring) {
+ g_string_append(cmd_common, "-accel kvm,dirty-ring-size=4096 ");
+ } else {
+ g_string_append(cmd_common, "-accel kvm ");
+ }
+ g_string_append(cmd_common, "-accel tcg ");
bootpath = g_strdup_printf("%s/bootsect", tmpfs);
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
@@ -678,12 +685,10 @@ static int test_migrate_start(QTestState **from, QTestState **to,
if (!args->only_target) {
g_autofree gchar *cmd_source = NULL;
- cmd_source = g_strdup_printf("-accel kvm%s -accel tcg %s "
+ cmd_source = g_strdup_printf("%s "
"-name source,debug-threads=on "
"-serial file:%s/src_serial "
"%s %s %s",
- args->use_dirty_ring ?
- ",dirty-ring-size=4096" : "",
cmd_common->str,
tmpfs,
arch_source,
@@ -692,13 +697,11 @@ static int test_migrate_start(QTestState **from, QTestState **to,
*from = qtest_init(cmd_source);
}
- cmd_target = g_strdup_printf("-accel kvm%s -accel tcg %s "
+ cmd_target = g_strdup_printf("%s "
"-name target,debug-threads=on "
"-serial file:%s/dest_serial "
"-incoming %s "
"%s %s %s",
- args->use_dirty_ring ?
- ",dirty-ring-size=4096" : "",
cmd_common->str,
tmpfs, uri,
arch_target,
--
2.38.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 10/11] tests/qtest/migration-test: Build command line using GString API (4/4)
2023-01-20 8:23 [PATCH v3 00/11] tests/qtest: Allow running boot-serial / migration with TCG disabled Philippe Mathieu-Daudé
` (8 preceding siblings ...)
2023-01-20 8:23 ` [PATCH v3 09/11] tests/qtest/migration-test: Build command line using GString API (3/4) Philippe Mathieu-Daudé
@ 2023-01-20 8:23 ` Philippe Mathieu-Daudé
2023-01-30 4:48 ` Juan Quintela
2023-01-20 8:23 ` [PATCH v3 11/11] tests/qtest/migration-test: Only use available accelerators Philippe Mathieu-Daudé
2023-01-20 9:18 ` [PATCH v3 00/11] tests/qtest: Allow running boot-serial / migration with TCG disabled Thomas Huth
11 siblings, 1 reply; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-20 8:23 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Dr. David Alan Gilbert, Thomas Huth,
Fabiano Rosas, Juan Quintela, Laurent Vivier, qemu-arm,
Philippe Mathieu-Daudé,
Richard Henderson
Part 4/4: Convert rest of options.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
tests/qtest/migration-test.c | 53 +++++++++++++++++-------------------
1 file changed, 25 insertions(+), 28 deletions(-)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 1ed3505c91..e7786bcbc5 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -585,8 +585,8 @@ static int test_migrate_start(QTestState **from, QTestState **to,
g_autoptr(GString) cmd_common = NULL;
g_autofree gchar *arch_source = NULL;
g_autofree gchar *arch_target = NULL;
- g_autofree gchar *cmd_target = NULL;
- const gchar *ignore_stderr;
+ g_autoptr(GString) cmd_target = NULL;
+ const gchar *ignore_stderr = NULL;
g_autofree char *bootpath = NULL;
g_autofree char *shmem_path = NULL;
const char *arch = qtest_get_arch();
@@ -666,12 +666,9 @@ static int test_migrate_start(QTestState **from, QTestState **to,
* IO redirection does not work, so don't bother adding IO redirection
* to the command line.
*/
- ignore_stderr = "";
#else
ignore_stderr = "2>/dev/null";
#endif
- } else {
- ignore_stderr = "";
}
if (args->use_shmem) {
@@ -683,31 +680,31 @@ static int test_migrate_start(QTestState **from, QTestState **to,
}
if (!args->only_target) {
- g_autofree gchar *cmd_source = NULL;
-
- cmd_source = g_strdup_printf("%s "
- "-name source,debug-threads=on "
- "-serial file:%s/src_serial "
- "%s %s %s",
- cmd_common->str,
- tmpfs,
- arch_source,
- args->opts_source ? args->opts_source : "",
- ignore_stderr);
- *from = qtest_init(cmd_source);
+ g_autoptr(GString) cmd_source = g_string_new(cmd_common->str);
+ g_string_append(cmd_source, "-name source,debug-threads=on ");
+ g_string_append_printf(cmd_source, "-serial file:%s/src_serial ", tmpfs);
+ g_string_append_printf(cmd_source, "%s ", arch_source);
+ if (args->opts_source) {
+ g_string_append_printf(cmd_source, "%s ", args->opts_source);
+ }
+ if (ignore_stderr) {
+ g_string_append(cmd_source, ignore_stderr); /* last string */
+ }
+ *from = qtest_init(cmd_source->str);
}
- cmd_target = g_strdup_printf("%s "
- "-name target,debug-threads=on "
- "-serial file:%s/dest_serial "
- "-incoming %s "
- "%s %s %s",
- cmd_common->str,
- tmpfs, uri,
- arch_target,
- args->opts_target ? args->opts_target : "",
- ignore_stderr);
- *to = qtest_init(cmd_target);
+ cmd_target = g_string_new(cmd_common->str);
+ g_string_append(cmd_target, "-name target,debug-threads=on ");
+ g_string_append_printf(cmd_target, "-serial file:%s/dest_serial ", tmpfs);
+ g_string_append_printf(cmd_target, "-incoming %s ", uri);
+ g_string_append_printf(cmd_target, "%s ", arch_target);
+ if (args->opts_target) {
+ g_string_append_printf(cmd_target, "%s ", args->opts_target);
+ }
+ if (ignore_stderr) {
+ g_string_append(cmd_target, ignore_stderr); /* last string */
+ }
+ *to = qtest_init(cmd_target->str);
/*
* Remove shmem file immediately to avoid memory leak in test failed case.
--
2.38.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 11/11] tests/qtest/migration-test: Only use available accelerators
2023-01-20 8:23 [PATCH v3 00/11] tests/qtest: Allow running boot-serial / migration with TCG disabled Philippe Mathieu-Daudé
` (9 preceding siblings ...)
2023-01-20 8:23 ` [PATCH v3 10/11] tests/qtest/migration-test: Build command line using GString API (4/4) Philippe Mathieu-Daudé
@ 2023-01-20 8:23 ` Philippe Mathieu-Daudé
2023-01-30 4:49 ` Juan Quintela
2023-01-20 9:18 ` [PATCH v3 00/11] tests/qtest: Allow running boot-serial / migration with TCG disabled Thomas Huth
11 siblings, 1 reply; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-20 8:23 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Dr. David Alan Gilbert, Thomas Huth,
Fabiano Rosas, Juan Quintela, Laurent Vivier, qemu-arm,
Philippe Mathieu-Daudé,
Richard Henderson
For example, avoid when TCG is disabled:
$ make check-qtest-aarch64
...
20/20 qemu:qtest+qtest-aarch64 / qtest-aarch64/migration-test
qemu-system-aarch64: -accel tcg: invalid accelerator tcg
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
tests/qtest/migration-test.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index e7786bcbc5..b0eaddbf5a 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -45,6 +45,8 @@
unsigned start_address;
unsigned end_address;
+static bool has_tcg;
+static bool has_kvm;
static bool uffd_feature_thread_id;
/*
@@ -603,13 +605,16 @@ static int test_migrate_start(QTestState **from, QTestState **to,
got_stop = false;
cmd_common = g_string_new("");
- /* KVM first */
- if (args->use_dirty_ring) {
- g_string_append(cmd_common, "-accel kvm,dirty-ring-size=4096 ");
- } else {
- g_string_append(cmd_common, "-accel kvm ");
+ if (has_kvm) { /* KVM first */
+ if (args->use_dirty_ring) {
+ g_string_append(cmd_common, "-accel kvm,dirty-ring-size=4096 ");
+ } else {
+ g_string_append(cmd_common, "-accel kvm ");
+ }
+ }
+ if (has_tcg) {
+ g_string_append(cmd_common, "-accel tcg ");
}
- g_string_append(cmd_common, "-accel tcg ");
bootpath = g_strdup_printf("%s/bootsect", tmpfs);
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
@@ -2460,12 +2465,14 @@ static bool kvm_dirty_ring_supported(void)
int main(int argc, char **argv)
{
- const bool has_kvm = qtest_has_accel("kvm");
const bool has_uffd = ufd_version_check();
const char *arch = qtest_get_arch();
g_autoptr(GError) err = NULL;
int ret;
+ has_tcg = qtest_has_accel("tcg");
+ has_kvm = qtest_has_accel("kvm");
+
g_test_init(&argc, &argv, NULL);
/*
--
2.38.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCH v3 00/11] tests/qtest: Allow running boot-serial / migration with TCG disabled
2023-01-20 8:23 [PATCH v3 00/11] tests/qtest: Allow running boot-serial / migration with TCG disabled Philippe Mathieu-Daudé
` (10 preceding siblings ...)
2023-01-20 8:23 ` [PATCH v3 11/11] tests/qtest/migration-test: Only use available accelerators Philippe Mathieu-Daudé
@ 2023-01-20 9:18 ` Thomas Huth
2023-01-20 11:09 ` Philippe Mathieu-Daudé
11 siblings, 1 reply; 25+ messages in thread
From: Thomas Huth @ 2023-01-20 9:18 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Paolo Bonzini, Dr. David Alan Gilbert, Fabiano Rosas,
Juan Quintela, Laurent Vivier, qemu-arm
On 20/01/2023 09.23, Philippe Mathieu-Daudé wrote:
> Missing review: #7
>
> Two test were failing on Darwin when testing Fabiano's series
> which allows building ARM targets without TCG accelerator:
> https://lore.kernel.org/qemu-devel/20230118193518.26433-1-farosas@suse.de/
>
> These patches allow boot-serial / migration tests to run without
> TCG / KVM.
I just started reviewing while you were sending v3 ... please see my mails
in reply to v2 for some comments.
Also, I don't quite understand why this is necessary. If you specify both,
"-accel kvm -accel tcg" on the command line, QEMU should simply fall back to
the second accelerator if the first one is not available? What's exactly the
problem you are trying to solve here?
Thomas
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v3 00/11] tests/qtest: Allow running boot-serial / migration with TCG disabled
2023-01-20 9:18 ` [PATCH v3 00/11] tests/qtest: Allow running boot-serial / migration with TCG disabled Thomas Huth
@ 2023-01-20 11:09 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 25+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-20 11:09 UTC (permalink / raw)
To: Thomas Huth, qemu-devel
Cc: Paolo Bonzini, Dr. David Alan Gilbert, Fabiano Rosas,
Juan Quintela, Laurent Vivier, qemu-arm
On 20/1/23 10:18, Thomas Huth wrote:
> On 20/01/2023 09.23, Philippe Mathieu-Daudé wrote:
>> Missing review: #7
>>
>> Two test were failing on Darwin when testing Fabiano's series
>> which allows building ARM targets without TCG accelerator:
>> https://lore.kernel.org/qemu-devel/20230118193518.26433-1-farosas@suse.de/
>>
>> These patches allow boot-serial / migration tests to run without
>> TCG / KVM.
>
> I just started reviewing while you were sending v3 ... please see my
> mails in reply to v2 for some comments.
Sure.
> Also, I don't quite understand why this is necessary. If you specify
> both, "-accel kvm -accel tcg" on the command line, QEMU should simply
> fall back to the second accelerator if the first one is not available?
> What's exactly the problem you are trying to solve here?
When testing Fabiano's series two tests hang, i.e. [*]:
18/20 qemu:qtest+qtest-aarch64 / qtest-aarch64/boot-serial-test
qemu-system-aarch64: -accel tcg: invalid accelerator tcg
Maybe it is just a matter of adding HVF to the test? I'll see
when I switch back to that. Anyhow the "invalid accelerator"
warning is annoying noise when looking for real problems in the
output.
[*]
https://lore.kernel.org/qemu-devel/ab32e4db-2a6d-69f8-4b69-62a1f1c0f6ba@linaro.org/
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v3 07/11] tests/qtest/migration-test: Build command line using GString API (1/4)
2023-01-20 8:23 ` [PATCH v3 07/11] tests/qtest/migration-test: Build command line using GString API (1/4) Philippe Mathieu-Daudé
@ 2023-01-23 10:57 ` Dr. David Alan Gilbert
2023-01-30 4:45 ` Juan Quintela
1 sibling, 0 replies; 25+ messages in thread
From: Dr. David Alan Gilbert @ 2023-01-23 10:57 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Paolo Bonzini, Thomas Huth, Fabiano Rosas,
Juan Quintela, Laurent Vivier, qemu-arm
* Philippe Mathieu-Daudé (philmd@linaro.org) wrote:
> Part 1/4: Convert memory & machine options.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> tests/qtest/migration-test.c | 24 ++++++++++++++----------
> 1 file changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
> index f96c73f552..9cdef4fa65 100644
> --- a/tests/qtest/migration-test.c
> +++ b/tests/qtest/migration-test.c
> @@ -582,6 +582,7 @@ typedef struct {
> static int test_migrate_start(QTestState **from, QTestState **to,
> const char *uri, MigrateStart *args)
> {
> + g_autoptr(GString) cmd_common = NULL;
> g_autofree gchar *arch_source = NULL;
> g_autofree gchar *arch_target = NULL;
> g_autofree gchar *cmd_target = NULL;
> @@ -601,6 +602,9 @@ static int test_migrate_start(QTestState **from, QTestState **to,
> }
>
> got_stop = false;
> +
> + cmd_common = g_string_new("");
> +
> bootpath = g_strdup_printf("%s/bootsect", tmpfs);
> if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
> /* the assembled x86 boot sector should be exactly one sector large */
> @@ -644,6 +648,10 @@ static int test_migrate_start(QTestState **from, QTestState **to,
> } else {
> g_assert_not_reached();
> }
> + if (machine_opts) {
> + g_string_append_printf(cmd_common, " -machine %s ", machine_opts);
> + }
> + g_string_append_printf(cmd_common, "-m %s ", memory_size);
>
> if (!getenv("QTEST_LOG") && args->hide_stderr) {
> #ifdef _WIN32
> @@ -674,33 +682,29 @@ static int test_migrate_start(QTestState **from, QTestState **to,
> if (!args->only_target) {
> g_autofree gchar *cmd_source = NULL;
>
> - cmd_source = g_strdup_printf("-accel kvm%s -accel tcg%s%s "
> + cmd_source = g_strdup_printf("-accel kvm%s -accel tcg %s "
> "-name source,debug-threads=on "
> - "-m %s "
> "-serial file:%s/src_serial "
> "%s %s %s %s",
> args->use_dirty_ring ?
> ",dirty-ring-size=4096" : "",
> - machine_opts ? " -machine " : "",
> - machine_opts ? machine_opts : "",
> - memory_size, tmpfs,
> + cmd_common->str,
> + tmpfs,
> arch_source, shmem_opts,
> args->opts_source ? args->opts_source : "",
> ignore_stderr);
> *from = qtest_init(cmd_source);
> }
>
> - cmd_target = g_strdup_printf("-accel kvm%s -accel tcg%s%s "
> + cmd_target = g_strdup_printf("-accel kvm%s -accel tcg %s "
> "-name target,debug-threads=on "
> - "-m %s "
> "-serial file:%s/dest_serial "
> "-incoming %s "
> "%s %s %s %s",
> args->use_dirty_ring ?
> ",dirty-ring-size=4096" : "",
> - machine_opts ? " -machine " : "",
> - machine_opts ? machine_opts : "",
> - memory_size, tmpfs, uri,
> + cmd_common->str,
> + tmpfs, uri,
> arch_target, shmem_opts,
> args->opts_target ? args->opts_target : "",
> ignore_stderr);
> --
> 2.38.1
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v3 09/11] tests/qtest/migration-test: Build command line using GString API (3/4)
2023-01-20 8:23 ` [PATCH v3 09/11] tests/qtest/migration-test: Build command line using GString API (3/4) Philippe Mathieu-Daudé
@ 2023-01-23 10:59 ` Dr. David Alan Gilbert
2023-01-30 4:47 ` Juan Quintela
1 sibling, 0 replies; 25+ messages in thread
From: Dr. David Alan Gilbert @ 2023-01-23 10:59 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Paolo Bonzini, Thomas Huth, Fabiano Rosas,
Juan Quintela, Laurent Vivier, qemu-arm, Richard Henderson
* Philippe Mathieu-Daudé (philmd@linaro.org) wrote:
> Part 3/4: Convert accelerator options.
>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> tests/qtest/migration-test.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
> index 670097a956..1ed3505c91 100644
> --- a/tests/qtest/migration-test.c
> +++ b/tests/qtest/migration-test.c
> @@ -603,6 +603,13 @@ static int test_migrate_start(QTestState **from, QTestState **to,
> got_stop = false;
>
> cmd_common = g_string_new("");
> + /* KVM first */
> + if (args->use_dirty_ring) {
> + g_string_append(cmd_common, "-accel kvm,dirty-ring-size=4096 ");
> + } else {
> + g_string_append(cmd_common, "-accel kvm ");
> + }
> + g_string_append(cmd_common, "-accel tcg ");
Yep, that's the right way around this time :-)
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> bootpath = g_strdup_printf("%s/bootsect", tmpfs);
> if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
> @@ -678,12 +685,10 @@ static int test_migrate_start(QTestState **from, QTestState **to,
> if (!args->only_target) {
> g_autofree gchar *cmd_source = NULL;
>
> - cmd_source = g_strdup_printf("-accel kvm%s -accel tcg %s "
> + cmd_source = g_strdup_printf("%s "
> "-name source,debug-threads=on "
> "-serial file:%s/src_serial "
> "%s %s %s",
> - args->use_dirty_ring ?
> - ",dirty-ring-size=4096" : "",
> cmd_common->str,
> tmpfs,
> arch_source,
> @@ -692,13 +697,11 @@ static int test_migrate_start(QTestState **from, QTestState **to,
> *from = qtest_init(cmd_source);
> }
>
> - cmd_target = g_strdup_printf("-accel kvm%s -accel tcg %s "
> + cmd_target = g_strdup_printf("%s "
> "-name target,debug-threads=on "
> "-serial file:%s/dest_serial "
> "-incoming %s "
> "%s %s %s",
> - args->use_dirty_ring ?
> - ",dirty-ring-size=4096" : "",
> cmd_common->str,
> tmpfs, uri,
> arch_target,
> --
> 2.38.1
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v3 05/11] tests/qtest/migration-test: Inverse #ifdef'ry ladders
2023-01-20 8:23 ` [PATCH v3 05/11] tests/qtest/migration-test: Inverse #ifdef'ry ladders Philippe Mathieu-Daudé
@ 2023-01-30 4:43 ` Juan Quintela
0 siblings, 0 replies; 25+ messages in thread
From: Juan Quintela @ 2023-01-30 4:43 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Paolo Bonzini, Dr. David Alan Gilbert, Thomas Huth,
Fabiano Rosas, Laurent Vivier, qemu-arm, Richard Henderson
Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
> This slighly simplify the logic, and eases the following conversion.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Juan Quintela <quintela@redhat.com>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v3 06/11] tests/qtest/migration-test: Reduce 'cmd_source' string scope
2023-01-20 8:23 ` [PATCH v3 06/11] tests/qtest/migration-test: Reduce 'cmd_source' string scope Philippe Mathieu-Daudé
@ 2023-01-30 4:44 ` Juan Quintela
2023-01-31 14:23 ` Thomas Huth
0 siblings, 1 reply; 25+ messages in thread
From: Juan Quintela @ 2023-01-30 4:44 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Paolo Bonzini, Dr. David Alan Gilbert, Thomas Huth,
Fabiano Rosas, Laurent Vivier, qemu-arm, Richard Henderson
Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Juan Quintela <quintela@redhat.com>
I am assuming that you will pull this patches through tests tree, not
migration tree.
Otherwise, let me know.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v3 07/11] tests/qtest/migration-test: Build command line using GString API (1/4)
2023-01-20 8:23 ` [PATCH v3 07/11] tests/qtest/migration-test: Build command line using GString API (1/4) Philippe Mathieu-Daudé
2023-01-23 10:57 ` Dr. David Alan Gilbert
@ 2023-01-30 4:45 ` Juan Quintela
1 sibling, 0 replies; 25+ messages in thread
From: Juan Quintela @ 2023-01-30 4:45 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Paolo Bonzini, Dr. David Alan Gilbert, Thomas Huth,
Fabiano Rosas, Laurent Vivier, qemu-arm
Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
> Part 1/4: Convert memory & machine options.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Much nicer.
Reviewed-by: Juan Quintela <quintela@redhat.com>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v3 08/11] tests/qtest/migration-test: Build command line using GString API (2/4)
2023-01-20 8:23 ` [PATCH v3 08/11] tests/qtest/migration-test: Build command line using GString API (2/4) Philippe Mathieu-Daudé
@ 2023-01-30 4:46 ` Juan Quintela
0 siblings, 0 replies; 25+ messages in thread
From: Juan Quintela @ 2023-01-30 4:46 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Paolo Bonzini, Dr. David Alan Gilbert, Thomas Huth,
Fabiano Rosas, Laurent Vivier, qemu-arm, Richard Henderson
Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
> Part 2/4: Convert shmem option.
>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Again, much nicer that what was there.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v3 09/11] tests/qtest/migration-test: Build command line using GString API (3/4)
2023-01-20 8:23 ` [PATCH v3 09/11] tests/qtest/migration-test: Build command line using GString API (3/4) Philippe Mathieu-Daudé
2023-01-23 10:59 ` Dr. David Alan Gilbert
@ 2023-01-30 4:47 ` Juan Quintela
1 sibling, 0 replies; 25+ messages in thread
From: Juan Quintela @ 2023-01-30 4:47 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Paolo Bonzini, Dr. David Alan Gilbert, Thomas Huth,
Fabiano Rosas, Laurent Vivier, qemu-arm, Richard Henderson
Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
> Part 3/4: Convert accelerator options.
>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Juan Quintela <quintela@redhat.com>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v3 10/11] tests/qtest/migration-test: Build command line using GString API (4/4)
2023-01-20 8:23 ` [PATCH v3 10/11] tests/qtest/migration-test: Build command line using GString API (4/4) Philippe Mathieu-Daudé
@ 2023-01-30 4:48 ` Juan Quintela
0 siblings, 0 replies; 25+ messages in thread
From: Juan Quintela @ 2023-01-30 4:48 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Paolo Bonzini, Dr. David Alan Gilbert, Thomas Huth,
Fabiano Rosas, Laurent Vivier, qemu-arm, Richard Henderson
Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
> Part 4/4: Convert rest of options.
>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Juan Quintela <quintela@redhat.com>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v3 11/11] tests/qtest/migration-test: Only use available accelerators
2023-01-20 8:23 ` [PATCH v3 11/11] tests/qtest/migration-test: Only use available accelerators Philippe Mathieu-Daudé
@ 2023-01-30 4:49 ` Juan Quintela
0 siblings, 0 replies; 25+ messages in thread
From: Juan Quintela @ 2023-01-30 4:49 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Paolo Bonzini, Dr. David Alan Gilbert, Thomas Huth,
Fabiano Rosas, Laurent Vivier, qemu-arm, Richard Henderson
Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
> For example, avoid when TCG is disabled:
>
> $ make check-qtest-aarch64
> ...
> 20/20 qemu:qtest+qtest-aarch64 / qtest-aarch64/migration-test
> qemu-system-aarch64: -accel tcg: invalid accelerator tcg
>
> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Juan Quintela <quintela@redhat.com>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v3 06/11] tests/qtest/migration-test: Reduce 'cmd_source' string scope
2023-01-30 4:44 ` Juan Quintela
@ 2023-01-31 14:23 ` Thomas Huth
2023-02-01 13:07 ` Juan Quintela
0 siblings, 1 reply; 25+ messages in thread
From: Thomas Huth @ 2023-01-31 14:23 UTC (permalink / raw)
To: quintela, Philippe Mathieu-Daudé
Cc: qemu-devel, Paolo Bonzini, Dr. David Alan Gilbert, Fabiano Rosas,
Laurent Vivier, qemu-arm, Richard Henderson
On 30/01/2023 05.44, Juan Quintela wrote:
> Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>
> Reviewed-by: Juan Quintela <quintela@redhat.com>
>
> I am assuming that you will pull this patches through tests tree, not
> migration tree.
>
> Otherwise, let me know.
I had some remarks (in v2 of the series), so I'm not going to pick this up
(yet). If you want to take the migration part, feel free to do so.
I still think it's quite a lot of code churn for just supporting multiple
"-accel" statements here.
What about introducing a new lib functions like this:
char *qtest_get_accel_params(bool use_tcg_first)
{
bool tcg = qtest_has_accel("tcg");
return g_strdup_printf("%s %s %s %s",
use_tcg_first && tcg ? "-accel tcg" : "",
qtest_has_accel("kvm") ? "-accel kvm" : "",
qtest_has_accel("hvf") ? "-accel hvf" : "",
!use_tcg_first && tcg ? "-accel tcg" : "");
}
... then all tests that want to run real code could simply call this
function instead of having to deal with the list of supported accelerators
again and again?
Thomas
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v3 06/11] tests/qtest/migration-test: Reduce 'cmd_source' string scope
2023-01-31 14:23 ` Thomas Huth
@ 2023-02-01 13:07 ` Juan Quintela
0 siblings, 0 replies; 25+ messages in thread
From: Juan Quintela @ 2023-02-01 13:07 UTC (permalink / raw)
To: Thomas Huth
Cc: Philippe Mathieu-Daudé,
qemu-devel, Paolo Bonzini, Dr. David Alan Gilbert, Fabiano Rosas,
Laurent Vivier, qemu-arm, Richard Henderson
Thomas Huth <thuth@redhat.com> wrote:
> On 30/01/2023 05.44, Juan Quintela wrote:
>> Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> Reviewed-by: Juan Quintela <quintela@redhat.com>
>> I am assuming that you will pull this patches through tests tree,
>> not
>> migration tree.
>> Otherwise, let me know.
>
> I had some remarks (in v2 of the series), so I'm not going to pick
> this up (yet). If you want to take the migration part, feel free to do
> so.
>
> I still think it's quite a lot of code churn for just supporting
> multiple "-accel" statements here.
>
> What about introducing a new lib functions like this:
>
> char *qtest_get_accel_params(bool use_tcg_first)
> {
> bool tcg = qtest_has_accel("tcg");
>
> return g_strdup_printf("%s %s %s %s",
> use_tcg_first && tcg ? "-accel tcg" : "",
> qtest_has_accel("kvm") ? "-accel kvm" : "",
> qtest_has_accel("hvf") ? "-accel hvf" : "",
> !use_tcg_first && tcg ? "-accel tcg" : "");
I know that it is me, but I don't find the ? operator especially
readable.
What about:
GString *s = g_string_new("");
bool tcg = qtest_has_accel("tcg");
if (use_tcg_first && tcg)
g_string_append(s, "-accel tcg ");
if (qtest_has_accel("kvm"))
g_string_append(s, "-accel kvm ");
if (qtest_has_accel("hvf"))
g_string_append(s, "-accel hvf ");
if (!use_tcg_first && tcg)
g_string_append(s, "-accel tcg");
return s;
Yes, in the function that Phillipe is changing now, each time that I
have to change it, I have to count to see what and where I need to put
the format/change/whatever.
> }
>
> ... then all tests that want to run real code could simply call this
> function instead of having to deal with the list of supported
> accelerators again and again?
It is ok with me.
Later, Juan.
^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2023-02-01 13:08 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-20 8:23 [PATCH v3 00/11] tests/qtest: Allow running boot-serial / migration with TCG disabled Philippe Mathieu-Daudé
2023-01-20 8:23 ` [PATCH v3 01/11] tests/qtest/boot-serial-test: Constify tests[] array Philippe Mathieu-Daudé
2023-01-20 8:23 ` [PATCH v3 02/11] tests/qtest/boot-serial-test: Simplify test_machine() a bit Philippe Mathieu-Daudé
2023-01-20 8:23 ` [PATCH v3 03/11] tests/qtest/boot-serial-test: Build command line using GString API Philippe Mathieu-Daudé
2023-01-20 8:23 ` [PATCH v3 04/11] tests/qtest/boot-serial-test: Only use available accelerators Philippe Mathieu-Daudé
2023-01-20 8:23 ` [PATCH v3 05/11] tests/qtest/migration-test: Inverse #ifdef'ry ladders Philippe Mathieu-Daudé
2023-01-30 4:43 ` Juan Quintela
2023-01-20 8:23 ` [PATCH v3 06/11] tests/qtest/migration-test: Reduce 'cmd_source' string scope Philippe Mathieu-Daudé
2023-01-30 4:44 ` Juan Quintela
2023-01-31 14:23 ` Thomas Huth
2023-02-01 13:07 ` Juan Quintela
2023-01-20 8:23 ` [PATCH v3 07/11] tests/qtest/migration-test: Build command line using GString API (1/4) Philippe Mathieu-Daudé
2023-01-23 10:57 ` Dr. David Alan Gilbert
2023-01-30 4:45 ` Juan Quintela
2023-01-20 8:23 ` [PATCH v3 08/11] tests/qtest/migration-test: Build command line using GString API (2/4) Philippe Mathieu-Daudé
2023-01-30 4:46 ` Juan Quintela
2023-01-20 8:23 ` [PATCH v3 09/11] tests/qtest/migration-test: Build command line using GString API (3/4) Philippe Mathieu-Daudé
2023-01-23 10:59 ` Dr. David Alan Gilbert
2023-01-30 4:47 ` Juan Quintela
2023-01-20 8:23 ` [PATCH v3 10/11] tests/qtest/migration-test: Build command line using GString API (4/4) Philippe Mathieu-Daudé
2023-01-30 4:48 ` Juan Quintela
2023-01-20 8:23 ` [PATCH v3 11/11] tests/qtest/migration-test: Only use available accelerators Philippe Mathieu-Daudé
2023-01-30 4:49 ` Juan Quintela
2023-01-20 9:18 ` [PATCH v3 00/11] tests/qtest: Allow running boot-serial / migration with TCG disabled Thomas Huth
2023-01-20 11:09 ` Philippe Mathieu-Daudé
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.