diff mbox series

[PATCH-for-5.0,v2,2/4] tests/test-util-sockets: Skip test on non-x86 Travis containers

Message ID 20200318222717.24676-3-philmd@redhat.com (mailing list archive)
State New, archived
Headers show
Series travis-ci: Add a KVM-only s390x job | expand

Commit Message

Philippe Mathieu-Daudé March 18, 2020, 10:27 p.m. UTC
Similarly to commit 4f370b1098, test-util-sockets fails in
restricted non-x86 Travis containers since they apparently
blacklisted some required system calls there.
Let's simply skip the test if we detect such an environment.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/test-util-sockets.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Cornelia Huck March 20, 2020, 11:39 a.m. UTC | #1
On Wed, 18 Mar 2020 23:27:15 +0100
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:

> Similarly to commit 4f370b1098, test-util-sockets fails in
> restricted non-x86 Travis containers since they apparently
> blacklisted some required system calls there.

Is "they" == "Travis admins"? Can we get them to remove those calls
from the blacklist?

(I'm wondering why x86 allows those calls. Probably just because it has
been around for longer.)

> Let's simply skip the test if we detect such an environment.
> 
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  tests/test-util-sockets.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/tests/test-util-sockets.c b/tests/test-util-sockets.c
> index 5fd947c7bf..046ebec8ba 100644
> --- a/tests/test-util-sockets.c
> +++ b/tests/test-util-sockets.c
> @@ -231,11 +231,18 @@ static void test_socket_fd_pass_num_nocli(void)
>  int main(int argc, char **argv)
>  {
>      bool has_ipv4, has_ipv6;
> +    char *travis_arch;
>  
>      socket_init();
>  
>      g_test_init(&argc, &argv, NULL);
>  
> +    travis_arch = getenv("TRAVIS_CPU_ARCH");
> +    if (travis_arch && !g_str_equal(travis_arch, "x86_64")) {
> +        g_printerr("Test does not work on non-x86 Travis containers.");
> +        goto end;
> +    }
> +
>      /* We're creating actual IPv4/6 sockets, so we should
>       * check if the host running tests actually supports
>       * each protocol to avoid breaking tests on machines
Philippe Mathieu-Daudé March 22, 2020, 10:48 a.m. UTC | #2
On 3/20/20 12:39 PM, Cornelia Huck wrote:
> On Wed, 18 Mar 2020 23:27:15 +0100
> Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> 
>> Similarly to commit 4f370b1098, test-util-sockets fails in
>> restricted non-x86 Travis containers since they apparently
>> blacklisted some required system calls there.
> 
> Is "they" == "Travis admins"? Can we get them to remove those calls
> from the blacklist?

I suppose, I copy/pasted Thomas's description from commit 4f370b1098.

No clue, but we can try :)

> 
> (I'm wondering why x86 allows those calls. Probably just because it has
> been around for longer.)
> 
>> Let's simply skip the test if we detect such an environment.
>>
>> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>>   tests/test-util-sockets.c | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/tests/test-util-sockets.c b/tests/test-util-sockets.c
>> index 5fd947c7bf..046ebec8ba 100644
>> --- a/tests/test-util-sockets.c
>> +++ b/tests/test-util-sockets.c
>> @@ -231,11 +231,18 @@ static void test_socket_fd_pass_num_nocli(void)
>>   int main(int argc, char **argv)
>>   {
>>       bool has_ipv4, has_ipv6;
>> +    char *travis_arch;
>>   
>>       socket_init();
>>   
>>       g_test_init(&argc, &argv, NULL);
>>   
>> +    travis_arch = getenv("TRAVIS_CPU_ARCH");
>> +    if (travis_arch && !g_str_equal(travis_arch, "x86_64")) {
>> +        g_printerr("Test does not work on non-x86 Travis containers.");
>> +        goto end;
>> +    }
>> +
>>       /* We're creating actual IPv4/6 sockets, so we should
>>        * check if the host running tests actually supports
>>        * each protocol to avoid breaking tests on machines
>
Daniel P. Berrangé March 23, 2020, 9:48 a.m. UTC | #3
On Fri, Mar 20, 2020 at 12:39:58PM +0100, Cornelia Huck wrote:
> On Wed, 18 Mar 2020 23:27:15 +0100
> Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> 
> > Similarly to commit 4f370b1098, test-util-sockets fails in
> > restricted non-x86 Travis containers since they apparently
> > blacklisted some required system calls there.
> 
> Is "they" == "Travis admins"? Can we get them to remove those calls
> from the blacklist?
> 
> (I'm wondering why x86 allows those calls. Probably just because it has
> been around for longer.)

I believe it is due to the different build env architecture for
the non-x86 arches, which is based on a strict locked down container,
compared to x86 which IIUC was a full VM.

Blacklisting like this is a bit hacky, but a prudent fix in the short
term.

Regards,
Daniel
Philippe Mathieu-Daudé March 23, 2020, 10:11 a.m. UTC | #4
On 3/23/20 10:48 AM, Daniel P. Berrangé wrote:
> On Fri, Mar 20, 2020 at 12:39:58PM +0100, Cornelia Huck wrote:
>> On Wed, 18 Mar 2020 23:27:15 +0100
>> Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>>
>>> Similarly to commit 4f370b1098, test-util-sockets fails in
>>> restricted non-x86 Travis containers since they apparently
>>> blacklisted some required system calls there.
>>
>> Is "they" == "Travis admins"? Can we get them to remove those calls
>> from the blacklist?
>>
>> (I'm wondering why x86 allows those calls. Probably just because it has
>> been around for longer.)
> 
> I believe it is due to the different build env architecture for
> the non-x86 arches, which is based on a strict locked down container,
> compared to x86 which IIUC was a full VM.

Indeed, Thomas described:

  "Unfortunately, the builds are running in quite restricted
   LXD containers there, for example it is not possible to
   create huge files there (even if they are just sparse),
   and certain system calls are blocked. So we have to change
   some tests first to stop them failing in such environments."

https://www.mail-archive.com/qemu-devel@nongnu.org/msg659909.html

> 
> Blacklisting like this is a bit hacky, but a prudent fix in the short
> term.
> 
> Regards,
> Daniel
>
diff mbox series

Patch

diff --git a/tests/test-util-sockets.c b/tests/test-util-sockets.c
index 5fd947c7bf..046ebec8ba 100644
--- a/tests/test-util-sockets.c
+++ b/tests/test-util-sockets.c
@@ -231,11 +231,18 @@  static void test_socket_fd_pass_num_nocli(void)
 int main(int argc, char **argv)
 {
     bool has_ipv4, has_ipv6;
+    char *travis_arch;
 
     socket_init();
 
     g_test_init(&argc, &argv, NULL);
 
+    travis_arch = getenv("TRAVIS_CPU_ARCH");
+    if (travis_arch && !g_str_equal(travis_arch, "x86_64")) {
+        g_printerr("Test does not work on non-x86 Travis containers.");
+        goto end;
+    }
+
     /* We're creating actual IPv4/6 sockets, so we should
      * check if the host running tests actually supports
      * each protocol to avoid breaking tests on machines