diff options
author | Juan Quintela <quintela@redhat.com> | 2019-04-03 11:00:04 +0200 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2020-01-20 09:10:22 +0100 |
commit | 6a22c5444c7cf79aaa47d1bc9485cf5dfe90429b (patch) | |
tree | 33dd4daad76116d7ea6eaaab4f6d7679d6cdd9dc /tests | |
parent | 4d65a6216bfc44891ac298b74a6921d479805131 (diff) | |
download | qemu-6a22c5444c7cf79aaa47d1bc9485cf5dfe90429b.zip qemu-6a22c5444c7cf79aaa47d1bc9485cf5dfe90429b.tar.gz qemu-6a22c5444c7cf79aaa47d1bc9485cf5dfe90429b.tar.bz2 |
migration-test: introduce functions to handle string parameters
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/qtest/migration-test.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 81f6560..26e2e77 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -356,6 +356,43 @@ static void migrate_set_parameter_int(QTestState *who, const char *parameter, migrate_check_parameter_int(who, parameter, value); } +static char *migrate_get_parameter_str(QTestState *who, + const char *parameter) +{ + QDict *rsp; + char *result; + + rsp = wait_command(who, "{ 'execute': 'query-migrate-parameters' }"); + result = g_strdup(qdict_get_str(rsp, parameter)); + qobject_unref(rsp); + return result; +} + +static void migrate_check_parameter_str(QTestState *who, const char *parameter, + const char *value) +{ + char *result; + + result = migrate_get_parameter_str(who, parameter); + g_assert_cmpstr(result, ==, value); + g_free(result); +} + +__attribute__((unused)) +static void migrate_set_parameter_str(QTestState *who, const char *parameter, + const char *value) +{ + QDict *rsp; + + rsp = qtest_qmp(who, + "{ 'execute': 'migrate-set-parameters'," + "'arguments': { %s: %s } }", + parameter, value); + g_assert(qdict_haskey(rsp, "return")); + qobject_unref(rsp); + migrate_check_parameter_str(who, parameter, value); +} + static void migrate_pause(QTestState *who) { QDict *rsp; |