[PATCH 21/51] tests/qtest: migration-test: Skip running test_migrate_fd_proto on win32

Bin Meng posted 51 patches 3 years, 5 months ago
Maintainers: "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>, Thomas Huth <thuth@redhat.com>, Wainer dos Santos Moschetta <wainersm@redhat.com>, Beraldo Leal <bleal@redhat.com>, Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Stefan Berger <stefanb@linux.vnet.ibm.com>, Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Greg Kurz <groug@kaod.org>, Christian Schoenebeck <qemu_oss@crudebyte.com>, "Cédric Le Goater" <clg@kaod.org>, Daniel Henrique Barboza <danielhb413@gmail.com>, David Gibson <david@gibson.dropbear.id.au>, Gerd Hoffmann <kraxel@redhat.com>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Yanan Wang <wangyanan55@huawei.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Michael Roth <michael.roth@amd.com>, Konstantin Kostiuk <kkostiuk@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Juan Quintela <quintela@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, John Snow <jsnow@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Andrew Jeffery <andrew@aj.id.au>, Joel Stanley <joel@jms.id.au>, "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Ani Sinha <ani@anisinha.ca>, Alexander Bulekov <alxndr@bu.edu>, Bandan Das <bsd@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Darren Kenny <darren.kenny@oracle.com>, Qiuhao Li <Qiuhao.Li@outlook.com>, Havard Skinnemoen <hskinnemoen@google.com>, Tyrone Ting <kfting@nuvoton.com>, Markus Armbruster <armbru@redhat.com>, Coiby Xu <Coiby.Xu@gmail.com>, Jason Wang <jasowang@redhat.com>, Fam Zheng <fam@euphon.net>
There is a newer version of this series
[PATCH 21/51] tests/qtest: migration-test: Skip running test_migrate_fd_proto on win32
Posted by Bin Meng 3 years, 5 months ago
From: Bin Meng <bin.meng@windriver.com>

The test case 'test_migrate_fd_proto' calls socketpair() which does
not exist on win32. Exclude it. The helper function wait_command_fd()
is not needed anymore, hence exclude it too.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
---

 tests/qtest/migration-helpers.h | 2 ++
 tests/qtest/migration-helpers.c | 2 ++
 tests/qtest/migration-test.c    | 4 ++++
 3 files changed, 8 insertions(+)

diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helpers.h
index 59561898d0..db0684de48 100644
--- a/tests/qtest/migration-helpers.h
+++ b/tests/qtest/migration-helpers.h
@@ -17,8 +17,10 @@
 
 extern bool got_stop;
 
+#ifndef _WIN32
 G_GNUC_PRINTF(3, 4)
 QDict *wait_command_fd(QTestState *who, int fd, const char *command, ...);
+#endif
 
 G_GNUC_PRINTF(2, 3)
 QDict *wait_command(QTestState *who, const char *command, ...);
diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c
index c6fbeb3974..f6f3c6680f 100644
--- a/tests/qtest/migration-helpers.c
+++ b/tests/qtest/migration-helpers.c
@@ -34,6 +34,7 @@ static void check_stop_event(QTestState *who)
     }
 }
 
+#ifndef _WIN32
 /*
  * Events can get in the way of responses we are actually waiting for.
  */
@@ -58,6 +59,7 @@ QDict *wait_command_fd(QTestState *who, int fd, const char *command, ...)
 
     return ret;
 }
+#endif
 
 /*
  * Events can get in the way of responses we are actually waiting for.
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index af9250750b..2ae7498d5d 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -1629,6 +1629,7 @@ static void test_precopy_tcp_tls_x509_reject_anon_client(void)
 #endif /* CONFIG_TASN1 */
 #endif /* CONFIG_GNUTLS */
 
+#ifndef _WIN32
 static void *test_migrate_fd_start_hook(QTestState *from,
                                         QTestState *to)
 {
@@ -1697,6 +1698,7 @@ static void test_migrate_fd_proto(void)
     };
     test_precopy_common(&args);
 }
+#endif /* _WIN32 */
 
 static void do_test_validate_uuid(MigrateStart *args, bool should_fail)
 {
@@ -2531,7 +2533,9 @@ int main(int argc, char **argv)
 #endif /* CONFIG_GNUTLS */
 
     /* qtest_add_func("/migration/ignore_shared", test_ignore_shared); */
+#ifndef _WIN32
     qtest_add_func("/migration/fd_proto", test_migrate_fd_proto);
+#endif
     qtest_add_func("/migration/validate_uuid", test_validate_uuid);
     qtest_add_func("/migration/validate_uuid_error", test_validate_uuid_error);
     qtest_add_func("/migration/validate_uuid_src_not_set",
-- 
2.34.1
Re: [PATCH 21/51] tests/qtest: migration-test: Skip running test_migrate_fd_proto on win32
Posted by Philippe Mathieu-Daudé via 3 years, 5 months ago
On 24/8/22 11:39, Bin Meng wrote:
> From: Bin Meng <bin.meng@windriver.com>
> 
> The test case 'test_migrate_fd_proto' calls socketpair() which does
> not exist on win32. Exclude it. The helper function wait_command_fd()
> is not needed anymore, hence exclude it too.

I'd rather use a feature test, then check for the HAVE_POSIX_SOCKETPAIR
definition.

> 
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---
> 
>   tests/qtest/migration-helpers.h | 2 ++
>   tests/qtest/migration-helpers.c | 2 ++
>   tests/qtest/migration-test.c    | 4 ++++
>   3 files changed, 8 insertions(+)
Re: [PATCH 21/51] tests/qtest: migration-test: Skip running test_migrate_fd_proto on win32
Posted by Dr. David Alan Gilbert 3 years, 5 months ago
* Bin Meng (bmeng.cn@gmail.com) wrote:
> From: Bin Meng <bin.meng@windriver.com>
> 
> The test case 'test_migrate_fd_proto' calls socketpair() which does
> not exist on win32. Exclude it. The helper function wait_command_fd()
> is not needed anymore, hence exclude it too.
> 
> Signed-off-by: Bin Meng <bin.meng@windriver.com>

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
> 
>  tests/qtest/migration-helpers.h | 2 ++
>  tests/qtest/migration-helpers.c | 2 ++
>  tests/qtest/migration-test.c    | 4 ++++
>  3 files changed, 8 insertions(+)
> 
> diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helpers.h
> index 59561898d0..db0684de48 100644
> --- a/tests/qtest/migration-helpers.h
> +++ b/tests/qtest/migration-helpers.h
> @@ -17,8 +17,10 @@
>  
>  extern bool got_stop;
>  
> +#ifndef _WIN32
>  G_GNUC_PRINTF(3, 4)
>  QDict *wait_command_fd(QTestState *who, int fd, const char *command, ...);
> +#endif
>  
>  G_GNUC_PRINTF(2, 3)
>  QDict *wait_command(QTestState *who, const char *command, ...);
> diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c
> index c6fbeb3974..f6f3c6680f 100644
> --- a/tests/qtest/migration-helpers.c
> +++ b/tests/qtest/migration-helpers.c
> @@ -34,6 +34,7 @@ static void check_stop_event(QTestState *who)
>      }
>  }
>  
> +#ifndef _WIN32
>  /*
>   * Events can get in the way of responses we are actually waiting for.
>   */
> @@ -58,6 +59,7 @@ QDict *wait_command_fd(QTestState *who, int fd, const char *command, ...)
>  
>      return ret;
>  }
> +#endif
>  
>  /*
>   * Events can get in the way of responses we are actually waiting for.
> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
> index af9250750b..2ae7498d5d 100644
> --- a/tests/qtest/migration-test.c
> +++ b/tests/qtest/migration-test.c
> @@ -1629,6 +1629,7 @@ static void test_precopy_tcp_tls_x509_reject_anon_client(void)
>  #endif /* CONFIG_TASN1 */
>  #endif /* CONFIG_GNUTLS */
>  
> +#ifndef _WIN32
>  static void *test_migrate_fd_start_hook(QTestState *from,
>                                          QTestState *to)
>  {
> @@ -1697,6 +1698,7 @@ static void test_migrate_fd_proto(void)
>      };
>      test_precopy_common(&args);
>  }
> +#endif /* _WIN32 */
>  
>  static void do_test_validate_uuid(MigrateStart *args, bool should_fail)
>  {
> @@ -2531,7 +2533,9 @@ int main(int argc, char **argv)
>  #endif /* CONFIG_GNUTLS */
>  
>      /* qtest_add_func("/migration/ignore_shared", test_ignore_shared); */
> +#ifndef _WIN32
>      qtest_add_func("/migration/fd_proto", test_migrate_fd_proto);
> +#endif
>      qtest_add_func("/migration/validate_uuid", test_validate_uuid);
>      qtest_add_func("/migration/validate_uuid_error", test_validate_uuid_error);
>      qtest_add_func("/migration/validate_uuid_src_not_set",
> -- 
> 2.34.1
> 
-- 
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK