diff mbox series

[v4,19/19] tests: Add postcopy preempt tests

Message ID 20220331150857.74406-20-peterx@redhat.com
State New
Headers show
Series migration: Postcopy Preemption | expand

Commit Message

Peter Xu March 31, 2022, 3:08 p.m. UTC
Four tests are added for preempt mode:

  - Postcopy default
  - Postcopy tls
  - Postcopy recovery
  - Postcopy tls+recovery

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 tests/qtest/migration-test.c | 49 ++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

Comments

Peter Xu March 31, 2022, 3:25 p.m. UTC | #1
On Thu, Mar 31, 2022 at 11:08:57AM -0400, Peter Xu wrote:
> Four tests are added for preempt mode:
> 
>   - Postcopy default
>   - Postcopy tls
>   - Postcopy recovery
>   - Postcopy tls+recovery
> 
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  tests/qtest/migration-test.c | 49 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 49 insertions(+)
> 
> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
> index 7288c64e97..7188503ae1 100644
> --- a/tests/qtest/migration-test.c
> +++ b/tests/qtest/migration-test.c
> @@ -477,6 +477,7 @@ typedef struct {
>       */
>      bool hide_stderr;
>      bool use_shmem;
> +    bool postcopy_preempt;
>      /* only launch the target process */
>      bool only_target;
>      /* Use dirty ring if true; dirty logging otherwise */
> @@ -992,6 +993,11 @@ static int migrate_postcopy_prepare(QTestState **from_ptr,
>      migrate_set_capability(to, "postcopy-ram", true);
>      migrate_set_capability(to, "postcopy-blocktime", true);
>  
> +    if (args->postcopy_preempt) {
> +        migrate_set_capability(from, "postcopy-preempt", true);
> +        migrate_set_capability(to, "postcopy-preempt", true);
> +    }
> +
>      /* We want to pick a speed slow enough that the test completes
>       * quickly, but that it doesn't complete precopy even on a slow
>       * machine, so also set the downtime.
> @@ -1058,6 +1064,25 @@ static void test_postcopy_tls(void)
>      test_postcopy_common(&args);
>  }
>  
> +static void test_postcopy_preempt(void)
> +{
> +    MigrateStart args = {
> +        .postcopy_preempt = true,
> +    };
> +
> +    test_postcopy_common(&args);
> +}
> +
> +static void test_postcopy_preempt_tls(void)
> +{
> +    MigrateStart args = {
> +        .postcopy_preempt = true,
> +        .postcopy_tls = true,
> +    };
> +
> +    test_postcopy_common(&args);
> +}
> +
>  static void test_postcopy_recovery_common(MigrateStart *args)
>  {
>      QTestState *from, *to;
> @@ -1134,6 +1159,24 @@ static void test_postcopy_recovery_tls(void)
>      test_postcopy_recovery_common(&args);
>  }
>  
> +static void test_postcopy_preempt_recovery(void)
> +{
> +    MigrateStart args = { .postcopy_preempt = true };
> +
> +    test_postcopy_recovery_common(&args);
> +}
> +
> +/* This contains preempt+recovery+tls test altogether */
> +static void test_postcopy_preempt_all(void)
> +{
> +    MigrateStart args = {
> +        .postcopy_preempt = true,
> +        .postcopy_tls = true,
> +    };
> +
> +    test_postcopy_recovery_common(&args);
> +}
> +
>  static void test_baddest(void)
>  {
>      MigrateStart args = {
> @@ -2176,6 +2219,12 @@ int main(int argc, char **argv)
>  
>      qtest_add_func("/migration/postcopy/unix", test_postcopy);
>      qtest_add_func("/migration/postcopy/recovery", test_postcopy_recovery);
> +    qtest_add_func("/migration/postcopy/preempt/unix", test_postcopy_preempt);
> +    qtest_add_func("/migration/postcopy/preempt/recovery",
> +                   test_postcopy_preempt_recovery);
> +    qtest_add_func("/migration/postcopy/preempt/tls", test_postcopy_preempt_tls);
> +    qtest_add_func("/migration/postcopy/preempt/tls+recovery",
> +                   test_postcopy_preempt_all);
>  #ifdef CONFIG_GNUTLS
>      qtest_add_func("/migration/postcopy/tls", test_postcopy_tls);
>      qtest_add_func("/migration/postcopy/tls/recovery", test_postcopy_recovery_tls);

Ehh, the latter two need to be put into CONFIG_GNUTLS block..

---8<---
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 7188503ae1..3d4fe89f52 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -2222,12 +2222,12 @@ int main(int argc, char **argv)
     qtest_add_func("/migration/postcopy/preempt/unix", test_postcopy_preempt);
     qtest_add_func("/migration/postcopy/preempt/recovery",
                    test_postcopy_preempt_recovery);
-    qtest_add_func("/migration/postcopy/preempt/tls", test_postcopy_preempt_tls);
-    qtest_add_func("/migration/postcopy/preempt/tls+recovery",
-                   test_postcopy_preempt_all);
 #ifdef CONFIG_GNUTLS
     qtest_add_func("/migration/postcopy/tls", test_postcopy_tls);
     qtest_add_func("/migration/postcopy/tls/recovery", test_postcopy_recovery_tls);
+    qtest_add_func("/migration/postcopy/preempt/tls", test_postcopy_preempt_tls);
+    qtest_add_func("/migration/postcopy/preempt/tls+recovery",
+                   test_postcopy_preempt_all);
 #endif /* CONFIG_GNUTLS */
     qtest_add_func("/migration/bad_dest", test_baddest);
     qtest_add_func("/migration/precopy/unix/plain", test_precopy_unix_plain);
---8<---

Sorry for the noise.
Daniel P. Berrangé April 20, 2022, 11:43 a.m. UTC | #2
On Thu, Mar 31, 2022 at 11:08:57AM -0400, Peter Xu wrote:
> Four tests are added for preempt mode:
> 
>   - Postcopy default
>   - Postcopy tls
>   - Postcopy recovery
>   - Postcopy tls+recovery
> 
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  tests/qtest/migration-test.c | 49 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 49 insertions(+)
> 
> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
> index 7288c64e97..7188503ae1 100644
> --- a/tests/qtest/migration-test.c
> +++ b/tests/qtest/migration-test.c
> @@ -477,6 +477,7 @@ typedef struct {
>       */
>      bool hide_stderr;
>      bool use_shmem;
> +    bool postcopy_preempt;
>      /* only launch the target process */
>      bool only_target;
>      /* Use dirty ring if true; dirty logging otherwise */
> @@ -992,6 +993,11 @@ static int migrate_postcopy_prepare(QTestState **from_ptr,
>      migrate_set_capability(to, "postcopy-ram", true);
>      migrate_set_capability(to, "postcopy-blocktime", true);
>  
> +    if (args->postcopy_preempt) {
> +        migrate_set_capability(from, "postcopy-preempt", true);
> +        migrate_set_capability(to, "postcopy-preempt", true);
> +    }
> +
>      /* We want to pick a speed slow enough that the test completes
>       * quickly, but that it doesn't complete precopy even on a slow
>       * machine, so also set the downtime.
> @@ -1058,6 +1064,25 @@ static void test_postcopy_tls(void)
>      test_postcopy_common(&args);
>  }
>  
> +static void test_postcopy_preempt(void)
> +{
> +    MigrateStart args = {
> +        .postcopy_preempt = true,
> +    };
> +
> +    test_postcopy_common(&args);
> +}
> +
> +static void test_postcopy_preempt_tls(void)
> +{
> +    MigrateStart args = {
> +        .postcopy_preempt = true,
> +        .postcopy_tls = true,
> +    };
> +
> +    test_postcopy_common(&args);
> +}
> +
>  static void test_postcopy_recovery_common(MigrateStart *args)
>  {
>      QTestState *from, *to;
> @@ -1134,6 +1159,24 @@ static void test_postcopy_recovery_tls(void)
>      test_postcopy_recovery_common(&args);
>  }
>  
> +static void test_postcopy_preempt_recovery(void)
> +{
> +    MigrateStart args = { .postcopy_preempt = true };
> +
> +    test_postcopy_recovery_common(&args);
> +}
> +
> +/* This contains preempt+recovery+tls test altogether */
> +static void test_postcopy_preempt_all(void)
> +{
> +    MigrateStart args = {
> +        .postcopy_preempt = true,
> +        .postcopy_tls = true,
> +    };
> +
> +    test_postcopy_recovery_common(&args);
> +}
> +
>  static void test_baddest(void)
>  {
>      MigrateStart args = {
> @@ -2176,6 +2219,12 @@ int main(int argc, char **argv)
>  
>      qtest_add_func("/migration/postcopy/unix", test_postcopy);
>      qtest_add_func("/migration/postcopy/recovery", test_postcopy_recovery);
> +    qtest_add_func("/migration/postcopy/preempt/unix", test_postcopy_preempt);
> +    qtest_add_func("/migration/postcopy/preempt/recovery",
> +                   test_postcopy_preempt_recovery);
> +    qtest_add_func("/migration/postcopy/preempt/tls", test_postcopy_preempt_tls);
> +    qtest_add_func("/migration/postcopy/preempt/tls+recovery",
> +                   test_postcopy_preempt_all);

On test naming again I think we want these four tests to have names

    /migration/postcopy/preempt/plain
    /migration/postcopy/preempt/tls/psk
    /migration/postcopy/preempt/recovery/plain
    /migration/postcopy/preempt/recovery/tls/psk


With regards,
Daniel
Peter Xu April 20, 2022, 8:51 p.m. UTC | #3
On Wed, Apr 20, 2022 at 12:43:39PM +0100, Daniel P. Berrangé wrote:
> >  static void test_baddest(void)
> >  {
> >      MigrateStart args = {
> > @@ -2176,6 +2219,12 @@ int main(int argc, char **argv)
> >  
> >      qtest_add_func("/migration/postcopy/unix", test_postcopy);
> >      qtest_add_func("/migration/postcopy/recovery", test_postcopy_recovery);
> > +    qtest_add_func("/migration/postcopy/preempt/unix", test_postcopy_preempt);
> > +    qtest_add_func("/migration/postcopy/preempt/recovery",
> > +                   test_postcopy_preempt_recovery);
> > +    qtest_add_func("/migration/postcopy/preempt/tls", test_postcopy_preempt_tls);
> > +    qtest_add_func("/migration/postcopy/preempt/tls+recovery",
> > +                   test_postcopy_preempt_all);
> 
> On test naming again I think we want these four tests to have names
> 
>     /migration/postcopy/preempt/plain
>     /migration/postcopy/preempt/tls/psk
>     /migration/postcopy/preempt/recovery/plain
>     /migration/postcopy/preempt/recovery/tls/psk

Well to think it again, logically if we prefer to spell out tls/psk, then
we may also want to spell out preempt/unix because of the same reason..

Similarly to all the vanilla postcopy/* tests, where if we keep tls/psk,
then we should keep postcopy/unix rather than postcopy/plain.

But let's not bother much with it.. I'll apply all the changes above in the
new version.

Thanks a lot for reviewing the series,
diff mbox series

Patch

diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 7288c64e97..7188503ae1 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -477,6 +477,7 @@  typedef struct {
      */
     bool hide_stderr;
     bool use_shmem;
+    bool postcopy_preempt;
     /* only launch the target process */
     bool only_target;
     /* Use dirty ring if true; dirty logging otherwise */
@@ -992,6 +993,11 @@  static int migrate_postcopy_prepare(QTestState **from_ptr,
     migrate_set_capability(to, "postcopy-ram", true);
     migrate_set_capability(to, "postcopy-blocktime", true);
 
+    if (args->postcopy_preempt) {
+        migrate_set_capability(from, "postcopy-preempt", true);
+        migrate_set_capability(to, "postcopy-preempt", true);
+    }
+
     /* We want to pick a speed slow enough that the test completes
      * quickly, but that it doesn't complete precopy even on a slow
      * machine, so also set the downtime.
@@ -1058,6 +1064,25 @@  static void test_postcopy_tls(void)
     test_postcopy_common(&args);
 }
 
+static void test_postcopy_preempt(void)
+{
+    MigrateStart args = {
+        .postcopy_preempt = true,
+    };
+
+    test_postcopy_common(&args);
+}
+
+static void test_postcopy_preempt_tls(void)
+{
+    MigrateStart args = {
+        .postcopy_preempt = true,
+        .postcopy_tls = true,
+    };
+
+    test_postcopy_common(&args);
+}
+
 static void test_postcopy_recovery_common(MigrateStart *args)
 {
     QTestState *from, *to;
@@ -1134,6 +1159,24 @@  static void test_postcopy_recovery_tls(void)
     test_postcopy_recovery_common(&args);
 }
 
+static void test_postcopy_preempt_recovery(void)
+{
+    MigrateStart args = { .postcopy_preempt = true };
+
+    test_postcopy_recovery_common(&args);
+}
+
+/* This contains preempt+recovery+tls test altogether */
+static void test_postcopy_preempt_all(void)
+{
+    MigrateStart args = {
+        .postcopy_preempt = true,
+        .postcopy_tls = true,
+    };
+
+    test_postcopy_recovery_common(&args);
+}
+
 static void test_baddest(void)
 {
     MigrateStart args = {
@@ -2176,6 +2219,12 @@  int main(int argc, char **argv)
 
     qtest_add_func("/migration/postcopy/unix", test_postcopy);
     qtest_add_func("/migration/postcopy/recovery", test_postcopy_recovery);
+    qtest_add_func("/migration/postcopy/preempt/unix", test_postcopy_preempt);
+    qtest_add_func("/migration/postcopy/preempt/recovery",
+                   test_postcopy_preempt_recovery);
+    qtest_add_func("/migration/postcopy/preempt/tls", test_postcopy_preempt_tls);
+    qtest_add_func("/migration/postcopy/preempt/tls+recovery",
+                   test_postcopy_preempt_all);
 #ifdef CONFIG_GNUTLS
     qtest_add_func("/migration/postcopy/tls", test_postcopy_tls);
     qtest_add_func("/migration/postcopy/tls/recovery", test_postcopy_recovery_tls);