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:
Fabiano Rosas 2024-11-13 16:46:09 -03:00 committed by Philippe Mathieu-Daudé
parent b2cc699979
commit 19e566162c
2 changed files with 35 additions and 28 deletions

View File

@ -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;
@ -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,14 +2577,16 @@ 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,
"{ 'execute': 'closefd',"
" 'arguments': { 'fdname': 'fd-mig' }}"); " '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,
"{ 'execute': 'closefd',"
" 'arguments': { 'fdname': 'fd-mig' }}"); " '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");
@ -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);
@ -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);
} }