tests/qtest/migration: Fix indentations
Select all the code and hit tab. I'll be moving functions around quite a lot in the next patches, so make sure all indentation is correct now. Add parentheses around some expressions to preserve readability. Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Fabiano Rosas <farosas@suse.de> Message-ID: <20241113194630.3385-2-farosas@suse.de> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
parent
b2cc699979
commit
19e566162c
@ -140,8 +140,8 @@ static void migrate_set_ports(QTestState *to, QList *channel_list)
|
|||||||
if (qdict_haskey(addrdict, "port") &&
|
if (qdict_haskey(addrdict, "port") &&
|
||||||
qdict_haskey(addr, "port") &&
|
qdict_haskey(addr, "port") &&
|
||||||
(strcmp(qdict_get_str(addrdict, "port"), "0") == 0)) {
|
(strcmp(qdict_get_str(addrdict, "port"), "0") == 0)) {
|
||||||
addr_port = qdict_get_str(addr, "port");
|
addr_port = qdict_get_str(addr, "port");
|
||||||
qdict_put_str(addrdict, "port", addr_port);
|
qdict_put_str(addrdict, "port", addr_port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,8 +113,8 @@ static bool ufd_version_check(void)
|
|||||||
}
|
}
|
||||||
uffd_feature_thread_id = api_struct.features & UFFD_FEATURE_THREAD_ID;
|
uffd_feature_thread_id = api_struct.features & UFFD_FEATURE_THREAD_ID;
|
||||||
|
|
||||||
ioctl_mask = 1ULL << _UFFDIO_REGISTER |
|
ioctl_mask = (1ULL << _UFFDIO_REGISTER |
|
||||||
1ULL << _UFFDIO_UNREGISTER;
|
1ULL << _UFFDIO_UNREGISTER);
|
||||||
if ((api_struct.ioctls & ioctl_mask) != ioctl_mask) {
|
if ((api_struct.ioctls & ioctl_mask) != ioctl_mask) {
|
||||||
g_test_message("Skipping test: Missing userfault feature");
|
g_test_message("Skipping test: Missing userfault feature");
|
||||||
return false;
|
return false;
|
||||||
@ -423,7 +423,7 @@ static void migrate_set_parameter_str(QTestState *who, const char *parameter,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static long long migrate_get_parameter_bool(QTestState *who,
|
static long long migrate_get_parameter_bool(QTestState *who,
|
||||||
const char *parameter)
|
const char *parameter)
|
||||||
{
|
{
|
||||||
QDict *rsp;
|
QDict *rsp;
|
||||||
int result;
|
int result;
|
||||||
@ -436,7 +436,7 @@ static long long migrate_get_parameter_bool(QTestState *who,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void migrate_check_parameter_bool(QTestState *who, const char *parameter,
|
static void migrate_check_parameter_bool(QTestState *who, const char *parameter,
|
||||||
int value)
|
int value)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
@ -445,7 +445,7 @@ static void migrate_check_parameter_bool(QTestState *who, const char *parameter,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void migrate_set_parameter_bool(QTestState *who, const char *parameter,
|
static void migrate_set_parameter_bool(QTestState *who, const char *parameter,
|
||||||
int value)
|
int value)
|
||||||
{
|
{
|
||||||
qtest_qmp_assert_success(who,
|
qtest_qmp_assert_success(who,
|
||||||
"{ 'execute': 'migrate-set-parameters',"
|
"{ 'execute': 'migrate-set-parameters',"
|
||||||
@ -1384,8 +1384,10 @@ static void test_postcopy_preempt_tls_psk(void)
|
|||||||
static void wait_for_postcopy_status(QTestState *one, const char *status)
|
static void wait_for_postcopy_status(QTestState *one, const char *status)
|
||||||
{
|
{
|
||||||
wait_for_migration_status(one, status,
|
wait_for_migration_status(one, status,
|
||||||
(const char * []) { "failed", "active",
|
(const char * []) {
|
||||||
"completed", NULL });
|
"failed", "active",
|
||||||
|
"completed", NULL
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static void postcopy_recover_fail(QTestState *from, QTestState *to,
|
static void postcopy_recover_fail(QTestState *from, QTestState *to,
|
||||||
@ -2575,15 +2577,17 @@ static void test_migrate_fd_finish_hook(QTestState *from,
|
|||||||
/* Test closing fds */
|
/* Test closing fds */
|
||||||
/* We assume, that QEMU removes named fd from its list,
|
/* We assume, that QEMU removes named fd from its list,
|
||||||
* so this should fail */
|
* so this should fail */
|
||||||
rsp = qtest_qmp(from, "{ 'execute': 'closefd',"
|
rsp = qtest_qmp(from,
|
||||||
" 'arguments': { 'fdname': 'fd-mig' }}");
|
"{ 'execute': 'closefd',"
|
||||||
|
" 'arguments': { 'fdname': 'fd-mig' }}");
|
||||||
g_assert_true(qdict_haskey(rsp, "error"));
|
g_assert_true(qdict_haskey(rsp, "error"));
|
||||||
error_desc = qdict_get_str(qdict_get_qdict(rsp, "error"), "desc");
|
error_desc = qdict_get_str(qdict_get_qdict(rsp, "error"), "desc");
|
||||||
g_assert_cmpstr(error_desc, ==, "File descriptor named 'fd-mig' not found");
|
g_assert_cmpstr(error_desc, ==, "File descriptor named 'fd-mig' not found");
|
||||||
qobject_unref(rsp);
|
qobject_unref(rsp);
|
||||||
|
|
||||||
rsp = qtest_qmp(to, "{ 'execute': 'closefd',"
|
rsp = qtest_qmp(to,
|
||||||
" 'arguments': { 'fdname': 'fd-mig' }}");
|
"{ 'execute': 'closefd',"
|
||||||
|
" 'arguments': { 'fdname': 'fd-mig' }}");
|
||||||
g_assert_true(qdict_haskey(rsp, "error"));
|
g_assert_true(qdict_haskey(rsp, "error"));
|
||||||
error_desc = qdict_get_str(qdict_get_qdict(rsp, "error"), "desc");
|
error_desc = qdict_get_str(qdict_get_qdict(rsp, "error"), "desc");
|
||||||
g_assert_cmpstr(error_desc, ==, "File descriptor named 'fd-mig' not found");
|
g_assert_cmpstr(error_desc, ==, "File descriptor named 'fd-mig' not found");
|
||||||
@ -2741,11 +2745,11 @@ static void test_validate_uri_channels_both_set(void)
|
|||||||
},
|
},
|
||||||
.listen_uri = "defer",
|
.listen_uri = "defer",
|
||||||
.connect_uri = "tcp:127.0.0.1:0",
|
.connect_uri = "tcp:127.0.0.1:0",
|
||||||
.connect_channels = "[ { 'channel-type': 'main',"
|
.connect_channels = ("[ { ""'channel-type': 'main',"
|
||||||
" 'addr': { 'transport': 'socket',"
|
" 'addr': { 'transport': 'socket',"
|
||||||
" 'type': 'inet',"
|
" 'type': 'inet',"
|
||||||
" 'host': '127.0.0.1',"
|
" 'host': '127.0.0.1',"
|
||||||
" 'port': '0' } } ]",
|
" 'port': '0' } } ]"),
|
||||||
};
|
};
|
||||||
|
|
||||||
do_test_validate_uri_channel(&args);
|
do_test_validate_uri_channel(&args);
|
||||||
@ -2967,7 +2971,7 @@ test_migrate_precopy_tcp_multifd_qatzip_start(QTestState *from,
|
|||||||
#ifdef CONFIG_QPL
|
#ifdef CONFIG_QPL
|
||||||
static void *
|
static void *
|
||||||
test_migrate_precopy_tcp_multifd_qpl_start(QTestState *from,
|
test_migrate_precopy_tcp_multifd_qpl_start(QTestState *from,
|
||||||
QTestState *to)
|
QTestState *to)
|
||||||
{
|
{
|
||||||
return test_migrate_precopy_tcp_multifd_start_common(from, to, "qpl");
|
return test_migrate_precopy_tcp_multifd_start_common(from, to, "qpl");
|
||||||
}
|
}
|
||||||
@ -3032,11 +3036,11 @@ static void test_multifd_tcp_channels_none(void)
|
|||||||
.listen_uri = "defer",
|
.listen_uri = "defer",
|
||||||
.start_hook = test_migrate_precopy_tcp_multifd_start,
|
.start_hook = test_migrate_precopy_tcp_multifd_start,
|
||||||
.live = true,
|
.live = true,
|
||||||
.connect_channels = "[ { 'channel-type': 'main',"
|
.connect_channels = ("[ { 'channel-type': 'main',"
|
||||||
" 'addr': { 'transport': 'socket',"
|
" 'addr': { 'transport': 'socket',"
|
||||||
" 'type': 'inet',"
|
" 'type': 'inet',"
|
||||||
" 'host': '127.0.0.1',"
|
" 'host': '127.0.0.1',"
|
||||||
" 'port': '0' } } ]",
|
" 'port': '0' } } ]"),
|
||||||
};
|
};
|
||||||
test_precopy_common(&args);
|
test_precopy_common(&args);
|
||||||
}
|
}
|
||||||
@ -3668,7 +3672,8 @@ static void test_migrate_dirty_limit(void)
|
|||||||
throttle_us_per_full = 0;
|
throttle_us_per_full = 0;
|
||||||
while (throttle_us_per_full == 0) {
|
while (throttle_us_per_full == 0) {
|
||||||
throttle_us_per_full =
|
throttle_us_per_full =
|
||||||
read_migrate_property_int(from, "dirty-limit-throttle-time-per-round");
|
read_migrate_property_int(from,
|
||||||
|
"dirty-limit-throttle-time-per-round");
|
||||||
usleep(100);
|
usleep(100);
|
||||||
g_assert_false(src_state.stop_seen);
|
g_assert_false(src_state.stop_seen);
|
||||||
}
|
}
|
||||||
@ -3680,7 +3685,8 @@ static void test_migrate_dirty_limit(void)
|
|||||||
/* Check if dirty limit throttle switched off, set timeout 1ms */
|
/* Check if dirty limit throttle switched off, set timeout 1ms */
|
||||||
do {
|
do {
|
||||||
throttle_us_per_full =
|
throttle_us_per_full =
|
||||||
read_migrate_property_int(from, "dirty-limit-throttle-time-per-round");
|
read_migrate_property_int(from,
|
||||||
|
"dirty-limit-throttle-time-per-round");
|
||||||
usleep(100);
|
usleep(100);
|
||||||
g_assert_false(src_state.stop_seen);
|
g_assert_false(src_state.stop_seen);
|
||||||
} while (throttle_us_per_full != 0 && --max_try_count);
|
} while (throttle_us_per_full != 0 && --max_try_count);
|
||||||
@ -3709,7 +3715,8 @@ static void test_migrate_dirty_limit(void)
|
|||||||
throttle_us_per_full = 0;
|
throttle_us_per_full = 0;
|
||||||
while (throttle_us_per_full == 0) {
|
while (throttle_us_per_full == 0) {
|
||||||
throttle_us_per_full =
|
throttle_us_per_full =
|
||||||
read_migrate_property_int(from, "dirty-limit-throttle-time-per-round");
|
read_migrate_property_int(from,
|
||||||
|
"dirty-limit-throttle-time-per-round");
|
||||||
usleep(100);
|
usleep(100);
|
||||||
g_assert_false(src_state.stop_seen);
|
g_assert_false(src_state.stop_seen);
|
||||||
}
|
}
|
||||||
@ -3989,7 +3996,7 @@ int main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_QATZIP
|
#ifdef CONFIG_QATZIP
|
||||||
migration_test_add("/migration/multifd/tcp/plain/qatzip",
|
migration_test_add("/migration/multifd/tcp/plain/qatzip",
|
||||||
test_multifd_tcp_qatzip);
|
test_multifd_tcp_qatzip);
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_QPL
|
#ifdef CONFIG_QPL
|
||||||
migration_test_add("/migration/multifd/tcp/plain/qpl",
|
migration_test_add("/migration/multifd/tcp/plain/qpl",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user