diff mbox series

[v6,05/11] tests/qtest: Use EXIT_FAILURE instead of magic number

Message ID 20221028045736.679903-6-bin.meng@windriver.com (mailing list archive)
State New, archived
Headers show
Series tests/qtest: Enable running qtest on Windows | expand

Commit Message

Bin Meng Oct. 28, 2022, 4:57 a.m. UTC
When migration fails, QEMU exits with a status code EXIT_FAILURE.
Change qtests to use the well-defined macro instead of magic number.

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

---

Changes in v6:
- new patch: "tests/qtest: Use EXIT_FAILURE instead of magic number"

 tests/qtest/dbus-vmstate-test.c | 2 +-
 tests/qtest/migration-test.c    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Thomas Huth Oct. 28, 2022, 8:02 a.m. UTC | #1
On 28/10/2022 06.57, Bin Meng wrote:
> When migration fails, QEMU exits with a status code EXIT_FAILURE.
> Change qtests to use the well-defined macro instead of magic number.
> 
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> 
> ---
> 
> Changes in v6:
> - new patch: "tests/qtest: Use EXIT_FAILURE instead of magic number"
> 
>   tests/qtest/dbus-vmstate-test.c | 2 +-
>   tests/qtest/migration-test.c    | 4 ++--
>   2 files changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>
Juan Quintela Oct. 28, 2022, 12:31 p.m. UTC | #2
Bin Meng <bin.meng@windriver.com> wrote:
> When migration fails, QEMU exits with a status code EXIT_FAILURE.
> Change qtests to use the well-defined macro instead of magic number.
>
> Signed-off-by: Bin Meng <bin.meng@windriver.com>

Reviewed-by: Juan Quintela <quintela@redhat.com>


>
> ---
>
> Changes in v6:
> - new patch: "tests/qtest: Use EXIT_FAILURE instead of magic number"
>
>  tests/qtest/dbus-vmstate-test.c | 2 +-
>  tests/qtest/migration-test.c    | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tests/qtest/dbus-vmstate-test.c b/tests/qtest/dbus-vmstate-test.c
> index 74ede651f6..6c990864e3 100644
> --- a/tests/qtest/dbus-vmstate-test.c
> +++ b/tests/qtest/dbus-vmstate-test.c
> @@ -233,7 +233,7 @@ test_dbus_vmstate(Test *test)
>      test->src_qemu = src_qemu;
>      if (test->migrate_fail) {
>          wait_for_migration_fail(src_qemu, true);
> -        qtest_set_expected_status(dst_qemu, 1);
> +        qtest_set_expected_status(dst_qemu, EXIT_FAILURE);
>      } else {
>          wait_for_migration_complete(src_qemu);
>      }
> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
> index aa1ba179fa..28a06d8170 100644
> --- a/tests/qtest/migration-test.c
> +++ b/tests/qtest/migration-test.c
> @@ -1342,7 +1342,7 @@ static void test_precopy_common(MigrateCommon *args)
>          wait_for_migration_fail(from, allow_active);
>  
>          if (args->result == MIG_TEST_FAIL_DEST_QUIT_ERR) {
> -            qtest_set_expected_status(to, 1);
> +            qtest_set_expected_status(to, EXIT_FAILURE);
>          }
>      } else {
>          if (args->iterations) {
> @@ -1738,7 +1738,7 @@ static void do_test_validate_uuid(MigrateStart *args, bool should_fail)
>      migrate_qmp(from, uri, "{}");
>  
>      if (should_fail) {
> -        qtest_set_expected_status(to, 1);
> +        qtest_set_expected_status(to, EXIT_FAILURE);
>          wait_for_migration_fail(from, true);
>      } else {
>          wait_for_migration_complete(from);
diff mbox series

Patch

diff --git a/tests/qtest/dbus-vmstate-test.c b/tests/qtest/dbus-vmstate-test.c
index 74ede651f6..6c990864e3 100644
--- a/tests/qtest/dbus-vmstate-test.c
+++ b/tests/qtest/dbus-vmstate-test.c
@@ -233,7 +233,7 @@  test_dbus_vmstate(Test *test)
     test->src_qemu = src_qemu;
     if (test->migrate_fail) {
         wait_for_migration_fail(src_qemu, true);
-        qtest_set_expected_status(dst_qemu, 1);
+        qtest_set_expected_status(dst_qemu, EXIT_FAILURE);
     } else {
         wait_for_migration_complete(src_qemu);
     }
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index aa1ba179fa..28a06d8170 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -1342,7 +1342,7 @@  static void test_precopy_common(MigrateCommon *args)
         wait_for_migration_fail(from, allow_active);
 
         if (args->result == MIG_TEST_FAIL_DEST_QUIT_ERR) {
-            qtest_set_expected_status(to, 1);
+            qtest_set_expected_status(to, EXIT_FAILURE);
         }
     } else {
         if (args->iterations) {
@@ -1738,7 +1738,7 @@  static void do_test_validate_uuid(MigrateStart *args, bool should_fail)
     migrate_qmp(from, uri, "{}");
 
     if (should_fail) {
-        qtest_set_expected_status(to, 1);
+        qtest_set_expected_status(to, EXIT_FAILURE);
         wait_for_migration_fail(from, true);
     } else {
         wait_for_migration_complete(from);