diff mbox series

[2/6] tests: Add basic migration precopy tcp test

Message ID 20171004103933.7898-3-quintela@redhat.com
State New
Headers show
Series Add make check tests for Migration | expand

Commit Message

Juan Quintela Oct. 4, 2017, 10:39 a.m. UTC
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 tests/migration-test.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Dr. David Alan Gilbert Oct. 16, 2017, 12:09 p.m. UTC | #1
* Juan Quintela (quintela@redhat.com) wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  tests/migration-test.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/tests/migration-test.c b/tests/migration-test.c
> index cd954caee4..8ef2b72459 100644
> --- a/tests/migration-test.c
> +++ b/tests/migration-test.c
> @@ -466,6 +466,13 @@ static void test_precopy_unix(void)
>      g_free(uri);
>  }
>  
> +static void test_precopy_tcp(void)
> +{
> +    const char *uri = "tcp:0:44444";
> +
> +    test_precopy(uri);
> +}

The problem is that this will fail if you make check -j  and two
tests use 4444 at the same time.
That's pretty common especially when you've built multiple architectures
as targets and all the same tests run at the same time.

Dave

>  int main(int argc, char **argv)
>  {
>      char template[] = "/tmp/migration-test-XXXXXX";
> @@ -482,6 +489,7 @@ int main(int argc, char **argv)
>      module_call_init(MODULE_INIT_QOM);
>  
>      qtest_add_func("/migration/precopy/unix", test_precopy_unix);
> +    qtest_add_func("/migration/precopy/tcp", test_precopy_tcp);
>  
>      ret = g_test_run();
>  
> -- 
> 2.13.5
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
Juan Quintela Oct. 18, 2017, 11:51 a.m. UTC | #2
"Dr. David Alan Gilbert" <dgilbert@redhat.com> wrote:
> * Juan Quintela (quintela@redhat.com) wrote:
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>>  tests/migration-test.c | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>> 
>> diff --git a/tests/migration-test.c b/tests/migration-test.c
>> index cd954caee4..8ef2b72459 100644
>> --- a/tests/migration-test.c
>> +++ b/tests/migration-test.c
>> @@ -466,6 +466,13 @@ static void test_precopy_unix(void)
>>      g_free(uri);
>>  }
>>  
>> +static void test_precopy_tcp(void)
>> +{
>> +    const char *uri = "tcp:0:44444";
>> +
>> +    test_precopy(uri);
>> +}
>
> The problem is that this will fail if you make check -j  and two
> tests use 4444 at the same time.
> That's pretty common especially when you've built multiple architectures
> as targets and all the same tests run at the same time.

Options:

- Use different start value by architecture.
- as we have a directory use O_CREAT|O_EXCL  and do create the file with
- the port number that we want to use

Anything else that you want to propose?

Later, Juan.


>
> Dave
>
>>  int main(int argc, char **argv)
>>  {
>>      char template[] = "/tmp/migration-test-XXXXXX";
>> @@ -482,6 +489,7 @@ int main(int argc, char **argv)
>>      module_call_init(MODULE_INIT_QOM);
>>  
>>      qtest_add_func("/migration/precopy/unix", test_precopy_unix);
>> +    qtest_add_func("/migration/precopy/tcp", test_precopy_tcp);
>>  
>>      ret = g_test_run();
>>  
>> -- 
>> 2.13.5
>> 
> --
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
diff mbox series

Patch

diff --git a/tests/migration-test.c b/tests/migration-test.c
index cd954caee4..8ef2b72459 100644
--- a/tests/migration-test.c
+++ b/tests/migration-test.c
@@ -466,6 +466,13 @@  static void test_precopy_unix(void)
     g_free(uri);
 }
 
+static void test_precopy_tcp(void)
+{
+    const char *uri = "tcp:0:44444";
+
+    test_precopy(uri);
+}
+
 int main(int argc, char **argv)
 {
     char template[] = "/tmp/migration-test-XXXXXX";
@@ -482,6 +489,7 @@  int main(int argc, char **argv)
     module_call_init(MODULE_INIT_QOM);
 
     qtest_add_func("/migration/precopy/unix", test_precopy_unix);
+    qtest_add_func("/migration/precopy/tcp", test_precopy_tcp);
 
     ret = g_test_run();