diff mbox series

[v4,43/54] tests/qtest: migration-test: Make sure QEMU process "to" exited after migration is canceled

Message ID 20220927110632.1973965-44-bmeng.cn@gmail.com (mailing list archive)
State New, archived
Headers show
Series tests/qtest: Enable running qtest on Windows | expand

Commit Message

Bin Meng Sept. 27, 2022, 11:06 a.m. UTC
From: Xuzhou Cheng <xuzhou.cheng@windriver.com>

Make sure QEMU process "to" exited before launching another target
for migration in the test_multifd_tcp_cancel case.

Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
Signed-off-by: Bin Meng <bin.meng@windriver.com>
---

(no changes since v3)

Changes in v3:
- Add a usleep(1) in the busy wait loop

Changes in v2:
- Change to a busy wait after migration is canceled

 tests/qtest/migration-test.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Marc-André Lureau Sept. 27, 2022, 1:15 p.m. UTC | #1
Hi

On Tue, Sep 27, 2022 at 5:02 PM Bin Meng <bmeng.cn@gmail.com> wrote:

> From: Xuzhou Cheng <xuzhou.cheng@windriver.com>
>
> Make sure QEMU process "to" exited before launching another target
> for migration in the test_multifd_tcp_cancel case.
>
> Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---
>
> (no changes since v3)
>
> Changes in v3:
> - Add a usleep(1) in the busy wait loop
>
> Changes in v2:
> - Change to a busy wait after migration is canceled
>
>  tests/qtest/migration-test.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
> index 45c5f5761b..6f9fe13488 100644
> --- a/tests/qtest/migration-test.c
> +++ b/tests/qtest/migration-test.c
> @@ -2132,6 +2132,10 @@ static void test_multifd_tcp_cancel(void)
>      wait_for_migration_pass(from);
>
>      migrate_cancel(from);
> +    /* Make sure QEMU process "to" exited */
> +    while (qtest_probe_child(to)) {
> +        usleep(1);
>

Why not add a qtest_wait_qemu() ? (I think qtest_probe_child() should also
be renamed)


> +    }
>
>      args = (MigrateStart){
>          .only_target = true,
> --
> 2.34.1
>
>
>
Bin Meng Sept. 27, 2022, 1:21 p.m. UTC | #2
On Tue, Sep 27, 2022 at 9:15 PM Marc-André Lureau
<marcandre.lureau@gmail.com> wrote:
>
> Hi
>
> On Tue, Sep 27, 2022 at 5:02 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>>
>> From: Xuzhou Cheng <xuzhou.cheng@windriver.com>
>>
>> Make sure QEMU process "to" exited before launching another target
>> for migration in the test_multifd_tcp_cancel case.
>>
>> Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
>> Signed-off-by: Bin Meng <bin.meng@windriver.com>
>> ---
>>
>> (no changes since v3)
>>
>> Changes in v3:
>> - Add a usleep(1) in the busy wait loop
>>
>> Changes in v2:
>> - Change to a busy wait after migration is canceled
>>
>>  tests/qtest/migration-test.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
>> index 45c5f5761b..6f9fe13488 100644
>> --- a/tests/qtest/migration-test.c
>> +++ b/tests/qtest/migration-test.c
>> @@ -2132,6 +2132,10 @@ static void test_multifd_tcp_cancel(void)
>>      wait_for_migration_pass(from);
>>
>>      migrate_cancel(from);
>> +    /* Make sure QEMU process "to" exited */
>> +    while (qtest_probe_child(to)) {
>> +        usleep(1);
>
>
> Why not add a qtest_wait_qemu() ? (I think qtest_probe_child() should also be renamed)
>

Do you mean adding:

void qtest_wait_qemu(QTestState *s)
{
    while (qtest_probe_child(s)) {
        usleep(1);
    }
}

Do you have a better name for qtest_probe_child()?

Regards,
Bin
Marc-André Lureau Sept. 27, 2022, 2:23 p.m. UTC | #3
Hi

On Tue, Sep 27, 2022 at 5:21 PM Bin Meng <bmeng.cn@gmail.com> wrote:

> On Tue, Sep 27, 2022 at 9:15 PM Marc-André Lureau
> <marcandre.lureau@gmail.com> wrote:
> >
> > Hi
> >
> > On Tue, Sep 27, 2022 at 5:02 PM Bin Meng <bmeng.cn@gmail.com> wrote:
> >>
> >> From: Xuzhou Cheng <xuzhou.cheng@windriver.com>
> >>
> >> Make sure QEMU process "to" exited before launching another target
> >> for migration in the test_multifd_tcp_cancel case.
> >>
> >> Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
> >> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> >> ---
> >>
> >> (no changes since v3)
> >>
> >> Changes in v3:
> >> - Add a usleep(1) in the busy wait loop
> >>
> >> Changes in v2:
> >> - Change to a busy wait after migration is canceled
> >>
> >>  tests/qtest/migration-test.c | 4 ++++
> >>  1 file changed, 4 insertions(+)
> >>
> >> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
> >> index 45c5f5761b..6f9fe13488 100644
> >> --- a/tests/qtest/migration-test.c
> >> +++ b/tests/qtest/migration-test.c
> >> @@ -2132,6 +2132,10 @@ static void test_multifd_tcp_cancel(void)
> >>      wait_for_migration_pass(from);
> >>
> >>      migrate_cancel(from);
> >> +    /* Make sure QEMU process "to" exited */
> >> +    while (qtest_probe_child(to)) {
> >> +        usleep(1);
> >
> >
> > Why not add a qtest_wait_qemu() ? (I think qtest_probe_child() should
> also be renamed)
> >
>
> Do you mean adding:
>
> void qtest_wait_qemu(QTestState *s)
> {
>     while (qtest_probe_child(s)) {
>         usleep(1);
>     }
> }
>

No, more like qtest_probe_child() but without WNOHANG.


>
> Do you have a better name for qtest_probe_child()?
>
>
Perhaps qtest_wait_child() with a new argument "bool nohang" then?
diff mbox series

Patch

diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 45c5f5761b..6f9fe13488 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -2132,6 +2132,10 @@  static void test_multifd_tcp_cancel(void)
     wait_for_migration_pass(from);
 
     migrate_cancel(from);
+    /* Make sure QEMU process "to" exited */
+    while (qtest_probe_child(to)) {
+        usleep(1);
+    }
 
     args = (MigrateStart){
         .only_target = true,