summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-10-23 15:04:58 +0200
committerLudovic Courtès <ludo@gnu.org>2021-12-12 23:20:49 +0100
commit33c498b9ee93429adc9e444ffe90df5b158fa0df (patch)
treecde01460cf12a2b8a3a17be40861c6f92a333f2b /gnu
parent72f140c25314141e98f0c02950590afe84284ca2 (diff)
downloadguix-33c498b9ee93429adc9e444ffe90df5b158fa0df.tar.gz
tests: openvswitch: Check whether ovs0 is up.
* gnu/tests/networking.scm (run-openvswitch-test)["ovs0 is up"]: New test.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/tests/networking.scm19
1 files changed, 17 insertions, 2 deletions
diff --git a/gnu/tests/networking.scm b/gnu/tests/networking.scm
index 5da1c91da6..131428c128 100644
--- a/gnu/tests/networking.scm
+++ b/gnu/tests/networking.scm
@@ -286,12 +286,15 @@ port 7, and a dict service on port 2628."
 (define (run-openvswitch-test)
   (define os
     (marionette-operating-system %openvswitch-os
-                                 #:imported-modules '((gnu services herd))))
+                                 #:imported-modules '((gnu services herd)
+                                                      (guix build syscalls))))
 
   (define test
-    (with-imported-modules '((gnu build marionette))
+    (with-imported-modules '((gnu build marionette)
+                             (guix build syscalls))
       #~(begin
           (use-modules (gnu build marionette)
+                       (guix build syscalls)
                        (ice-9 popen)
                        (ice-9 rdelim)
                        (srfi srfi-64))
@@ -339,6 +342,18 @@ port 7, and a dict service on port 2628."
                        (current-services))))
              marionette))
 
+          (test-equal "ovs0 is up"
+            IFF_UP
+            (marionette-eval
+             '(begin
+                (use-modules (guix build syscalls))
+
+                (let* ((sock  (socket AF_INET SOCK_STREAM 0))
+                       (flags (network-interface-flags sock "ovs0")))
+                  (close-port sock)
+                  (logand flags IFF_UP)))
+             marionette))
+
           (test-end)
           (exit (= (test-runner-fail-count (test-runner-current)) 0)))))