qtest: escape device name in device-introspect-test
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>
This commit is contained in:
parent
794b95608f
commit
e27bd49876
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user