[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 20/20] qtest: escape device name in device-introspect-test
From: |
Paolo Bonzini |
Subject: |
[PULL 20/20] qtest: escape device name in device-introspect-test |
Date: |
Wed, 4 Nov 2020 10:01:53 -0500 |
device-introspect-test uses HMP, so it should escape the device name
properly. Because of this, a few devices that had commas in their
names were escaping testing.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
tests/qtest/device-introspect-test.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/tests/qtest/device-introspect-test.c
b/tests/qtest/device-introspect-test.c
index 9f22340ee5..bbec166dbc 100644
--- a/tests/qtest/device-introspect-test.c
+++ b/tests/qtest/device-introspect-test.c
@@ -104,7 +104,8 @@ static QList *device_type_list(QTestState *qts, bool
abstract)
static void test_one_device(QTestState *qts, const char *type)
{
QDict *resp;
- char *help;
+ char *help, *escaped;
+ GRegex *comma;
g_test_message("Testing device '%s'", type);
@@ -113,8 +114,13 @@ static void test_one_device(QTestState *qts, const char
*type)
type);
qobject_unref(resp);
- help = qtest_hmp(qts, "device_add \"%s,help\"", type);
+ comma = g_regex_new(",", 0, 0, NULL);
+ escaped = g_regex_replace_literal(comma, type, -1, 0, ",,", 0, NULL);
+ g_regex_unref(comma);
+
+ help = qtest_hmp(qts, "device_add \"%s,help\"", escaped);
g_free(help);
+ g_free(escaped);
}
static void test_device_intro_list(void)
--
2.26.2
- [PULL 04/20] scripts/oss-fuzz: rename bin/qemu-fuzz-i386, (continued)
- [PULL 04/20] scripts/oss-fuzz: rename bin/qemu-fuzz-i386, Paolo Bonzini, 2020/11/04
- [PULL 16/20] fuzz: fuzz offsets within pio/mmio regions, Paolo Bonzini, 2020/11/04
- [PULL 08/20] meson: vhost-user-gpu/virtiofsd: use absolute path, Paolo Bonzini, 2020/11/04
- [PULL 05/20] hw/isa/lpc_ich9: Ignore reserved/invalid SCI IRQ, Paolo Bonzini, 2020/11/04
- [PULL 15/20] fuzz: check the MR in the DMA callback, Paolo Bonzini, 2020/11/04
- [PULL 11/20] meson: fix warning for bad sphinx-build, Paolo Bonzini, 2020/11/04
- [PULL 14/20] fuzz: fix writing DMA patterns, Paolo Bonzini, 2020/11/04
- [PULL 17/20] semihosting: fix order of initialization functions, Paolo Bonzini, 2020/11/04
- [PULL 13/20] tests/qtest: Fix potential NULL pointer dereference in qos_build_main_args(), Paolo Bonzini, 2020/11/04
- [PULL 18/20] qapi, qemu-options: make all parsing visitors parse boolean options the same, Paolo Bonzini, 2020/11/04
- [PULL 20/20] qtest: escape device name in device-introspect-test,
Paolo Bonzini <=
- [PULL 19/20] ivshmem-test: do not use short-form boolean option, Paolo Bonzini, 2020/11/04