[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 01/11] tests/qtest: Allow qtest_qemu_binary to use a custom en
From: |
Fabiano Rosas |
Subject: |
[PATCH v3 01/11] tests/qtest: Allow qtest_qemu_binary to use a custom environment variable |
Date: |
Wed, 18 Oct 2023 11:07:26 -0300 |
We're adding support for testing migration using two different QEMU
binaries. We'll provide the second binary in a new environment
variable.
Allow qtest_qemu_binary() to receive the name of the new variable. If
the new environment variable is not set, that's not an error, we use
QTEST_QEMU_BINARY as a fallback.
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
tests/qtest/libqtest.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index dc7a55634c..03fa644663 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -336,10 +336,17 @@ void qtest_remove_abrt_handler(void *data)
}
}
-static const char *qtest_qemu_binary(void)
+static const char *qtest_qemu_binary(const char *var)
{
const char *qemu_bin;
+ if (var) {
+ qemu_bin = getenv(var);
+ if (qemu_bin) {
+ return qemu_bin;
+ }
+ }
+
qemu_bin = getenv("QTEST_QEMU_BINARY");
if (!qemu_bin) {
fprintf(stderr, "Environment variable QTEST_QEMU_BINARY required\n");
@@ -392,7 +399,7 @@ static QTestState *G_GNUC_PRINTF(1, 2)
qtest_spawn_qemu(const char *fmt, ...)
va_start(ap, fmt);
g_string_append_printf(command, CMD_EXEC "%s %s",
- qtest_qemu_binary(), tracearg);
+ qtest_qemu_binary(NULL), tracearg);
g_string_append_vprintf(command, fmt, ap);
va_end(ap);
@@ -905,7 +912,7 @@ char *qtest_hmp(QTestState *s, const char *fmt, ...)
const char *qtest_get_arch(void)
{
- const char *qemu = qtest_qemu_binary();
+ const char *qemu = qtest_qemu_binary(NULL);
const char *end = strrchr(qemu, '-');
if (!end) {
--
2.35.3
- [PATCH v3 00/11] tests/migration-test: Allow testing older machine types, Fabiano Rosas, 2023/10/18
- [PATCH v3 01/11] tests/qtest: Allow qtest_qemu_binary to use a custom environment variable,
Fabiano Rosas <=
- [PATCH v3 02/11] tests/qtest: Introduce qtest_init_with_env, Fabiano Rosas, 2023/10/18
- [PATCH v3 05/11] tests/qtest: Introduce qtest_resolve_machine_alias, Fabiano Rosas, 2023/10/18
- [PATCH v3 06/11] tests/qtest/migration: Introduce find_common_machine_version, Fabiano Rosas, 2023/10/18
- [PATCH v3 07/11] tests/qtest/migration: Define a machine for all architectures, Fabiano Rosas, 2023/10/18
- [PATCH v3 08/11] tests/qtest/migration: Specify the geometry of the bootsector, Fabiano Rosas, 2023/10/18
- [PATCH v3 11/11] tests/qtest: Don't print messages from query instances, Fabiano Rosas, 2023/10/18
- [PATCH v3 03/11] tests/qtest: Allow qtest_get_machines to use an alternate QEMU binary, Fabiano Rosas, 2023/10/18
- [PATCH v3 04/11] tests/qtest: Introduce qtest_has_machine_with_env, Fabiano Rosas, 2023/10/18
- [PATCH v3 09/11] tests/qtest/migration: Set q35 as the default machine for x86_86, Fabiano Rosas, 2023/10/18