qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fabiano Rosas <farosas@suse.de>
To: qemu-devel@nongnu.org
Cc: Peter Xu <peterx@redhat.com>, Peter Maydell <peter.maydell@linaro.org>
Subject: [PATCH 3/4] tests/qtest/migration: Move tests into g_test_slow()
Date: Thu, 17 Oct 2024 11:32:10 -0300	[thread overview]
Message-ID: <20241017143211.17771-4-farosas@suse.de> (raw)
In-Reply-To: <20241017143211.17771-1-farosas@suse.de>

Move most of the tests under g_test_slow() and add a
migration_test_add_quick() helper to mark a test as "quick".

quick - runs with:
  make check
  make check-migration-quick
  make check-migration
  make SPEED=slow check

slow - runs with:
  make check-migration
  make SPEED=slow check

Also add some words on the rationale, which is to keep the bulk of the
migration-test out of make check.

Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 tests/qtest/migration-helpers.c |  9 +++++
 tests/qtest/migration-helpers.h | 16 ++++++++
 tests/qtest/migration-test.c    | 67 ++++++++++++++++-----------------
 3 files changed, 58 insertions(+), 34 deletions(-)

diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c
index 0025933883..b3a873630f 100644
--- a/tests/qtest/migration-helpers.c
+++ b/tests/qtest/migration-helpers.c
@@ -456,6 +456,15 @@ static void migration_test_wrapper(const void *data)
 }
 
 void migration_test_add(const char *path, void (*fn)(void))
+{
+    if (!g_test_slow()) {
+        return;
+    }
+
+    migration_test_add_quick(path, fn);
+}
+
+void migration_test_add_quick(const char *path, void (*fn)(void))
 {
     MigrationTest *test = g_new0(MigrationTest, 1);
 
diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helpers.h
index 72dba369fb..59daf5ea62 100644
--- a/tests/qtest/migration-helpers.h
+++ b/tests/qtest/migration-helpers.h
@@ -62,7 +62,23 @@ static inline bool probe_o_direct_support(const char *tmpfs)
     return false;
 }
 #endif
+
+/*
+ * Tests that would only break due to core migration changes should be
+ * added with migration_test_add(). Those are considered 'slow' by
+ * default and run during make check-migration, or when '-m slow' is
+ * added on the cmdline.
+ *
+ * Tests that are quick and simple, as well as those that are
+ * succeptible to changes outside of migration/ (e.g. depend on TLS,
+ * qio_channel, etc), should be added with
+ * migration_test_add_quick(). Those are considered 'quick' and run as
+ * part of make check (i.e. execute in CI and with every developer's
+ * invocation of make check). Avoid adding too much time to those.
+ */
 void migration_test_add(const char *path, void (*fn)(void));
+void migration_test_add_quick(const char *path, void (*fn)(void));
+
 void migration_event_wait(QTestState *s, const char *target);
 
 #endif /* MIGRATION_HELPERS_H */
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 95e45b5029..4b021984c4 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -43,6 +43,7 @@ static bool uffd_feature_thread_id;
 static QTestMigrationState src_state;
 static QTestMigrationState dst_state;
 
+
 /*
  * An initial 3 MB offset is used as that corresponds
  * to ~1 sec of data transfer with our bandwidth setting.
@@ -3785,20 +3786,20 @@ int main(int argc, char **argv)
 #endif
 
     if (is_x86) {
-        migration_test_add("/migration/precopy/unix/suspend/live",
-                           test_precopy_unix_suspend_live);
-        migration_test_add("/migration/precopy/unix/suspend/notlive",
-                           test_precopy_unix_suspend_notlive);
+        migration_test_add_quick("/migration/precopy/unix/suspend/live",
+                                 test_precopy_unix_suspend_live);
+        migration_test_add_quick("/migration/precopy/unix/suspend/notlive",
+                                 test_precopy_unix_suspend_notlive);
     }
 
     if (has_uffd) {
-        migration_test_add("/migration/postcopy/plain", test_postcopy);
+        migration_test_add_quick("/migration/postcopy/plain", test_postcopy);
         migration_test_add("/migration/postcopy/recovery/plain",
                            test_postcopy_recovery);
-        migration_test_add("/migration/postcopy/preempt/plain",
-                           test_postcopy_preempt);
-        migration_test_add("/migration/postcopy/preempt/recovery/plain",
-                           test_postcopy_preempt_recovery);
+        migration_test_add_quick("/migration/postcopy/preempt/plain",
+                                 test_postcopy_preempt);
+        migration_test_add_quick("/migration/postcopy/preempt/recovery/plain",
+                                 test_postcopy_preempt_recovery);
         migration_test_add("/migration/postcopy/recovery/double-failures/handshake",
                            test_postcopy_recovery_fail_handshake);
         migration_test_add("/migration/postcopy/recovery/double-failures/reconnect",
@@ -3809,12 +3810,12 @@ int main(int argc, char **argv)
         }
     }
 
-    migration_test_add("/migration/precopy/unix/plain",
-                       test_precopy_unix_plain);
-    if (g_test_slow()) {
-        migration_test_add("/migration/precopy/unix/xbzrle",
-                           test_precopy_unix_xbzrle);
-    }
+    migration_test_add_quick("/migration/precopy/unix/plain",
+                             test_precopy_unix_plain);
+
+    migration_test_add("/migration/precopy/unix/xbzrle",
+                       test_precopy_unix_xbzrle);
+
     migration_test_add("/migration/precopy/file",
                        test_precopy_file);
     migration_test_add("/migration/precopy/file/offset",
@@ -3881,14 +3882,14 @@ int main(int argc, char **argv)
 #endif /* CONFIG_TASN1 */
 #endif /* CONFIG_GNUTLS */
 
-    migration_test_add("/migration/precopy/tcp/plain", test_precopy_tcp_plain);
+    migration_test_add_quick("/migration/precopy/tcp/plain", test_precopy_tcp_plain);
 
     migration_test_add("/migration/precopy/tcp/plain/switchover-ack",
                        test_precopy_tcp_switchover_ack);
 
 #ifdef CONFIG_GNUTLS
-    migration_test_add("/migration/precopy/tcp/tls/psk/match",
-                       test_precopy_tcp_tls_psk_match);
+    migration_test_add_quick("/migration/precopy/tcp/tls/psk/match",
+                             test_precopy_tcp_tls_psk_match);
     migration_test_add("/migration/precopy/tcp/tls/psk/mismatch",
                        test_precopy_tcp_tls_psk_mismatch);
 #ifdef CONFIG_TASN1
@@ -3930,25 +3931,23 @@ int main(int argc, char **argv)
     /*
      * See explanation why this test is slow on function definition
      */
-    if (g_test_slow()) {
-        migration_test_add("/migration/auto_converge",
-                           test_migrate_auto_converge);
-        if (g_str_equal(arch, "x86_64") &&
-            has_kvm && kvm_dirty_ring_supported()) {
-            migration_test_add("/migration/dirty_limit",
-                               test_migrate_dirty_limit);
-        }
+    migration_test_add("/migration/auto_converge",
+                       test_migrate_auto_converge);
+    if (g_str_equal(arch, "x86_64") &&
+        has_kvm && kvm_dirty_ring_supported()) {
+        migration_test_add("/migration/dirty_limit",
+                           test_migrate_dirty_limit);
     }
-    migration_test_add("/migration/multifd/tcp/uri/plain/none",
-                       test_multifd_tcp_uri_none);
+    migration_test_add_quick("/migration/multifd/tcp/uri/plain/none",
+                             test_multifd_tcp_uri_none);
     migration_test_add("/migration/multifd/tcp/channels/plain/none",
                        test_multifd_tcp_channels_none);
     migration_test_add("/migration/multifd/tcp/plain/zero-page/legacy",
                        test_multifd_tcp_zero_page_legacy);
     migration_test_add("/migration/multifd/tcp/plain/zero-page/none",
                        test_multifd_tcp_no_zero_page);
-    migration_test_add("/migration/multifd/tcp/plain/cancel",
-                       test_multifd_tcp_cancel);
+    migration_test_add_quick("/migration/multifd/tcp/plain/cancel",
+                             test_multifd_tcp_cancel);
     migration_test_add("/migration/multifd/tcp/plain/zlib",
                        test_multifd_tcp_zlib);
 #ifdef CONFIG_ZSTD
@@ -3957,7 +3956,7 @@ int main(int argc, char **argv)
 #endif
 #ifdef CONFIG_QATZIP
     migration_test_add("/migration/multifd/tcp/plain/qatzip",
-                test_multifd_tcp_qatzip);
+                       test_multifd_tcp_qatzip);
 #endif
 #ifdef CONFIG_QPL
     migration_test_add("/migration/multifd/tcp/plain/qpl",
@@ -3987,9 +3986,9 @@ int main(int argc, char **argv)
 #endif /* CONFIG_GNUTLS */
 
     if (g_str_equal(arch, "x86_64") && has_kvm && kvm_dirty_ring_supported()) {
-        migration_test_add("/migration/dirty_ring",
-                           test_precopy_unix_dirty_ring);
-        if (qtest_has_machine("pc") && g_test_slow()) {
+        migration_test_add_quick("/migration/dirty_ring",
+                                 test_precopy_unix_dirty_ring);
+        if (qtest_has_machine("pc")) {
             migration_test_add("/migration/vcpu_dirty_limit",
                                test_vcpu_dirty_limit);
         }
-- 
2.35.3



  parent reply	other threads:[~2024-10-17 14:32 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17 14:32 [PATCH 0/4] tests/qtest: Move the bulk of migration tests into a separate target Fabiano Rosas
2024-10-17 14:32 ` [PATCH 1/4] tests/qtest: Add check-migration Fabiano Rosas
2024-10-17 15:09   ` Daniel P. Berrangé
2024-10-17 14:32 ` [PATCH 2/4] docs: Add migration tests documentation Fabiano Rosas
2024-10-17 14:32 ` Fabiano Rosas [this message]
2024-10-17 14:32 ` [PATCH 4/4] ci: Add check-migration-quick to the clang job Fabiano Rosas
2024-10-17 14:57   ` Daniel P. Berrangé
2024-10-17 16:29     ` Fabiano Rosas
2024-10-18  9:01       ` Daniel P. Berrangé
2024-10-18  9:46         ` Peter Maydell
2024-10-18 10:00           ` Daniel P. Berrangé
2024-10-18 10:09             ` Peter Maydell
2024-10-18 10:38             ` Alex Bennée
2024-10-18 13:51             ` Fabiano Rosas
2024-10-18 13:54               ` Daniel P. Berrangé
2024-10-18 14:28                 ` Fabiano Rosas
2024-10-18 14:33                   ` Daniel P. Berrangé
2024-10-18 13:51         ` Fabiano Rosas
2024-10-18 14:21           ` Daniel P. Berrangé
2024-10-18 14:47             ` Fabiano Rosas
2024-10-18 15:25         ` Peter Maydell
2024-10-18 16:12           ` Daniel P. Berrangé
2024-10-21 14:55           ` Daniel P. Berrangé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241017143211.17771-4-farosas@suse.de \
    --to=farosas@suse.de \
    --cc=peter.maydell@linaro.org \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).