mirror of https://github.com/xemu-project/xemu.git
tests: Add deprecated commands migration test
We add deprecated commands on a new test, so we don't have to add it on normal tests. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
parent
31a6bb74fa
commit
4c27486dc7
|
@ -500,6 +500,51 @@ static void test_migrate_end(QTestState *from, QTestState *to)
|
||||||
cleanup("dest_serial");
|
cleanup("dest_serial");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void deprecated_set_downtime(QTestState *who, const double value)
|
||||||
|
{
|
||||||
|
QDict *rsp;
|
||||||
|
gchar *cmd;
|
||||||
|
char *expected;
|
||||||
|
int64_t result_int;
|
||||||
|
|
||||||
|
cmd = g_strdup_printf("{ 'execute': 'migrate_set_downtime',"
|
||||||
|
"'arguments': { 'value': %g } }", value);
|
||||||
|
rsp = qtest_qmp(who, cmd);
|
||||||
|
g_free(cmd);
|
||||||
|
g_assert(qdict_haskey(rsp, "return"));
|
||||||
|
QDECREF(rsp);
|
||||||
|
result_int = value * 1000L;
|
||||||
|
expected = g_strdup_printf("%" PRId64, result_int);
|
||||||
|
migrate_check_parameter(who, "downtime-limit", expected);
|
||||||
|
g_free(expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void deprecated_set_speed(QTestState *who, const char *value)
|
||||||
|
{
|
||||||
|
QDict *rsp;
|
||||||
|
gchar *cmd;
|
||||||
|
|
||||||
|
cmd = g_strdup_printf("{ 'execute': 'migrate_set_speed',"
|
||||||
|
"'arguments': { 'value': %s } }", value);
|
||||||
|
rsp = qtest_qmp(who, cmd);
|
||||||
|
g_free(cmd);
|
||||||
|
g_assert(qdict_haskey(rsp, "return"));
|
||||||
|
QDECREF(rsp);
|
||||||
|
migrate_check_parameter(who, "max-bandwidth", value);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_deprecated(void)
|
||||||
|
{
|
||||||
|
QTestState *from;
|
||||||
|
|
||||||
|
from = qtest_start("");
|
||||||
|
|
||||||
|
deprecated_set_downtime(from, 0.12345);
|
||||||
|
deprecated_set_speed(from, "12345");
|
||||||
|
|
||||||
|
qtest_quit(from);
|
||||||
|
}
|
||||||
|
|
||||||
static void test_migrate(void)
|
static void test_migrate(void)
|
||||||
{
|
{
|
||||||
char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
|
char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
|
||||||
|
@ -563,6 +608,7 @@ int main(int argc, char **argv)
|
||||||
module_call_init(MODULE_INIT_QOM);
|
module_call_init(MODULE_INIT_QOM);
|
||||||
|
|
||||||
qtest_add_func("/migration/postcopy/unix", test_migrate);
|
qtest_add_func("/migration/postcopy/unix", test_migrate);
|
||||||
|
qtest_add_func("/migration/deprecated", test_deprecated);
|
||||||
|
|
||||||
ret = g_test_run();
|
ret = g_test_run();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue