diff mbox series

[2/4] tests/test-util-sockets: Skip test on non-x86 Travis containers

Message ID 20200317200541.6246-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 17, 2020, 8:05 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.

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

Comments

Daniel P. Berrangé March 18, 2020, 9:45 a.m. UTC | #1
On Tue, Mar 17, 2020 at 09:05:39PM +0100, Philippe Mathieu-Daudé wrote:
> 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.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  tests/test-util-sockets.c | 7 +++++++
>  1 file changed, 7 insertions(+)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


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