aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2023-05-08 20:38:05 +0100
committerRichard Henderson <richard.henderson@linaro.org>2023-05-08 20:38:05 +0100
commit271477b59e723250f17a7e20f139262057921b6a (patch)
treef93c43185100bb7042fe6bc0dd15f9cbfbc87fef /tests
parent792f77f376adef944f9a03e601f6ad90c2f891b2 (diff)
parentc323518a7aab1c01740a468671b7f2b517d3bca6 (diff)
downloadqemu-271477b59e723250f17a7e20f139262057921b6a.zip
qemu-271477b59e723250f17a7e20f139262057921b6a.tar.gz
qemu-271477b59e723250f17a7e20f139262057921b6a.tar.bz2
Merge tag 'compression-code-pull-request' of https://gitlab.com/juan.quintela/qemu into staging
Migration PULL request (20230508 edition, take 2) Hi This is just the compression bits of the Migration PULL request for 20230428. Only change is that we don't run the compression tests by default. The problem already exist with compression code. The test just show that it don't work. - Add migration tests for (old) compress migration code (lukas) - Make compression code independent of ram.c (lukas) - Move compression code into ram-compress.c (lukas) Please apply, Juan. # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCAAdFiEEGJn/jt6/WMzuA0uC9IfvGFhy1yMFAmRZRMwACgkQ9IfvGFhy # 1yOdixAA1fOLanaYMUJZGLZ9sVTt7rDc4AEPRGkQOYYZNGK3LHaG2Dx9ob2/CEkS # /YPp9Oth9QAYHZgiI2Xx8GSg98PRVr9b/GlQPseoCOFXnUL89rTpQtxQq4CV41E6 # AA5Dr8Z07hsr47ERQERFfDGD4zsvpn+NWM1ZBy+CCilf/o8UU4eIyfRF34YgSScv # FVdWM4czUKei9fe2Go1KnMCz1GnT/6epl47Hs8zn9WAEeUfLILp7dbkbNq26F65G # 8YC8YnrikxU+2j+NIyIbRxbIdjR+JUbR14AyezwWZ2zGbirwWN1DP2WQx0QIZOqM # ZuCqIDj5HpNSlHmShI0gNDfPvs+iM+sFSwQ7JE8Q03hlES9HF5c+MOr3Pl3J91hH # EEmkk5gBJ2v2tvBuHgwVAQ2UH1+XT+a7RXeoMU1iizc2sXRGDK12ZsyaAg4D0oaF # eohzJk2j1QXcx/DNK2G5uhzwgKvKv1/+rHyYQFtg+XuWVVipSNwqRjDJkDANAYZP # VwKOOqDd5lHLOIzE1j61Yu06DJhkSoMvz74RQlqnk+r1EKJcTUZL52uhQor//DaL # ULpBsgYzoMUMrtw7myHxq4t0t6mmOtOkb0CvO8dTzkIV0YgIFTtPFB0ySXOFUFf5 # UoFoMFKlfbPpDsvTNEVErxpaG4FBwZNVt67V2KXQ53xRPShyBiQ= # =SG8L # -----END PGP SIGNATURE----- # gpg: Signature made Mon 08 May 2023 07:51:56 PM BST # gpg: using RSA key 1899FF8EDEBF58CCEE034B82F487EF185872D723 # gpg: Good signature from "Juan Quintela <quintela@redhat.com>" [undefined] # gpg: aka "Juan Quintela <quintela@trasno.org>" [undefined] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 1899 FF8E DEBF 58CC EE03 4B82 F487 EF18 5872 D723 * tag 'compression-code-pull-request' of https://gitlab.com/juan.quintela/qemu: migration: Initialize and cleanup decompression in migration.c ram-compress.c: Make target independent ram compress: Assert that the file buffer matches the result ram.c: Move core decompression code into its own file ram.c: Move core compression code into its own file ram.c: Remove last ram.c dependency from the core compress code ram.c: Call update_compress_thread_counts from compress_send_queued_data ram.c: Do not call save_page_header() from compress threads ram.c: Reset result after sending queued data ram.c: Dont change param->block in the compress thread ram.c: Let the compress threads return a CompressResult enum qtest/migration-test.c: Add postcopy tests with compress enabled qtest/migration-test.c: Add tests with compress enabled Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/qtest/migration-test.c134
1 files changed, 134 insertions, 0 deletions
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index be73ec3..8a5df84 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -406,6 +406,41 @@ static void migrate_set_parameter_str(QTestState *who, const char *parameter,
migrate_check_parameter_str(who, parameter, value);
}
+static long long migrate_get_parameter_bool(QTestState *who,
+ const char *parameter)
+{
+ QDict *rsp;
+ int result;
+
+ rsp = wait_command(who, "{ 'execute': 'query-migrate-parameters' }");
+ result = qdict_get_bool(rsp, parameter);
+ qobject_unref(rsp);
+ return !!result;
+}
+
+static void migrate_check_parameter_bool(QTestState *who, const char *parameter,
+ int value)
+{
+ int result;
+
+ result = migrate_get_parameter_bool(who, parameter);
+ g_assert_cmpint(result, ==, value);
+}
+
+static void migrate_set_parameter_bool(QTestState *who, const char *parameter,
+ int value)
+{
+ QDict *rsp;
+
+ rsp = qtest_qmp(who,
+ "{ 'execute': 'migrate-set-parameters',"
+ "'arguments': { %s: %i } }",
+ parameter, value);
+ g_assert(qdict_haskey(rsp, "return"));
+ qobject_unref(rsp);
+ migrate_check_parameter_bool(who, parameter, value);
+}
+
static void migrate_ensure_non_converge(QTestState *who)
{
/* Can't converge with 1ms downtime + 3 mbs bandwidth limit */
@@ -1092,6 +1127,36 @@ test_migrate_tls_x509_finish(QTestState *from,
#endif /* CONFIG_TASN1 */
#endif /* CONFIG_GNUTLS */
+static void *
+test_migrate_compress_start(QTestState *from,
+ QTestState *to)
+{
+ migrate_set_parameter_int(from, "compress-level", 1);
+ migrate_set_parameter_int(from, "compress-threads", 4);
+ migrate_set_parameter_bool(from, "compress-wait-thread", true);
+ migrate_set_parameter_int(to, "decompress-threads", 4);
+
+ migrate_set_capability(from, "compress", true);
+ migrate_set_capability(to, "compress", true);
+
+ return NULL;
+}
+
+static void *
+test_migrate_compress_nowait_start(QTestState *from,
+ QTestState *to)
+{
+ migrate_set_parameter_int(from, "compress-level", 9);
+ migrate_set_parameter_int(from, "compress-threads", 1);
+ migrate_set_parameter_bool(from, "compress-wait-thread", false);
+ migrate_set_parameter_int(to, "decompress-threads", 1);
+
+ migrate_set_capability(from, "compress", true);
+ migrate_set_capability(to, "compress", true);
+
+ return NULL;
+}
+
static int migrate_postcopy_prepare(QTestState **from_ptr,
QTestState **to_ptr,
MigrateCommon *args)
@@ -1169,6 +1234,15 @@ static void test_postcopy(void)
test_postcopy_common(&args);
}
+static void test_postcopy_compress(void)
+{
+ MigrateCommon args = {
+ .start_hook = test_migrate_compress_start
+ };
+
+ test_postcopy_common(&args);
+}
+
static void test_postcopy_preempt(void)
{
MigrateCommon args = {
@@ -1270,6 +1344,15 @@ static void test_postcopy_recovery(void)
test_postcopy_recovery_common(&args);
}
+static void test_postcopy_recovery_compress(void)
+{
+ MigrateCommon args = {
+ .start_hook = test_migrate_compress_start
+ };
+
+ test_postcopy_recovery_common(&args);
+}
+
#ifdef CONFIG_GNUTLS
static void test_postcopy_recovery_tls_psk(void)
{
@@ -1303,6 +1386,7 @@ static void test_postcopy_preempt_all(void)
test_postcopy_recovery_common(&args);
}
+
#endif
static void test_baddest(void)
@@ -1524,6 +1608,40 @@ static void test_precopy_unix_xbzrle(void)
test_precopy_common(&args);
}
+static void test_precopy_unix_compress(void)
+{
+ g_autofree char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
+ MigrateCommon args = {
+ .connect_uri = uri,
+ .listen_uri = uri,
+ .start_hook = test_migrate_compress_start,
+ /*
+ * Test that no invalid thread state is left over from
+ * the previous iteration.
+ */
+ .iterations = 2,
+ };
+
+ test_precopy_common(&args);
+}
+
+static void test_precopy_unix_compress_nowait(void)
+{
+ g_autofree char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
+ MigrateCommon args = {
+ .connect_uri = uri,
+ .listen_uri = uri,
+ .start_hook = test_migrate_compress_nowait_start,
+ /*
+ * Test that no invalid thread state is left over from
+ * the previous iteration.
+ */
+ .iterations = 2,
+ };
+
+ test_precopy_common(&args);
+}
+
static void test_precopy_tcp_plain(void)
{
MigrateCommon args = {
@@ -2532,11 +2650,27 @@ int main(int argc, char **argv)
qtest_add_func("/migration/postcopy/preempt/plain", test_postcopy_preempt);
qtest_add_func("/migration/postcopy/preempt/recovery/plain",
test_postcopy_preempt_recovery);
+ if (getenv("QEMU_TEST_FLAKY_TESTS")) {
+ qtest_add_func("/migration/postcopy/compress/plain",
+ test_postcopy_compress);
+ qtest_add_func("/migration/postcopy/recovery/compress/plain",
+ test_postcopy_recovery_compress);
+ }
}
qtest_add_func("/migration/bad_dest", test_baddest);
qtest_add_func("/migration/precopy/unix/plain", test_precopy_unix_plain);
qtest_add_func("/migration/precopy/unix/xbzrle", test_precopy_unix_xbzrle);
+ /*
+ * Compression fails from time to time.
+ * Put test here but don't enable it until everything is fixed.
+ */
+ if (getenv("QEMU_TEST_FLAKY_TESTS")) {
+ qtest_add_func("/migration/precopy/unix/compress/wait",
+ test_precopy_unix_compress);
+ qtest_add_func("/migration/precopy/unix/compress/nowait",
+ test_precopy_unix_compress_nowait);
+ }
#ifdef CONFIG_GNUTLS
qtest_add_func("/migration/precopy/unix/tls/psk",
test_precopy_unix_tls_psk);